org.jaxen.pattern

Class LocationPathPattern


public class LocationPathPattern
extends Pattern

LocationPathPattern matches any node using a location path such as A/B/C. The parentPattern and ancestorPattern properties are used to chain location path patterns together
Version:
$Revision: 1.15 $
Author:
James Strachan

Field Summary

private boolean
absolute
Whether this lcoation path is absolute or not
private Pattern
ancestorPattern
Patterns matching one of my ancestors
private List
filters
The filters to match against
private NodeTest
nodeTest
The node test to perform on this step of the path
private Pattern
parentPattern
Patterns matching my parent node

Fields inherited from class org.jaxen.pattern.Pattern

ANY_NODE, ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_REFERENCE_NODE, MAX_NODE_TYPE, NAMESPACE_NODE, NO_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE, UNKNOWN_NODE

Constructor Summary

LocationPathPattern()
LocationPathPattern(NodeTest nodeTest)

Method Summary

void
addFilter(FilterExpr filter)
Adds a filter to this pattern
short
getMatchType()
Returns the type of node the pattern matches.
double
getPriority()
Returns the default resolution policy of the pattern according to the XSLT conflict resolution rules.
String
getText()
Returns a textual representation of this pattern
boolean
hasAnyNodeTest()
boolean
isAbsolute()
boolean
matches(Object node, Context context)
void
setAbsolute(boolean absolute)
void
setAncestorPattern(Pattern ancestorPattern)
Adds a pattern for an ancestor of the current context node used in this pattern.
void
setNodeTest(NodeTest nodeTest)
Allows the NodeTest to be set
void
setParentPattern(Pattern parentPattern)
Adds a pattern for the parent of the current context node used in this pattern.
Pattern
simplify()
String
toString()

Methods inherited from class org.jaxen.pattern.Pattern

getMatchType, getMatchesNodeName, getPriority, getText, getUnionPatterns, matches, simplify

Field Details

absolute

private boolean absolute
Whether this lcoation path is absolute or not

ancestorPattern

private Pattern ancestorPattern
Patterns matching one of my ancestors

filters

private List filters
The filters to match against

nodeTest

private NodeTest nodeTest
The node test to perform on this step of the path

parentPattern

private Pattern parentPattern
Patterns matching my parent node

Constructor Details

LocationPathPattern

public LocationPathPattern()

LocationPathPattern

public LocationPathPattern(NodeTest nodeTest)

Method Details

addFilter

public void addFilter(FilterExpr filter)
Adds a filter to this pattern

getMatchType

public short getMatchType()
Returns the type of node the pattern matches.
Overrides:
getMatchType in interface Pattern
Returns:
ANY_NODE unless overridden

getPriority

public double getPriority()
Overrides:
getPriority in interface Pattern
Returns:
0.5; the default priority defined in XSLT

getText

public String getText()
Returns a textual representation of this pattern
Overrides:
getText in interface Pattern
Returns:
the usual string form of this XSLT pattern

hasAnyNodeTest

public boolean hasAnyNodeTest()

isAbsolute

public boolean isAbsolute()

matches

public boolean matches(Object node,
                       Context context)
            throws JaxenException
Overrides:
matches in interface Pattern
Returns:
true if the pattern matches the given node

setAbsolute

public void setAbsolute(boolean absolute)

setAncestorPattern

public void setAncestorPattern(Pattern ancestorPattern)
Adds a pattern for an ancestor of the current context node used in this pattern.

setNodeTest

public void setNodeTest(NodeTest nodeTest)
            throws JaxenException
Allows the NodeTest to be set

setParentPattern

public void setParentPattern(Pattern parentPattern)
Adds a pattern for the parent of the current context node used in this pattern.

simplify

public Pattern simplify()
Overrides:
simplify in interface Pattern

toString

public String toString()