public final class RuleManager
extends java.lang.Object
implements java.io.Serializable
Constructor and Description |
---|
RuleManager()
create a RuleManager and initialise variables.
|
Modifier and Type | Method and Description |
---|---|
void |
explainTemplateRules(ExpressionPresenter presenter)
Explain (that is, output the expression tree) all template rules
|
Mode |
getDefaultMode()
Get the mode object for the default (unnamed) mode
|
Mode |
getMode(StructuredQName modeName,
boolean createIfAbsent)
Get the Mode object for a named mode.
|
Rule |
getNextMatchHandler(NodeInfo node,
Mode mode,
Rule currentRule,
XPathContext c)
Get the next-match handler after the current one
|
Rule |
getTemplateRule(NodeInfo node,
Mode mode,
int min,
int max,
XPathContext c)
Get a template rule whose import precedence is in a particular range.
|
Rule |
getTemplateRule(NodeInfo node,
Mode mode,
XPathContext c)
Find the template rule registered for a particular node in a specific mode.
|
void |
resetHandlers()
Set up a new table of handlers.
|
void |
setHandler(Pattern pattern,
Template eh,
Mode mode,
int precedence)
Register a handler for a particular pattern.
|
void |
setHandler(Pattern pattern,
Template eh,
Mode mode,
int precedence,
double priority)
Register a template for a particular pattern.
|
public void resetHandlers()
public Mode getDefaultMode()
public Mode getMode(StructuredQName modeName, boolean createIfAbsent)
modeName
- The name of the mode. Supply null to get the default
mode or Mode.ALL_MODES to get the Mode object containing "mode=all" rulescreateIfAbsent
- if true, then if the mode does not already exist it will be created.
If false, then if the mode does not already exist the method returns null.public void setHandler(Pattern pattern, Template eh, Mode mode, int precedence)
pattern
- A match patterneh
- The ElementHandler to be usedmode
- The processing modeprecedence
- The import precedence (use 0 by default)public void setHandler(Pattern pattern, Template eh, Mode mode, int precedence, double priority)
pattern
- Must be a valid Pattern.eh
- The Template to be usedmode
- The processing mode to which this template appliesprecedence
- The import precedence of this rulepriority
- The priority of the rule: if an element matches several patterns, the
one with highest priority is usedPattern
public Rule getTemplateRule(NodeInfo node, Mode mode, XPathContext c) throws XPathException
node
- The NodeInfo for the relevant nodemode
- The processing modec
- The controller for this transformationXPathException
public Rule getTemplateRule(NodeInfo node, Mode mode, int min, int max, XPathContext c) throws XPathException
node
- The node to be matchedmode
- The mode for which a rule is requiredmin
- The minimum import precedence that the rule must havemax
- The maximum import precedence that the rule must havec
- The Controller for the transformationXPathException
public Rule getNextMatchHandler(NodeInfo node, Mode mode, Rule currentRule, XPathContext c) throws XPathException
node
- The node to be matchedmode
- The processing modecurrentRule
- The current template rulec
- The dynamic context for the transformationXPathException
public void explainTemplateRules(ExpressionPresenter presenter)