List of usage examples for com.google.common.base Predicates equalTo
public static <T> Predicate<T> equalTo(@Nullable T target)
From source file:org.polarsys.reqcycle.traceability.utils.LazyMap.java
public LazyMap(Iterator<Pair<Link, Reachable>> resultOfEngine) { this.resultOfEngine = resultOfEngine; if (resultOfEngine.hasNext()) { next = resultOfEngine.next();//from ww w . j av a2 s. c o m Reachable first = getSource(next); Predicate<Reachable> equalTo = Predicates.equalTo(first); addIf(equalTo, Predicates.not(equalTo)); } }
From source file:net.automatalib.util.graphs.ShortestPaths.java
public static <N, E> Iterable<Path<N, E>> shortestPaths(IndefiniteGraph<N, E> graph, N start, int limit, N target) {/*from w w w . j a va 2s . c o m*/ return shortestPaths(graph, start, limit, Predicates.equalTo(target)); }
From source file:tile80.world80.World80HOF.java
@Override public Tile80 getTileByPos(Pair pos) { return FluentIterable.from(world).filter(Predicates.compose(Predicates.equalTo(pos), onlyCoord)).first() .or(Tile80.nothing); }
From source file:com.facebook.buck.android.ProguardTranslatorFactory.java
private static Optional<Map<String, String>> loadOptionalRawMap(ExecutionContext context, Optional<Path> proguardFullConfigFile, Optional<Path> proguardMappingFile) throws IOException { if (!proguardFullConfigFile.isPresent()) { return Optional.absent(); }/* w w w.j a v a 2 s .co m*/ ProjectFilesystem projectFilesystem = context.getProjectFilesystem(); Path pathToProguardConfig = proguardFullConfigFile.get(); // Proguard doesn't print a mapping when obfuscation is disabled. boolean obfuscationSkipped = Iterables.any(projectFilesystem.readLines(pathToProguardConfig), Predicates.equalTo("-dontobfuscate")); if (obfuscationSkipped) { return Optional.absent(); } List<String> lines = projectFilesystem.readLines(proguardMappingFile.get()); return Optional.of(ProguardMapping.readClassMapping(lines)); }
From source file:com.facebook.presto.sql.planner.plan.MaterializeSampleNode.java
@Override public List<Symbol> getOutputSymbols() { return FluentIterable.from(source.getOutputSymbols()) .filter(Predicates.not(Predicates.equalTo(sampleWeightSymbol))).toList(); }
From source file:net.seedboxer.core.logic.ContentManager.java
public void updateContents(User user, List<Content> toUpdate) { List<Content> userContents = contentDao.getAllContents(user); for (Content content : toUpdate) { Optional<Content> find = Iterables.tryFind(userContents, Predicates.equalTo(content)); if (!find.isPresent()) { content.setUser(user);//from w w w. ja v a 2s.c o m contentDao.save(content); LOGGER.debug("New content {} for user {}", content.getName(), user.getId()); } } }
From source file:org.sonar.erlang.checks.DoNotUseEmptyFlowControlCheck.java
@Override public void init() { subscribeTo(ImmutableList/*from w w w .ja va 2s . co m*/ .copyOf(Collections2.filter(flowControls, Predicates.not(Predicates.equalTo(ErlangGrammarImpl.endifAttr)))) .toArray(new ErlangGrammarImpl[flowControls.size() - 1])); }
From source file:com.github.maelstrom.consumer.InfiniteRetryStrategy.java
public InfiniteRetryStrategy() { this.retryer = init(RetryerBuilder.<V>newBuilder().retryIfResult(Predicates.equalTo((V) null)) .retryIfException().withWaitStrategy(WaitStrategies.fibonacciWait(100, 2, TimeUnit.MINUTES)) .withStopStrategy(StopStrategies.neverStop())); }
From source file:brooklyn.entity.basic.EntityTasks.java
/** as {@link #testingAttributeEventually(Entity, AttributeSensor, Predicate, Duration) for multiple entities */ public static <T> Task<Boolean> testingAttributeEventually(Iterable<Entity> entities, AttributeSensor<T> sensor, Predicate<T> condition, Duration timeout) { return DependentConfiguration.builder().attributeWhenReadyFromMultiple(entities, sensor, condition) .postProcess(Functions.constant(true)).timeout(timeout).onTimeoutReturn(false) .onUnmanagedReturn(false)/*from w w w . j a va 2 s.c om*/ .postProcessFromMultiple(CollectionFunctionals.all(Predicates.equalTo(true))).build(); }
From source file:org.sosy_lab.solver.princess.PrincessFunctionFormulaManager.java
@Override protected IFunction declareUninterpretedFunctionImpl(String pName, TermType pReturnType, List<TermType> args) { checkArgument(pReturnType == TermType.Integer || pReturnType == TermType.Boolean, "Princess does not support return types of UFs other than Integer"); checkArgument(from(args).allMatch(Predicates.equalTo(TermType.Integer)), "Princess does not support argument types of UFs other than Integer"); return getFormulaCreator().getEnv().declareFun(pName, args.size(), pReturnType); }