List of usage examples for com.google.common.collect Iterables all
public static <T> boolean all(Iterable<T> iterable, Predicate<? super T> predicate)
From source file:io.soabase.core.features.discovery.DefaultDiscoveryHealth.java
@Override public boolean shouldBeInDiscovery(HealthCheckRegistry registry) { return Iterables.all(registry.runHealthChecks().values(), new Predicate<HealthCheck.Result>() { @Override/* ww w. j a v a 2s. c om*/ public boolean apply(HealthCheck.Result result) { return result.isHealthy(); } }); }
From source file:com.analog.lyric.dimple.solvers.sumproduct.customFactors.CustomMultivariateGaussianNegate.java
/** * Utility to indicate whether or not a factor is compatible with the requirements of this custom factor * @deprecated as of release 0.08//from w w w.j a v a 2 s .com */ @Deprecated public static boolean isFactorCompatible(Factor factor) { return Iterables.all(factor.getSiblings(), VariablePredicates.isUnboundedRealJoint()); }
From source file:com.synflow.cx.internal.scheduler.Schedule.java
/** * Returns <code>true</code> if the given list of objects is empty (or contains only Enter/Leave * objects)./*from w w w. ja v a 2s. co m*/ * * @param eObjects * a list of objects (like <code>transition.getBody()</code> or * <code>transition.getScheduler()</code>). * @return true if the list is assimilated to empty */ public static boolean isEmpty(List<EObject> eObjects) { // returns true if iterable is empty or it just contains Enter/Leave instances return Iterables.all(eObjects, new Predicate<EObject>() { @Override public boolean apply(EObject eObject) { return eObject instanceof Enter || eObject instanceof Leave; } }); }
From source file:de.cosmocode.commons.concurrent.ChainedRunnable.java
public ChainedRunnable(Iterable<Runnable> runnables) { this.runnables = Preconditions.checkNotNull(runnables, "Runnables"); Preconditions.checkArgument(Iterables.all(runnables, Predicates.notNull()), "Found null in %s", runnables); }
From source file:software.betamax.ComposedMatchRule.java
@Override public boolean isMatch(final Request a, final Request b) { return Iterables.all(rules, new Predicate<MatchRule>() { @Override/*ww w.ja v a2s.c o m*/ public boolean apply(MatchRule rule) { return rule.isMatch(a, b); } }); }
From source file:org.apache.abdera2.common.selector.AbstractSelector.java
public boolean all(Iterable<X> items) { if (items == null) return false; return Iterables.all(items, this); }
From source file:org.sosy_lab.cpachecker.cpa.alwaystop.AlwaysTopStopOperator.java
@Override public boolean stop(AbstractState pElement, Collection<AbstractState> pReached, Precision pPrecision) { assert pElement == AlwaysTopState.INSTANCE; assert pPrecision == AlwaysTopPrecision.INSTANCE; assert Iterables.all(pReached, Predicates.<AbstractState>equalTo(AlwaysTopState.INSTANCE)); return !pReached.isEmpty(); }
From source file:edu.washington.cs.cupid.mapview.internal.GraphNodeContentProvider.java
/** * Construct a graph content provider for <code>map</code>. * @param map the underlying map//from w ww . j a va2 s .c o m */ public GraphNodeContentProvider(final Map<?, ?> map) { this.map = map; this.mappedToSets = Iterables.all(map.values(), new Predicate<Object>() { @Override public boolean apply(final Object value) { return value instanceof Set; } }); }
From source file:org.sosy_lab.cpachecker.cpa.alwaystop.AlwaysTopPrecisionAdjustment.java
@Override public PrecisionAdjustmentResult prec(AbstractState pElement, Precision pPrecision, UnmodifiableReachedSet pElements, AbstractState fullState) { assert pElement == AlwaysTopState.INSTANCE; assert pPrecision == AlwaysTopPrecision.INSTANCE; assert Iterables.all(pElements, Predicates.<AbstractState>equalTo(AlwaysTopState.INSTANCE)); return PrecisionAdjustmentResult.create(AlwaysTopState.INSTANCE, AlwaysTopPrecision.INSTANCE, Action.CONTINUE);/*from ww w .j av a 2s . com*/ }
From source file:org.scassandra.cql.SetType.java
@Override public boolean equals(Object expected, Object actual) { if (expected == null) return actual == null; if (actual == null) return false; if (expected instanceof Set) { final Set<?> typedExpected = (Set<?>) expected; final List<?> actualList = (List<?>) actual; return typedExpected.size() == actualList.size() && Iterables.all(typedExpected, new Predicate<Object>() { @Override//from ww w. jav a 2 s . c om public boolean apply(final Object eachExpected) { return Iterables.any(actualList, new Predicate<Object>() { @Override public boolean apply(Object eachActual) { return type.equals(eachExpected, eachActual); } }); } }); } else { throw throwInvalidType(expected, actual, this); } }