public final class RuleManager extends Object
Constructor and Description |
---|
RuleManager()
create a RuleManager and initialise variables.
|
Modifier and Type | Method and Description |
---|---|
void |
computeRankings()
Allocate rankings to the rules within each mode.
|
void |
explainTemplateRules(ExpressionPresenter presenter)
Explain (that is, output the expression tree) all template rules
|
Collection<Mode> |
getAllNamedModes()
Get all registered modes
|
Mode |
getMode(StructuredQName modeName,
boolean createIfAbsent)
Get the Mode object for a named mode.
|
Rule |
getNextMatchHandler(Item node,
Mode mode,
Rule currentRule,
XPathContext c)
Get the next-match handler after the current one
|
int |
getRecoveryPolicy()
Get the policy for handling recoverable errors.
|
Rule |
getTemplateRule(Item item,
Mode mode,
int min,
int max,
XPathContext c)
Get the template rule matching a given item whose import precedence
is in a particular range.
|
Mode |
getUnnamedMode()
Get the mode object for the unnamed mode
|
void |
invertStreamableTemplates(Optimizer opt)
Invert streamable templates in all streamable modes
|
void |
resetHandlers()
Set up a new table of handlers.
|
void |
setRecoveryPolicy(int policy)
Set the policy for handling recoverable errrors.
|
void |
setTemplateRule(Pattern pattern,
Template eh,
Mode mode,
StylesheetModule module,
double priority)
Register a template for a particular pattern.
|
public void setRecoveryPolicy(int policy)
policy
- the recovery policy to be used. The options are Configuration.RECOVER_SILENTLY
,
Configuration.RECOVER_WITH_WARNINGS
, or Configuration.DO_NOT_RECOVER
.public int getRecoveryPolicy()
public Collection<Mode> getAllNamedModes()
public void resetHandlers()
public Mode getUnnamedMode()
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 setTemplateRule(Pattern pattern, Template eh, Mode mode, StylesheetModule module, double priority)
pattern
- Must be a valid Pattern.eh
- The Template to be usedmode
- The processing mode to which this template appliesmodule
- The stylesheet module containing the template rulepriority
- The priority of the rule: if an element matches several patterns, the
one with highest priority is usedPattern
public Rule getTemplateRule(Item item, Mode mode, int min, int max, XPathContext c) throws XPathException
item
- The item 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
- if an error occurs matching a patternpublic Rule getNextMatchHandler(Item 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
- if an error occurs while matching a patternpublic void computeRankings() throws XPathException
XPathException
- if an error occurspublic void invertStreamableTemplates(Optimizer opt) throws XPathException
opt
- the optimizer (Always a Saxon-EE optimizer)XPathException
- if the templates are not streamablepublic void explainTemplateRules(ExpressionPresenter presenter)
presenter
- the object used to present the outputCopyright (c) 2004-2014 Saxonica Limited. All rights reserved.