Package org.dom4j.rule
Class Rule
java.lang.Object
org.dom4j.rule.Rule
- All Implemented Interfaces:
Comparable<Rule>
Rule
matches against DOM4J Node so that some action can be
performed such as in the XSLT processing model.
- Version:
- $Revision: 1.7 $
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Action
Holds value of property action.private int
Holds value of property appearenceCount.private int
Holds value of property importPrecedence.private String
Holds value of property mode.private Pattern
Holds value of property pattern.private double
Holds value of property priority. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static int
compareInt
(int value1, int value2) int
Compares two rules in XSLT processing model order assuming that the modes are equal.boolean
Getter for property action.int
Getter for property appearenceCount.int
Getter for property importPrecedence.final String
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.final short
DOCUMENT ME!getMode()
Getter for property mode.Getter for property pattern.double
Getter for property priority.Rule[]
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.int
hashCode()
final boolean
DOCUMENT ME!void
Setter for property action.void
setAppearenceCount
(int appearenceCount) Setter for property appearenceCount.void
setImportPrecedence
(int importPrecedence) Setter for property importPrecedence.void
Setter for property mode.void
setPattern
(Pattern pattern) Setter for property pattern.void
setPriority
(double priority) Setter for property priority.toString()
-
Field Details
-
mode
Holds value of property mode. -
importPrecedence
private int importPrecedenceHolds value of property importPrecedence. -
priority
private double priorityHolds value of property priority. -
appearenceCount
private int appearenceCountHolds value of property appearenceCount. -
pattern
Holds value of property pattern. -
action
Holds value of property action.
-
-
Constructor Details
-
Rule
public Rule() -
Rule
-
Rule
-
Rule
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 Details
-
equals
-
hashCode
public int hashCode() -
compareTo
Compares two rules in XSLT processing model order assuming that the modes are equal.- Specified by:
compareTo
in interfaceComparable<Rule>
- Parameters:
that
- DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
toString
-
matches
DOCUMENT ME!- Parameters:
node
- DOCUMENT ME!- Returns:
- true if the pattern matches the given DOM4J node.
-
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
-
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.
-
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.
-
getMode
Getter for property mode.- Returns:
- Value of property mode.
-
setMode
Setter for property mode.- Parameters:
mode
- New value of property mode.
-
getImportPrecedence
public int getImportPrecedence()Getter for property importPrecedence.- Returns:
- Value of property importPrecedence.
-
setImportPrecedence
public void setImportPrecedence(int importPrecedence) Setter for property importPrecedence.- Parameters:
importPrecedence
- New value of property importPrecedence.
-
getPriority
public double getPriority()Getter for property priority.- Returns:
- Value of property priority.
-
setPriority
public void setPriority(double priority) Setter for property priority.- Parameters:
priority
- New value of property priority.
-
getAppearenceCount
public int getAppearenceCount()Getter for property appearenceCount.- Returns:
- Value of property appearenceCount.
-
setAppearenceCount
public void setAppearenceCount(int appearenceCount) Setter for property appearenceCount.- Parameters:
appearenceCount
- New value of property appearenceCount.
-
getPattern
Getter for property pattern.- Returns:
- Value of property pattern.
-
setPattern
Setter for property pattern.- Parameters:
pattern
- New value of property pattern.
-
getAction
Getter for property action.- Returns:
- Value of property action.
-
setAction
Setter for property action.- Parameters:
action
- New value of property action.
-
compareInt
private static int compareInt(int value1, int value2)
-