List of usage examples for com.google.common.base Predicates or
public static <T> Predicate<T> or(Predicate<? super T> first, Predicate<? super T> second)
From source file:org.apache.aurora.common.args.ArgFilters.java
/** * Creates a filter that selects all {@literal @CmdLine} {@link Arg}s found in classes that are * members of the given package or its sub-packages. * * @param pkg The ancestor package of classes whose command line args will be selected. * @return A filter that selects only command line args declared in classes that are members of * the given {@code pkg} or its sub-packages. *///from w w w . ja v a2 s . co m public static Predicate<Field> selectAllPackagesUnderHere(final Package pkg) { Preconditions.checkNotNull(pkg); final String prefix = pkg.getName() + '.'; return Predicates.or(selectPackage(pkg), field -> { return field.getDeclaringClass().getPackage().getName().startsWith(prefix); }); }
From source file:org.mustbe.consulo.roots.ContentFolderScopes.java
@NotNull public static Predicate<ContentFolderTypeProvider> test() { return cacheScope(TEST, new NotNullFactory<Predicate<ContentFolderTypeProvider>>() { @NotNull//from w ww .j av a 2 s . c o m @Override public Predicate<ContentFolderTypeProvider> create() { return Predicates.or( Predicates.<ContentFolderTypeProvider>equalTo(TestContentFolderTypeProvider.getInstance()), Predicates.<ContentFolderTypeProvider>equalTo( TestResourceContentFolderTypeProvider.getInstance())); } }); }
From source file:org.eclipse.mylyn.internal.wikitext.commonmark.blocks.IndentedCodeBlock.java
@Override public void process(ProcessingContext context, DocumentBuilder builder, LineSequence lineSequence) { builder.setLocator(lineSequence.getCurrentLine().toLocator()); builder.beginBlock(BlockType.CODE, new Attributes()); boolean blockHasContent = false; Iterator<Line> iterator = lineSequence .with(Predicates.or(LinePredicates.matches(linePattern), LinePredicates.empty())).iterator(); while (iterator.hasNext()) { Line line = iterator.next(); Matcher matcher = linePattern.matcher(line.getText()); if (!matcher.matches()) { checkState(line.isEmpty());/*from w w w . j a va 2 s . c o m*/ if (iterator.hasNext()) { builder.characters("\n"); } } else { String content = matcher.group(2); if (!content.isEmpty() || (blockHasContent && iterator.hasNext())) { blockHasContent = true; builder.characters(content); builder.characters("\n"); } } } builder.endBlock(); }
From source file:org.artifactory.schedule.TaskTypePredicate.java
public void addSubPredicate(Predicate<Task> subPredicate) { if (this.subPredicate == null) { this.subPredicate = subPredicate; } else {//from w w w. ja v a 2s.com this.subPredicate = Predicates.or(this.subPredicate, subPredicate); } }
From source file:zotmc.collect.FluentPredicate.java
public FluentPredicate<T> or(Predicate<? super T> other) { return from(Predicates.or(unwrap(), other)); }
From source file:org.deephacks.tools4j.support.test.Criteria.java
@SuppressWarnings("unchecked") public Criteria or(Predicate predicate) { if (!Criteria.class.isInstance(predicate)) { predicate = new PredicateProxy(fieldName, predicate); }//from w w w . j ava2 s .c o m p = Predicates.or(p, predicate); return this; }
From source file:org.eclipse.sirius.diagram.sequence.business.internal.elements.AbstractFrame.java
/** * Returns a predicate to check whether a GMF View represents a frame. * /*from w w w.j a v a2 s .c o m*/ * @return a predicate to check whether a GMF View represents a frame. */ public static Predicate<View> notationPredicate() { return Predicates.or(InteractionUse.notationPredicate(), CombinedFragment.notationPredicate()); }
From source file:com.twitter.common.args.ArgFilters.java
/** * Creates a filter that selects all {@literal @CmdLine} {@link Arg}s found in classes that are * members of the given package or its sub-packages. * * @param pkg The ancestor package of classes whose command line args will be selected. * @return A filter that selects only command line args declared in classes that are members of * the given {@code pkg} or its sub-packages. *//*from w w w.j ava 2 s . co m*/ public static Predicate<Field> selectAllPackagesUnderHere(final Package pkg) { Preconditions.checkNotNull(pkg); final String prefix = pkg.getName() + '.'; return Predicates.or(selectPackage(pkg), new Predicate<Field>() { @Override public boolean apply(Field field) { return field.getDeclaringClass().getPackage().getName().startsWith(prefix); } }); }
From source file:uk.ac.open.kmi.iserve.discovery.util.MatchResultPredicates.java
/** * Generates a Predicate that only accepts the Match Results that have a Match Type greater or equal to matchType * * @param matchType the matchType that defines the boundary * @param <T> a subclass of MatchResult * @param <S> a subclass of MatchType * @return the Predicate/*w w w . j a v a 2 s. com*/ */ public static <T extends MatchResult, S extends MatchType> Predicate<T> greaterOrEqualTo(S matchType) { return Predicates.or(greaterThan(matchType), equalTo(matchType)); }
From source file:gov.nasa.jpf.constraints.util.ExpressionRestrictionVisitor.java
@Override public Expression<?> visit(QuantifierExpression q, Predicate<? super Variable<?>> data) { Predicate<Variable<?>> newPred = Predicates.or(Predicates.in(q.getBoundVariables()), data); Expression<?> exp = visit(q.getBody(), newPred); return (exp != null) ? q.duplicate(new Expression[] { exp }) : null; }