List of usage examples for java.util.function Predicate test
boolean test(T t);
From source file:org.jlib.basefunctions.apachecommons.equals.ApacheCommonsEqualsEngine.java
@Override public EqualsEngine<Obj> add(final Predicate<Object> superEquals) { builder.appendSuper(superEquals.test(other)); return this; }
From source file:org.opensingular.form.calculation.SimpleValueCalculation.java
default SimpleValueCalculation<RESULT> prependOn(Predicate<CalculationContext> condition, RESULT val) { return c -> condition.test(c) ? val : this.calculate(c); }
From source file:net.minecraftforge.registries.GameData.java
public static void fireRegistryEvents(Predicate<ResourceLocation> filter) { List<ResourceLocation> keys = Lists.newArrayList(RegistryManager.ACTIVE.registries.keySet()); Collections.sort(keys, (o1, o2) -> o1.toString().compareToIgnoreCase(o2.toString())); /*/*w w w .j av a2 s . c om*/ RegistryManager.ACTIVE.registries.forEach((name, reg) -> { if (filter.test(name)) ((ForgeRegistry<?>)reg).unfreeze(); }); */ if (filter.test(BLOCKS)) { MinecraftForge.EVENT_BUS.post(RegistryManager.ACTIVE.getRegistry(BLOCKS).getRegisterEvent(BLOCKS)); ObjectHolderRegistry.INSTANCE.applyObjectHolders(); // inject any blocks } if (filter.test(ITEMS)) { MinecraftForge.EVENT_BUS.post(RegistryManager.ACTIVE.getRegistry(ITEMS).getRegisterEvent(ITEMS)); ObjectHolderRegistry.INSTANCE.applyObjectHolders(); // inject any items } for (ResourceLocation rl : keys) { if (!filter.test(rl)) continue; if (rl == BLOCKS || rl == ITEMS) continue; MinecraftForge.EVENT_BUS.post(RegistryManager.ACTIVE.getRegistry(rl).getRegisterEvent(rl)); } ObjectHolderRegistry.INSTANCE.applyObjectHolders(); // inject everything else /* RegistryManager.ACTIVE.registries.forEach((name, reg) -> { if (filter.test(name)) ((ForgeRegistry<?>)reg).freeze(); }); */ }
From source file:org.datalorax.populace.core.walk.field.filter.AnyFieldFilter.java
@Override public boolean test(final FieldInfo field) { for (Predicate<FieldInfo> filter : filters) { if (filter.test(field)) { return true; }/*from w w w . ja v a 2 s .c om*/ } return false; }
From source file:org.datalorax.populace.core.walk.field.filter.AllFieldFilter.java
@Override public boolean test(final FieldInfo field) { for (Predicate<FieldInfo> filter : filters) { if (!filter.test(field)) { return false; }/*from w ww . j av a2s . c om*/ } return true; }
From source file:com.ibm.watson.catalyst.jumpqa.heuristics.BooleanHeuristics.java
/** * Whether any predicate returns true/*from w w w.j ava2 s. c o m*/ * * @param input the object to evaluate * @return whether any predicate returned true */ public final boolean anyTrue(final T input) { for (final Predicate<T> p : _predicates) { if (p.test(input)) return true; } return false; }
From source file:de.vandermeer.skb.interfaces.transformers.Transformer.java
/** * Transforms from one representation to another if a given predicate tests true. * @param from input representation// w w w .j a v a2 s .c om * @param predicate predicate to apply to input before transformation * @return output representation or null if input was null or unexpected class * @throws NullPointerException if any argument was null */ default TO transform(FROM from, Predicate<FROM> predicate) { Validate.notNull(from); Validate.notNull(predicate); if (predicate.test(from)) { return this.transform(from); } return null; }
From source file:com.ibm.watson.catalyst.jumpqa.heuristics.BooleanHeuristics.java
/** * Whether all predicates return true/* ww w . j a v a2 s . c o m*/ * * @param input the object to evaluate * @return whether all predicates returned true */ public final boolean allTrue(final T input) { for (final Predicate<T> p : _predicates) { if (!p.test(input)) return false; } return true; }
From source file:org.springframework.test.web.reactive.server.LoggingActions.java
private ResponseAssertions<T> doLog(Predicate<Log> predicate, BiConsumer<Log, String> consumer) { if (predicate.test(logger)) { consumer.accept(logger, getOutput()); }/*from w ww. j a v a 2s. c o m*/ return this.resultAssertions; }
From source file:org.springframework.test.web.reactive.server.LoggingExchangeConsumer.java
private ExchangeActions doLog(Predicate<Log> logLevelPredicate, BiConsumer<Log, String> logAction) { if (logLevelPredicate.test(logger)) { logAction.accept(logger, this.exchangeInfo.toString()); }//from ww w .j a v a 2 s.c om return this.exchangeActions; }