Class Predicate<T>
- Type Parameters:
- T- type of object the predicate can evaluate in memory.
- Direct Known Subclasses:
- AndPredicate,- ApprovalPredicate,- IndexedQuery,- NotPredicate,- OperatorPredicate,- OrPredicate,- Predicate.Any
Implementations should be immutable, such that the meaning of a predicate never changes once constructed. They should ensure their immutable promise by defensively copying any structures which might be modified externally, but was passed into the object's constructor.
However, implementations may retain non-thread-safe caches internally, to speed up
 evaluation operations within the context of one thread's evaluation of the predicate. As a
 result, callers should assume predicates are not thread-safe, but that two predicate graphs
 produce the same results given the same inputs if they are equals(Object).
 
Predicates should support deep inspection whenever possible, so that generic algorithms can be
 written to operate against them. Predicates which contain other predicates should override getChildren() to return the list of children nested within the predicate.
- 
Nested Class SummaryNested Classes
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic <T> Predicate<T>Combine the passed predicates into a single AND node.static <T> Predicate<T>and(Collection<? extends Predicate<T>> that) Combine the passed predicates into a single AND node.static <T> Predicate<T>any()A predicate that matches any input, always, with no cost.copy(Collection<? extends Predicate<T>> children) Create a copy of this predicate, with new children.abstract booleanintReturns a cost estimate to run this predicate, higher figures cost more.getChild(int i) Same asgetChildren().get(i)intSame asgetChildren().size()Get the children of this predicate, if any.Returns a list of this predicate and all its descendants.intGet the number of leaf terms in this predicate.abstract inthashCode()booleanisLeaf()booleanstatic <T> Predicate<T>Invert the passed node.static <T> Predicate<T>Combine the passed predicates into a single OR node.static <T> Predicate<T>or(Collection<? extends Predicate<T>> that) Combine the passed predicates into a single OR node.booleanWhether this predicate can be used in search queries.
- 
Constructor Details- 
Predicatepublic Predicate()
 
- 
- 
Method Details- 
getPredicateString
- 
isLeafpublic boolean isLeaf()
- 
anyA predicate that matches any input, always, with no cost.
- 
andCombine the passed predicates into a single AND node.
- 
andCombine the passed predicates into a single AND node.
- 
orCombine the passed predicates into a single OR node.
- 
orCombine the passed predicates into a single OR node.
- 
notInvert the passed node.
- 
getChildrenGet the children of this predicate, if any.
- 
getChildCountpublic int getChildCount()Same asgetChildren().size()
- 
getChildSame asgetChildren().get(i)
- 
getLeafCountpublic int getLeafCount()Get the number of leaf terms in this predicate.
- 
getFlattenedPredicateListReturns a list of this predicate and all its descendants.
- 
copyCreate a copy of this predicate, with new children.
- 
isMatchablepublic boolean isMatchable()
- 
supportedForQueriespublic boolean supportedForQueries()Whether this predicate can be used in search queries.
- 
asMatchable
- 
estimateCostpublic int estimateCost()Returns a cost estimate to run this predicate, higher figures cost more.
- 
hashCodepublic abstract int hashCode()
- 
equals
 
-