Top Description Fields Constructors Methods
org.dom4j.rule

public Class Mode

extends Object
Class Inheritance
Imports
java.util.HashMap, .Map, org.dom4j.Attribute, .Document, .Element, .Node

Mode manages a number of RuleSet instances for the mode in a stylesheet. It is responsible for finding the correct rule for a given DOM4J Node using the XSLT processing model uses the smallest possible RuleSet to reduce the number of Rule evaluations.

Author
James Strachan
Version
$Revision: 1.9 $

Field Summary

Modifier and TypeField and Description
private Map<String, RuleSet>
attributeNameRuleSets

Map of exact (local) attribute names to RuleSet instances

private Map<String, RuleSet>
elementNameRuleSets

Map of exact (local) element names to RuleSet instances

private RuleSet[]

Constructor Summary

AccessConstructor and Description
public
Mode()

Method Summary

Modifier and TypeMethod and Description
public void
addRule(Rule rule)

protected Map<String, RuleSet>

Returns:

the Map (which will be created if the given map was null
addToNameMap
(Map<String, RuleSet>
DOCUMENT ME!
map
,
String
DOCUMENT ME!
name
,
Rule
DOCUMENT ME!
rule
)

Adds the Rule to a RuleSet for the given name.

public void
public void
public void
fireRule(Node
DOCUMENT ME!
node
)

Runs the actions associated with the given node

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 RuleSet

Returns:

the RuleSet for the given matching type. This method will never return null, a new instance will be created.
getRuleSet
(int
DOCUMENT ME!
matchType
)

DOCUMENT ME!

protected void
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attributeNameRuleSetsback to summary
private Map<String, RuleSet> attributeNameRuleSets

Map of exact (local) attribute names to RuleSet instances

elementNameRuleSetsback to summary
private Map<String, RuleSet> elementNameRuleSets

Map of exact (local) element names to RuleSet instances

ruleSetsback to summary
private RuleSet[] ruleSets

Constructor Detail

Modeback to summary
public Mode()

Method Detail

addRuleback to summary
public void addRule(Rule rule)
addToNameMapback to summary
protected Map<String, RuleSet> addToNameMap(Map<String, RuleSet> map, String name, Rule rule)

Adds the Rule to a RuleSet for the given name.

Parameters
map:Map<String, RuleSet>

DOCUMENT ME!

name:String

DOCUMENT ME!

rule:Rule

DOCUMENT ME!

Returns:Map<String, RuleSet>

the Map (which will be created if the given map was null

applyTemplatesback to summary
public void applyTemplates(Element element) throws Exception
applyTemplatesback to summary
public void applyTemplates(Document document) throws Exception
fireRuleback to summary
public void fireRule(Node node) throws Exception

Runs the actions associated with the given node

Parameters
node:Node

DOCUMENT ME!

Exceptions
Exception:
DOCUMENT ME!
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

getRuleSetback to summary
protected RuleSet getRuleSet(int matchType)

DOCUMENT ME!

Parameters
matchType:int

DOCUMENT ME!

Returns:RuleSet

the RuleSet for the given matching type. This method will never return null, a new instance will be created.

removeFromNameMapback to summary
protected void removeFromNameMap(Map<String, RuleSet> map, String name, Rule rule)
removeRuleback to summary
public void removeRule(Rule rule)