Package org.dom4j.rule.pattern
Class DefaultPattern
java.lang.Object
org.dom4j.rule.pattern.DefaultPattern
- All Implemented Interfaces:
NodeFilter
,Pattern
DefaultPattern
a default implementation of Pattern which can
take any XPath implementation or NodeFilter for defining the pattern.
WARNING this implementation causes a worst case, brute force XSLT
rule evaluation to be performed. Wherever possible the methods getPriority()
, getMatchType()
and getMatchesNodeName()
should
be overloaded to allow more rule filtering to occur.
- Version:
- $Revision: 1.6 $
-
Field Summary
FieldsFields inherited from interface org.dom4j.rule.Pattern
ANY_NODE, DEFAULT_PRIORITY, NONE, NUMBER_OF_TYPES
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionFor patterns which only match an ATTRIBUTE_NODE or an ELEMENT_NODE then this pattern may return the name of the element or attribute it matches.short
DOCUMENT ME!double
Returns the default resolution policy of the pattern according to the XSLT conflict resolution spec .Pattern[]
If this pattern is a union pattern then this method should return an array of patterns which describe the union pattern, which should contain more than one pattern.boolean
DOCUMENT ME!
-
Field Details
-
filter
-
-
Constructor Details
-
DefaultPattern
-
-
Method Details
-
matches
Description copied from interface:Pattern
DOCUMENT ME!- Specified by:
matches
in interfaceNodeFilter
- Specified by:
matches
in interfacePattern
- Parameters:
node
- DOCUMENT ME!- Returns:
- true if the pattern matches the given DOM4J node.
-
getPriority
public double getPriority()Description copied from interface:Pattern
Returns the default resolution policy of the pattern according to the XSLT conflict resolution spec .- Specified by:
getPriority
in interfacePattern
- Returns:
- DOCUMENT ME!
-
getUnionPatterns
Description copied from interface:Pattern
If this pattern is a union pattern then this method should return an array of patterns which describe the union pattern, which should contain more than one pattern. Otherwise this method should return null.- Specified by:
getUnionPatterns
in interfacePattern
- Returns:
- an array of the patterns which make up this union pattern or null if this pattern is not a union pattern
-
getMatchType
public short getMatchType()Description copied from interface:Pattern
DOCUMENT ME!- Specified by:
getMatchType
in interfacePattern
- Returns:
- the type of node the pattern matches which by default should return ANY_NODE if it can match any kind of node.
-
getMatchesNodeName
Description copied from interface:Pattern
For patterns which only match an ATTRIBUTE_NODE or an ELEMENT_NODE then this pattern may return the name of the element or attribute it matches. This allows a more efficient rule matching algorithm to be performed, rather than a brute force approach of evaluating every pattern for a given Node.- Specified by:
getMatchesNodeName
in interfacePattern
- Returns:
- the name of the element or attribute this pattern matches or null if this pattern matches any or more than one name.
-