public class PredicateSet
extends java.lang.Object
implements java.io.Serializable
Represents the collection of predicates that follow the node-test in a location path.
There is no rule that the same predicate may not appear twice in an XPath expression, nor does this class enforce any such rule. This is implemented more as a list than a set. However, adding the swme predicate twice should have no effect on the final result other than slowing it down.
Modifier and Type | Field and Description |
---|---|
private java.util.List |
predicates |
private static long |
serialVersionUID |
Constructor and Description |
---|
PredicateSet()
Create a new empty predicate set.
|
Modifier and Type | Method and Description |
---|---|
void |
addPredicate(Predicate predicate)
Add a predicate to the set.
|
private boolean |
anyMatchingNode(java.util.List contextNodeSet,
ContextSupport support) |
java.util.List |
applyPredicate(Predicate predicate,
java.util.List nodes2Filter,
ContextSupport support) |
protected boolean |
evaluateAsBoolean(java.util.List contextNodeSet,
ContextSupport support)
Returns true if any of the supplied nodes satisfy
all the predicates in the set.
|
protected java.util.List |
evaluatePredicates(java.util.List contextNodeSet,
ContextSupport support)
Returns all of the supplied nodes that satisfy
all the predicates in the set.
|
java.util.List |
getPredicates()
Returns the list containing the predicates.
|
java.lang.String |
getText()
Returns the XPath string containing each of the predicates.
|
void |
simplify()
Simplify each of the predicates in the list.
|
private static final long serialVersionUID
private java.util.List predicates
public void addPredicate(Predicate predicate)
predicate
- the predicate to be insertedpublic java.util.List getPredicates()
public void simplify()
public java.lang.String getText()
protected boolean evaluateAsBoolean(java.util.List contextNodeSet, ContextSupport support) throws JaxenException
Returns true if any of the supplied nodes satisfy all the predicates in the set. Returns false if none of the supplied nodes matches all the predicates in the set. Returns false if the node-set is empty.
contextNodeSet
- the nodes to test against these predicatessupport
- ????JaxenException
private boolean anyMatchingNode(java.util.List contextNodeSet, ContextSupport support) throws JaxenException
JaxenException
protected java.util.List evaluatePredicates(java.util.List contextNodeSet, ContextSupport support) throws JaxenException
Returns all of the supplied nodes that satisfy all the predicates in the set.
contextNodeSet
- the nodes to test against these predicatessupport
- ????JaxenException
public java.util.List applyPredicate(Predicate predicate, java.util.List nodes2Filter, ContextSupport support) throws JaxenException
JaxenException