Top Description Fields Constructors Methods
org.dom4j.rule

public Class RuleSet

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Collections, org.dom4j.Node

RuleSet manages a set of rules which are sorted in order of relevance according to the XSLT defined conflict resolution policy. This makes finding the correct rule for a DOM4J Node using the XSLT processing model efficient as the rules can be evaluated in order of priority.

Author
James Strachan
Version
$Revision: 1.10 $

Field Summary

Modifier and TypeField and Description
private Rule[]
ruleArray

A lazily evaluated and cached array of rules sorted

private ArrayList<Rule>
rules

An unordered list of Rule objects

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addAll(RuleSet
DOCUMENT ME!
that
)

Adds all the rules to this RuleSet from the given other rule set.

public void
addRule(Rule rule)

public Rule

Returns:

the matching Rule or no rule if none matched
getMatchingRule
(Node
is the DOM4J Node to match against
node
)

Performs an XSLT processing model match for the rule which matches the given Node the best.

protected Rule[]

Returns:

the rules as a sorted array in ascending precendence so that the rules at the end of the array should be used first
getRuleArray
()

Returns an array of sorted rules.

public void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

ruleArrayback to summary
private Rule[] ruleArray

A lazily evaluated and cached array of rules sorted

rulesback to summary
private ArrayList<Rule> rules

An unordered list of Rule objects

Constructor Detail

RuleSetback to summary
public RuleSet()

Method Detail

addAllback to summary
public void addAll(RuleSet that)

Adds all the rules to this RuleSet from the given other rule set.

Parameters
that:RuleSet

DOCUMENT ME!

addRuleback to summary
public void addRule(Rule rule)
getMatchingRuleback to summary
public Rule getMatchingRule(Node node)

Performs an XSLT processing model match for the rule which matches the given Node the best.

Parameters
node:Node

is the DOM4J Node to match against

Returns:Rule

the matching Rule or no rule if none matched

getRuleArrayback to summary
protected Rule[] getRuleArray()

Returns an array of sorted rules.

Returns:Rule[]

the rules as a sorted array in ascending precendence so that the rules at the end of the array should be used first

removeRuleback to summary
public void removeRule(Rule rule)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.