public class ModeExperimental extends ModeEE
ModeEE.RuleTypeAction
SimpleMode.RuleGroupAction
Mode.RuleAction, Mode.RuleFilter
Modifier and Type | Field and Description |
---|---|
ComparisonPredicateIndex |
comparisonPredicateIndex |
HashMap<Expression,HashMap<Expression,List<Rule>>> |
elementRuleIndex |
IntHashMap<ComparisonPredicateIndex> |
namedComparisonPredicateIndex |
patternOptimization, rulePreconditions
atomicValueRuleChain, commentRuleChain, documentRuleChain, functionItemRuleChain, genericRuleChain, namedAttributeRuleChains, namedElementRuleChains, namespaceRuleChain, processingInstructionRuleChain, qNamedAttributeRuleChains, qNamedElementRuleChains, textRuleChain, unnamedAttributeRuleChain, unnamedElementRuleChain
DEFAULT_MODE_NAME, hasRules, modeName, mustBeTyped, mustBeUntyped, OMNI_MODE, UNNAMED_MODE_NAME
body
Constructor and Description |
---|
ModeExperimental(StructuredQName modeName,
CompilerInfo compilerInfo) |
Modifier and Type | Method and Description |
---|---|
void |
explainTemplateRules(ExpressionPresenter out)
Explain all template rules in this mode by showing their
expression tree represented in XML.
|
ComparisonPredicateIndex |
getNamedComparisonPredicateIndex(NodeInfo node,
XPathContext context) |
ComparisonPredicateIndex |
getNamedComparisonPredicateIndex(XPathContext c,
int kind,
String uri,
String local) |
Rule |
getRule(Item item,
XPathContext context)
Get the rule corresponding to a given item, by finding the best pattern match.
|
Rule |
getRule(Item item,
XPathContext context,
Mode.RuleFilter filter)
Get the rule corresponding to a given item, by finding the best Pattern match.
|
protected Rule |
getRuleFromComparisonPredicateIndex(Item item,
XPathContext context,
Rule bestRule,
ComparisonPredicateIndex index,
IndexMatcher ruleSearchState,
Mode.RuleFilter filter) |
protected Rule |
getRuleFromIndex(Item item,
XPathContext context,
Rule bestRule,
HashMap<Expression,HashMap<Expression,List<Rule>>> index,
RuleSearchState ruleSearchState,
Mode.RuleFilter filter)
Get the best rule match from an indexed set of indexed sets of rule lists
|
HashMap<Expression,HashMap<Expression,List<Rule>>> |
indexRules(Rule chain,
Rule genericChain)
Generate a set of indexes for the unnamed elements/attributes
Uses the indexation definitions contained in the patternOptimization object
TODO think about whether to record high/low ranks for each rule group
|
IntHashMap<ComparisonPredicateIndex> |
indexRulesComparisonPredicate(IntHashMap<Rule> chains,
Rule genericChain)
Generate the set of comparison predicate indexation structures for the named element rules.
|
ComparisonPredicateIndex |
indexRulesComparisonPredicate(Rule chain,
Rule genericChain,
PatternOptimizationEE pattOpt)
Generate comparison predicate indexation structures for the given element rules.
|
protected RuleSearchState |
makeRuleSearchState()
Generate a search state for processing a given node
|
void |
optimizeRules() |
computePreconditions, computeStreamability, deduplicateRules, getNamedNodeChain, getUnnamedNodeChain, invertStreamableTemplates, listRules, makeRule, optimizeRules, optimizeRules, orderRules, orderRules, processRulesTyped, reportAmbiguity, ruleMatches, setType, typeName
getBuiltInRuleSetForCode, getCodeForBuiltInRuleSet, prepareStreamability
addRule, addRule, allocateAllBindingSlots, allocateAllPatternSlots, allocatePatternSlots, checkForConflictingProperties, computeRankings, copyRules, exportTemplateRules, forceAllocateAllBindingSlots, getActivePart, getBuiltInRuleSet, getExplicitNamespaces, getMaxPrecedence, getMaxRank, getNamedRuleChain, getPropertyValue, getStackFrameSlotsNeeded, isEmpty, processRuleChain, processRuleChain, processRuleChains, processRules, processRules, searchRuleChain, searchRuleChain, setBuiltInRuleSet, setExplicitProperty, setGroup, setStackFrameSlotsNeeded
applyTemplates, explain, export, getComponentKind, getConstructType, getModeName, getModeTitle, getNextMatchRule, getObjectName, getRecoveryPolicy, getRule, getSymbolicName, isDeclaredStreamable, isUnnamedMode, makeNewContext, makeNewContextIfNeeded, setRecoveryPolicy, setStreamable
allocateBindingSlotsRecursive, getBody, getColumnNumber, getDeclaredVisibility, getDeclaringComponent, getLineNumber, getLocation, getPackageData, getProperties, getProperty, getPublicId, getRetainedStaticContext, getStackFrameMap, getSystemId, makeDeclaringComponent, saveLocation, setBody, setDeclaredVisibility, setDeclaringComponent, setLineNumber, setPackageData, setRetainedStaticContext, setStackFrameMap, setSystemId
public ComparisonPredicateIndex comparisonPredicateIndex
public IntHashMap<ComparisonPredicateIndex> namedComparisonPredicateIndex
public HashMap<Expression,HashMap<Expression,List<Rule>>> elementRuleIndex
public ModeExperimental(StructuredQName modeName, CompilerInfo compilerInfo)
protected RuleSearchState makeRuleSearchState()
SimpleMode
makeRuleSearchState
in class ModeEE
public void optimizeRules()
optimizeRules
in class ModeEE
public IntHashMap<ComparisonPredicateIndex> indexRulesComparisonPredicate(IntHashMap<Rule> chains, Rule genericChain)
chains
- the named element rule chainsgenericChain
- the generic rule chainpublic ComparisonPredicateIndex indexRulesComparisonPredicate(Rule chain, Rule genericChain, PatternOptimizationEE pattOpt)
chain
- the rule chaingenericChain
- the generic rule chainpublic HashMap<Expression,HashMap<Expression,List<Rule>>> indexRules(Rule chain, Rule genericChain)
chain
- the rules to be indexedgenericChain
- the generic rule set to add on to this setpublic Rule getRule(Item item, XPathContext context) throws XPathException
SimpleMode
getRule
in class SimpleMode
item
- the item to be matchedcontext
- the XPath dynamic evaluation contextXPathException
- if an error occurs matching a patternpublic Rule getRule(Item item, XPathContext context, Mode.RuleFilter filter) throws XPathException
SimpleMode
getRule
in class SimpleMode
item
- the item to be matchedcontext
- the XPath dynamic evaluation contextfilter
- a filter to select which rules should be consideredXPathException
- if an error occursprotected Rule getRuleFromComparisonPredicateIndex(Item item, XPathContext context, Rule bestRule, ComparisonPredicateIndex index, IndexMatcher ruleSearchState, Mode.RuleFilter filter) throws XPathException
XPathException
public ComparisonPredicateIndex getNamedComparisonPredicateIndex(NodeInfo node, XPathContext context)
public ComparisonPredicateIndex getNamedComparisonPredicateIndex(XPathContext c, int kind, String uri, String local)
protected Rule getRuleFromIndex(Item item, XPathContext context, Rule bestRule, HashMap<Expression,HashMap<Expression,List<Rule>>> index, RuleSearchState ruleSearchState, Mode.RuleFilter filter) throws XPathException
The key expression for each outer set member is evaluated on the context (match) item to produce a sequence of literals, which are each then used to key into the rulelists. Each rule list, which is sorted in rank/sequence order, is then examined to find a (unique) match with highest unique rank.
item
- the item to be examined (should be a node?)context
- XPath dynamic contextbestRule
- the best rule found so far, usually non-null if named match beforehand or next-matchindex
- the index of the rule listsruleSearchState
- the current rule search statefilter
- a filter for acceptable rules - can be null, admitting allXPathException
- if there is ambiguity that needs to throw an errorpublic void explainTemplateRules(ExpressionPresenter out)
SimpleMode
explainTemplateRules
in class ModeEE
out
- used to display the expression treeCopyright (c) 2004-2014 Saxonica Limited. All rights reserved.