List of usage examples for com.google.common.base Predicates alwaysTrue
@GwtCompatible(serializable = true) public static <T> Predicate<T> alwaysTrue()
From source file:net.shibboleth.idp.authn.SubjectCanonicalizationFlowDescriptor.java
/** Constructor. */ public SubjectCanonicalizationFlowDescriptor() { activationCondition = Predicates.alwaysTrue(); }
From source file:com.eucalyptus.simpleworkflow.persist.PersistenceWorkflowExecutions.java
public <T> List<T> listTimedOut(final long time, final Function<? super WorkflowExecution, T> transform) throws SwfMetadataException { return listByExample(WorkflowExecution.exampleForOpenWorkflow(), Predicates.alwaysTrue(), Restrictions.disjunction().add(Restrictions.lt("timeoutTimestamp", new Date(time))) .add(Restrictions.lt("creationTimestamp", new Date(time - getWorkflowExecutionDurationMillis()))), Collections.<String, String>emptyMap(), transform); }
From source file:net.automatalib.util.ts.copy.TSCopy.java
/** * Copies an {@link TransitionSystem} to a {@link MutableAutomaton} with possibly heterogeneous input alphabets and * state and transition properties.//from ww w . j a v a 2 s . c o m * * @param method the traversal method to use * @param in the input transition system * @param limit the traversal limit, a value less than 0 means no limit * @param inputs the inputs to consider * @param out the output automaton * @param inputsMapping the transformation for input symbols * @param spMapping the function for obtaining state properties * @param tpMapping the function for obtaining transition properties * @param stateFilter the filter predicate for states * @param transFilter the filter predicate for transitions * @return a mapping from old to new states */ public static <S1, I1, T1, S2, I2, T2, SP2, TP2> Mapping<S1, S2> rawCopy(TSTraversalMethod method, TransitionSystem<S1, ? super I1, T1> in, int limit, Collection<? extends I1> inputs, MutableAutomaton<S2, I2, T2, ? super SP2, ? super TP2> out, Function<? super I1, ? extends I2> inputsMapping, Function<? super S1, ? extends SP2> spMapping, Function<? super T1, ? extends TP2> tpMapping, Predicate<? super S1> stateFilter, TransitionPredicate<? super S1, ? super I1, ? super T1> transFilter) { if (spMapping == null) { spMapping = Functions.constant(null); } if (tpMapping == null) { tpMapping = Functions.constant(null); } if (stateFilter == null) { stateFilter = Predicates.alwaysTrue(); } if (transFilter == null) { transFilter = TransitionPredicates.alwaysTrue(); } TSCopyVisitor<S1, I1, T1, S2, I2, T2, SP2, TP2> vis = new TSCopyVisitor<>(in, out, inputsMapping, spMapping, tpMapping, stateFilter, transFilter); method.traverse(in, limit, inputs, vis); return vis.getStateMapping(); }
From source file:com.eucalyptus.compute.vpc.persist.PersistenceSecurityGroups.java
@Override public <T> T lookupDefault(final String vpcId, final Function<? super NetworkGroup, T> transform) throws VpcMetadataException { try {//from w ww .j a v a2 s . c o m return Iterables.getOnlyElement( listByExample(NetworkGroup.namedForVpc(vpcId, NetworkGroups.defaultNetworkName()), Predicates.alwaysTrue(), transform)); } catch (NoSuchElementException e) { throw new VpcMetadataNotFoundException("Default security group not found for " + vpcId); } }
From source file:com.eucalyptus.compute.vpc.persist.PersistenceInternetGateways.java
@Override public <T> T lookupByVpc(@Nullable final OwnerFullName ownerFullName, final String vpcId, final Function<? super InternetGateway, T> transform) throws VpcMetadataException { try {/* w w w . jav a 2 s . c om*/ return Iterables.getOnlyElement(listByExample(InternetGateway.exampleWithOwner(ownerFullName), Predicates.alwaysTrue(), Restrictions.eq("vpc.displayName", vpcId), Collections.singletonMap("vpc", "vpc"), transform)); } catch (NoSuchElementException e) { throw new VpcMetadataNotFoundException("Internet gateway not found for " + vpcId); } }
From source file:io.crate.analyze.copy.NodeFilters.java
NodeFilters(@Nullable String name, @Nullable String id) { if (name == null && id == null) { innerPredicate = Predicates.alwaysTrue(); } else {//from w w w . j a va 2 s. c o m Predicate<DiscoveryNode> namesPredicate = name == null ? Predicates.<DiscoveryNode>alwaysTrue() : new NamesPredicate(name); Predicate<DiscoveryNode> idsPredicate = id == null ? Predicates.<DiscoveryNode>alwaysTrue() : new IdsPredicate(id); innerPredicate = Predicates.and(namesPredicate, idsPredicate); } }
From source file:org.jenkinsci.plugins.fabric8.rest.WorkflowJobAction.java
public Object doStages() { Predicate<WorkflowRun> predicate = Predicates.alwaysTrue(); List<WorkflowRun> runs = filterRuns(predicate); return filterStages(runs); }
From source file:com.eucalyptus.tags.Filter.java
private Filter() { this(Predicates.alwaysTrue(), false); }
From source file:org.eclipse.emf.compare.tests.framework.EMFCompareTestBase.java
/** * This can be used to check whether all objects of the given list have a corresponding {@link Match} in * the given {@link Comparison}. If one of said EObjects is not matched, we will check whether it is * included in the given <code>scope</code> if it is a {@link FilterComparisonScope}. * // w ww. j a v a 2 s . c o m * @param eObjects * The list of EObjects for which we need corresponding {@link Match}es. * @param comparison * The {@link Comparison} in which we are to check for Matches. * @param scope * The scope that has been used to create the given <code>comparison</code>. */ protected void assertAllMatched(List<EObject> eObjects, Comparison comparison, IComparisonScope scope) { final Predicate<? super EObject> scopeFilter; if (scope instanceof FilterComparisonScope) { scopeFilter = getResourceChildrenFilteringPredicate((FilterComparisonScope) scope); } else { scopeFilter = Predicates.alwaysTrue(); } final Iterator<EObject> eObjectIterator = eObjects.iterator(); while (eObjectIterator.hasNext()) { final EObject eObject = eObjectIterator.next(); final Match match = comparison.getMatch(eObject); assertTrue(match != null || !scopeFilter.apply(eObject)); } }
From source file:fr.xebia.cocktail.CocktailRepository.java
public Collection<Cocktail> find(@Nullable final String ingredient, @Nullable final String name) { Predicate<Cocktail> ingredientPredicate; if (Strings.isNullOrEmpty(ingredient)) { ingredientPredicate = Predicates.alwaysTrue(); } else {/*from ww w . j av a 2 s. com*/ ingredientPredicate = new Predicate<Cocktail>() { @Override public boolean apply(@Nullable Cocktail cocktail) { for (String cocktailIngredient : cocktail.getIngredientNames()) { if (StringUtils.containsIgnoreCase(cocktailIngredient, ingredient)) { return true; } } return false; } }; } Predicate<Cocktail> namePredicate; if (Strings.isNullOrEmpty(name)) { namePredicate = Predicates.alwaysTrue(); } else { namePredicate = new Predicate<Cocktail>() { @Override public boolean apply(@Nullable Cocktail cocktail) { return StringUtils.containsIgnoreCase(cocktail.getName(), name); } }; } return Lists.newArrayList(Collections2.filter(cocktails.asMap().values(), Predicates.and(namePredicate, ingredientPredicate))); }