public class ModeEE extends ModePE
Modifier and Type | Class and Description |
---|---|
static class |
ModeEE.RuleChainOptimizationData |
static interface |
ModeEE.RuleTypeAction |
SimpleMode.RuleGroupAction
Mode.RuleAction, Mode.RuleFilter
atomicValueRuleChain, commentRuleChain, documentRuleChain, functionItemRuleChain, genericRuleChain, namedAttributeRuleChains, namedElementRuleChains, namespaceRuleChain, processingInstructionRuleChain, qNamedAttributeRuleChains, qNamedElementRuleChains, textRuleChain, unnamedAttributeRuleChain, unnamedElementRuleChain
DEFAULT_MODE_NAME, modeName, mustBeTyped, mustBeUntyped, OMNI_MODE, UNNAMED_MODE_NAME
Constructor and Description |
---|
ModeEE(StructuredQName modeName,
CompilerInfo compilerInfo) |
Modifier and Type | Method and Description |
---|---|
void |
computeStreamability()
Compute the streamability of all template rules
|
void |
explainTemplateRules(ExpressionPresenter out)
Explain all template rules in this mode by showing their
expression tree represented in XML.
|
protected void |
exportUseAccumulators(ExpressionPresenter presenter) |
RuleChain |
getNamedNodeChain(NodeInfo node,
XPathContext context)
Find the named node rule chain for a given node
|
RuleChain |
getUnnamedNodeChain(NodeInfo node)
Find the unnamed node rule chain for a given node
|
void |
invertStreamableTemplates()
For a streamable mode, invert all the templates to generate streamable code
|
static java.util.List<Rule> |
listRules(RuleChain chain)
Work with a rule chain as a list of rules
|
Rule |
makeRule(Pattern pattern,
RuleTarget action,
int precedence,
int minImportPrecedence,
double priority,
int sequence,
int part)
Generate a new rule - so it can be overridden to make more specialist rules
|
protected PreconditionMatcher |
makeRuleSearchState(RuleChain chain,
XPathContext context)
Generate a search state for processing a given node
|
void |
optimizeRuleChain(RuleChain chain)
Perform optimization on a chain of rules.
|
void |
optimizeRules()
Perform optimization on the complete set of rules comprising this Mode.
|
static java.util.List<Rule> |
orderRules(java.util.List<Rule> r1,
java.util.List<Rule> r2)
Combine two rule lists in rank order
|
static java.util.List<Rule> |
orderRules(RuleChain chain1,
RuleChain chain2)
Combine two rule chains into a rank-ordered combined list
|
void |
reportAmbiguity(Item item,
Rule r1,
Rule r2,
XPathContext c)
Report an ambiguity, that is, the situation where two rules of the same
precedence and priority match the same node
|
protected boolean |
ruleMatches(Rule r,
Item item,
XPathContextMajor context,
RuleSearchState ruleSearchState)
Does this rule match the given item? Can be overridden
|
protected ModeEE.RuleTypeAction |
setType(ModeEE.RuleTypeAction action,
ItemType type) |
static java.lang.String |
typeName(int type)
Find the name for a node type
|
protected static boolean |
useFirst(Rule chain1,
Rule chain2) |
prepareStreamability
addRule, addRule, addRuleToNamedOrUnnamedChain, allocateAllBindingSlots, allocateAllPatternSlots, allocatePatternSlots, checkForConflictingProperties, computeRankings, copyRules, exportTemplateRules, forceAllocateAllBindingSlots, getActivePart, getBuiltInRuleSet, getExplicitNamespaces, getLabel, getMaxPrecedence, getMaxRank, getNamedRuleChain, getPropertyValue, getRule, getRule, getStackFrameSlotsNeeded, isEmpty, processRuleChain, processRuleChain, processRuleChains, processRules, processRules, searchRuleChain, searchRuleChain, setBuiltInRuleSet, setExplicitProperty, setGroup, setStackFrameSlotsNeeded
applyTemplates, explain, export, getAccumulators, getBuiltInRuleSetForCode, getCodeForBuiltInRuleSet, getComponentKind, getConstructType, getDeclaringComponent, getModeName, getModeTitle, getNextMatchRule, getObjectName, getRecoveryPolicy, getRule, getSymbolicName, isDeclaredStreamable, isModeTracing, isMustBeTyped, isUnnamedMode, makeNewContext, setAccumulators, setHasRules, setModeTracing, setRecoveryPolicy, setStreamable
allocateBindingSlotsRecursive, getBody, getColumnNumber, getDeclaredVisibility, getLineNumber, getLocation, getPackageData, getProperties, getProperty, getPublicId, getRetainedStaticContext, getStackFrameMap, getSystemId, isExportable, makeDeclaringComponent, obtainDeclaringComponent, saveLocation, setBody, setChildExpression, setDeclaredVisibility, setDeclaringComponent, setLineNumber, setPackageData, setRetainedStaticContext, setStackFrameMap, setSystemId
public ModeEE(StructuredQName modeName, CompilerInfo compilerInfo)
protected void exportUseAccumulators(ExpressionPresenter presenter)
exportUseAccumulators
in class Mode
public Rule makeRule(Pattern pattern, RuleTarget action, int precedence, int minImportPrecedence, double priority, int sequence, int part)
SimpleMode
makeRule
in class SimpleMode
pattern
- the pattern that this rule matchesaction
- the object invoked by this rule (usually a Template)precedence
- the precedence of the ruleminImportPrecedence
- the minimum import precedence for xsl:apply-importspriority
- the priority of the rulesequence
- a sequence number for ordering of rulespart
- distinguishes rules formed by splitting a rule on a union patternprotected PreconditionMatcher makeRuleSearchState(RuleChain chain, XPathContext context)
SimpleMode
makeRuleSearchState
in class SimpleMode
public RuleChain getNamedNodeChain(NodeInfo node, XPathContext context)
node
- the node to be matchedcontext
- local contextpublic RuleChain getUnnamedNodeChain(NodeInfo node)
node
- the node to be matchedprotected boolean ruleMatches(Rule r, Item item, XPathContextMajor context, RuleSearchState ruleSearchState) throws XPathException
ruleMatches
in class SimpleMode
r
- the rule to checkitem
- the context itemcontext
- the static context for evaluationruleSearchState
- An appropriate matcher for preconditions in this modeXPathException
- if a dynamic error occurs while matching the patternpublic void computeStreamability() throws XPathException
computeStreamability
in class SimpleMode
XPathException
public void invertStreamableTemplates() throws XPathException
invertStreamableTemplates
in class SimpleMode
XPathException
- if there is a non-streamable template in the modeprotected ModeEE.RuleTypeAction setType(ModeEE.RuleTypeAction action, ItemType type)
public void optimizeRules()
optimizeRules
in class SimpleMode
public void optimizeRuleChain(RuleChain chain)
chain
- the chain of rulespublic static java.util.List<Rule> listRules(RuleChain chain)
chain
- the chained set of rulespublic static java.util.List<Rule> orderRules(java.util.List<Rule> r1, java.util.List<Rule> r2)
This does not detect duplicates within the list
r1
- one list of rules, assumed in rank orderr2
- the other list of rules, assumed in rank orderpublic static java.util.List<Rule> orderRules(RuleChain chain1, RuleChain chain2)
This could be simplified as orderRules(listRules(chain1),listRules(chain2))
chain1
- the first rule chainchain2
- the second rule chainpublic void explainTemplateRules(ExpressionPresenter out) throws XPathException
SimpleMode
explainTemplateRules
in class SimpleMode
out
- used to display the expression treeXPathException
public void reportAmbiguity(Item item, Rule r1, Rule r2, XPathContext c) throws XPathException
SimpleMode
reportAmbiguity
in class SimpleMode
item
- The item that matches two or more rulesr1
- The first rule that the node matchesr2
- The second rule that the node matchesc
- The context for the transformationXPathException
- if the system is configured to treat ambiguous template matching as a
non-recoverable errorpublic static java.lang.String typeName(int type)
type
- the code for the typeCopyright (c) 2004-2020 Saxonica Limited. All rights reserved.