org.dom4j.rule

Class Rule

public class Rule extends Object implements Comparable

Rule matches against DOM4J Node so that some action can be performed such as in the XSLT processing model.

Version: $Revision: 1.7 $

Author: James Strachan

Constructor Summary
Rule()
Rule(Pattern pattern)
Rule(Pattern pattern, Action action)
Rule(Rule that, Pattern pattern)
Constructs a new Rule with the same instance data as the given rule but a different pattern.
Method Summary
intcompareTo(Object that)
intcompareTo(Rule that)
Compares two rules in XSLT processing model order assuming that the modes are equal.
booleanequals(Object that)
ActiongetAction()
Getter for property action.
intgetAppearenceCount()
Getter for property appearenceCount.
intgetImportPrecedence()
Getter for property importPrecedence.
StringgetMatchesNodeName()
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.
shortgetMatchType()
DOCUMENT ME!
StringgetMode()
Getter for property mode.
PatterngetPattern()
Getter for property pattern.
doublegetPriority()
Getter for property priority.
Rule[]getUnionRules()
If this rule contains a union pattern then this method should return an array of Rules which describe the union rule, which should contain more than one rule.
inthashCode()
booleanmatches(Node node)
DOCUMENT ME!
voidsetAction(Action action)
Setter for property action.
voidsetAppearenceCount(int appearenceCount)
Setter for property appearenceCount.
voidsetImportPrecedence(int importPrecedence)
Setter for property importPrecedence.
voidsetMode(String mode)
Setter for property mode.
voidsetPattern(Pattern pattern)
Setter for property pattern.
voidsetPriority(double priority)
Setter for property priority.
StringtoString()

Constructor Detail

Rule

public Rule()

Rule

public Rule(Pattern pattern)

Rule

public Rule(Pattern pattern, Action action)

Rule

public Rule(Rule that, Pattern pattern)
Constructs a new Rule with the same instance data as the given rule but a different pattern.

Parameters: that DOCUMENT ME! pattern DOCUMENT ME!

Method Detail

compareTo

public int compareTo(Object that)

compareTo

public int compareTo(Rule that)
Compares two rules in XSLT processing model order assuming that the modes are equal.

Parameters: that DOCUMENT ME!

Returns: DOCUMENT ME!

equals

public boolean equals(Object that)

getAction

public Action getAction()
Getter for property action.

Returns: Value of property action.

getAppearenceCount

public int getAppearenceCount()
Getter for property appearenceCount.

Returns: Value of property appearenceCount.

getImportPrecedence

public int getImportPrecedence()
Getter for property importPrecedence.

Returns: Value of property importPrecedence.

getMatchesNodeName

public final String 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: the name of the element or attribute this pattern matches or null if this pattern matches any or more than one name.

getMatchType

public final short getMatchType()
DOCUMENT ME!

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

getMode

public String getMode()
Getter for property mode.

Returns: Value of property mode.

getPattern

public Pattern getPattern()
Getter for property pattern.

Returns: Value of property pattern.

getPriority

public double getPriority()
Getter for property priority.

Returns: Value of property priority.

getUnionRules

public Rule[] getUnionRules()
If this rule contains a union pattern then this method should return an array of Rules which describe the union rule, which should contain more than one rule. Otherwise this method should return null.

Returns: an array of the rules which make up this union rule or null if this rule is not a union rule

hashCode

public int hashCode()

matches

public final boolean matches(Node node)
DOCUMENT ME!

Parameters: node DOCUMENT ME!

Returns: true if the pattern matches the given DOM4J node.

setAction

public void setAction(Action action)
Setter for property action.

Parameters: action New value of property action.

setAppearenceCount

public void setAppearenceCount(int appearenceCount)
Setter for property appearenceCount.

Parameters: appearenceCount New value of property appearenceCount.

setImportPrecedence

public void setImportPrecedence(int importPrecedence)
Setter for property importPrecedence.

Parameters: importPrecedence New value of property importPrecedence.

setMode

public void setMode(String mode)
Setter for property mode.

Parameters: mode New value of property mode.

setPattern

public void setPattern(Pattern pattern)
Setter for property pattern.

Parameters: pattern New value of property pattern.

setPriority

public void setPriority(double priority)
Setter for property priority.

Parameters: priority New value of property priority.

toString

public String toString()
Copyright B) 2005 MetaStuff Ltd. All Rights Reserved. Hosted by

SourceForge