Top Description Fields Constructors Methods
org.dom4j.rule.pattern

public Class DefaultPattern

extends Object
implements Pattern
Class Inheritance
All Implemented Interfaces
org.dom4j.rule.Pattern, org.dom4j.NodeFilter
Imports
org.dom4j.Node, .NodeFilter, org.dom4j.rule.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, getMatchTypeand getMatchesNodeNameshould be overloaded to allow more rule filtering to occur.

Author
James Strachan
Version
$Revision: 1.6 $

Field Summary

Modifier and TypeField and Description
private NodeFilter

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
getMatchesNodeName()

Implements org.dom4j.rule.Pattern.getMatchesNodeName.

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.
public short
public double
getPriority()

Implements org.dom4j.rule.Pattern.getPriority.

Returns the default resolution policy of the pattern according to the XSLT conflict resolution spec .
public Pattern[]
getUnionPatterns()

Implements org.dom4j.rule.Pattern.getUnionPatterns.

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.
public boolean
matches(Node
DOCUMENT ME!
node
)

Implements org.dom4j.rule.Pattern.matches.

DOCUMENT ME!
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

filterback to summary
private NodeFilter filter

Constructor Detail

DefaultPatternback to summary
public DefaultPattern(NodeFilter filter)

Method Detail

getMatchesNodeNameback to summary
public String getMatchesNodeName()

Implements org.dom4j.rule.Pattern.getMatchesNodeName.

Doc from org.dom4j.rule.Pattern.getMatchesNodeName.

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.

Returns:String

the name of the element or attribute this pattern matches or null if this pattern matches any or more than one name.

getMatchTypeback to summary
public short getMatchType()

Implements org.dom4j.rule.Pattern.getMatchType.

Doc from org.dom4j.rule.Pattern.getMatchType.

DOCUMENT ME!

Returns:short

the type of node the pattern matches which by default should return ANY_NODE if it can match any kind of node.

getPriorityback to summary
public double getPriority()

Implements org.dom4j.rule.Pattern.getPriority.

Doc from org.dom4j.rule.Pattern.getPriority.

Returns the default resolution policy of the pattern according to the XSLT conflict resolution spec .

Returns:double

DOCUMENT ME!

getUnionPatternsback to summary
public Pattern[] getUnionPatterns()

Implements org.dom4j.rule.Pattern.getUnionPatterns.

Doc from org.dom4j.rule.Pattern.getUnionPatterns.

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.

Returns:Pattern[]

an array of the patterns which make up this union pattern or null if this pattern is not a union pattern

matchesback to summary
public boolean matches(Node node)

Implements org.dom4j.rule.Pattern.matches.

Doc from org.dom4j.rule.Pattern.matches.

DOCUMENT ME!

Parameters
node:Node

DOCUMENT ME!

Returns:boolean

true if the pattern matches the given DOM4J node.