Package com.icl.saxon.pattern
Class LocationPathPattern
- java.lang.Object
-
- com.icl.saxon.pattern.Pattern
-
- com.icl.saxon.pattern.LocationPathPattern
-
public final class LocationPathPattern extends Pattern
A LocationPathPattern represents a path, e.g. of the form A/B/C... The components are represented as a linked list, each component pointing to its predecessor
-
-
Field Summary
Fields Modifier and Type Field Description PatternancestorPatternprotected ExpressionequivalentExprprotected Expression[]filtersprotected booleanfirstElementPatternprotected booleanlastElementPatternNodeTestnodeTestprotected intnumberOfFiltersPatternparentPatternprotected booleanspecialFilter-
Fields inherited from class com.icl.saxon.pattern.Pattern
originalText, staticContext
-
-
Constructor Summary
Constructors Constructor Description LocationPathPattern()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFilter(Expression filter)Add a filter to the pattern (while under construction)intgetFingerprint()Determine the fingerprint of nodes to which this pattern applies.shortgetNodeType()Determine the types of nodes to which this pattern applies.booleanisRelative()Determine if the pattern uses positional filtersbooleanmatches(NodeInfo node, Context context)Determine whether this Pattern matches the given NodebooleanmatchesX(NodeInfo node, Context context)Determine whether the pattern matches a given node.Patternsimplify()Simplify the pattern: perform any context-independent optimisations-
Methods inherited from class com.icl.saxon.pattern.Pattern
getDefaultPriority, getLineNumber, getStaticContext, getSystemId, make, setOriginalText, setStaticContext, toString
-
-
-
-
Field Detail
-
parentPattern
public Pattern parentPattern
-
ancestorPattern
public Pattern ancestorPattern
-
nodeTest
public NodeTest nodeTest
-
filters
protected Expression[] filters
-
numberOfFilters
protected int numberOfFilters
-
equivalentExpr
protected Expression equivalentExpr
-
firstElementPattern
protected boolean firstElementPattern
-
lastElementPattern
protected boolean lastElementPattern
-
specialFilter
protected boolean specialFilter
-
-
Method Detail
-
addFilter
public void addFilter(Expression filter)
Add a filter to the pattern (while under construction)- Parameters:
filter- The predicate (a boolean expression or numeric expression) to be added
-
simplify
public Pattern simplify() throws XPathException
Simplify the pattern: perform any context-independent optimisations- Overrides:
simplifyin classPattern- Returns:
- the optimised Pattern
- Throws:
XPathException
-
matchesX
public boolean matchesX(NodeInfo node, Context context) throws XPathException
Determine whether the pattern matches a given node.- Parameters:
node- the node to be tested- Returns:
- true if the pattern matches, else false
- Throws:
XPathException
-
matches
public boolean matches(NodeInfo node, Context context) throws XPathException
Description copied from class:PatternDetermine whether this Pattern matches the given Node- Specified by:
matchesin classPattern- Parameters:
node- The NodeInfo representing the Element or other node to be tested against the Patterncontext- The context in which the match is to take place. Only relevant if the pattern uses variables.- Returns:
- true if the node matches the Pattern, false otherwise
- Throws:
XPathException
-
getNodeType
public short getNodeType()
Determine the types of nodes to which this pattern applies. Used for optimisation. For patterns that match nodes of several types, return Node.NODE- Overrides:
getNodeTypein classPattern- Returns:
- the type of node matched by this pattern. e.g. Node.ELEMENT or Node.TEXT
-
getFingerprint
public int getFingerprint()
Determine the fingerprint of nodes to which this pattern applies. Used for optimisation.- Overrides:
getFingerprintin classPattern- Returns:
- the fingerprint of nodes matched by this pattern.
-
isRelative
public boolean isRelative() throws XPathExceptionDetermine if the pattern uses positional filters- Returns:
- true if there is a numeric filter in the pattern, or one that uses the position() or last() functions
- Throws:
XPathException
-
-