public class WhichOf extends Expression
Currently used only in ModeExperimentalChoice which is not used by default.
Modifier and Type | Class and Description |
---|---|
class |
WhichOf.ChoiceExpression
This inner class associates a choice with its index in the choice list
and any necessary preconditions
|
Modifier and Type | Field and Description |
---|---|
List<WhichOf.ChoiceExpression> |
choices |
EFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, ITEM_FEED_METHOD, ITERATE_METHOD, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, PROCESS_METHOD, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, UPDATE_METHOD, WATCH_METHOD
Constructor and Description |
---|
WhichOf(Expression[] conditions)
Construct a whichOf instruction
|
Modifier and Type | Method and Description |
---|---|
protected int |
computeCardinality()
Compute the static cardinality of this expression
|
Expression |
copy()
Copy an expression.
|
Item |
evaluateItem(XPathContext context)
Evaluate an expression as a single item.
|
void |
export(ExpressionPresenter out)
Diagnostic print of expression structure.
|
void |
export(ExpressionPresenter out,
List<Rule> rules) |
Expression[] |
getConditions() |
int |
getImplementationMethod()
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().
|
ItemType |
getItemType()
Determine the data type of the expression, if possible.
|
HashMap<Expression,List<WhichOf.ChoiceExpression>> |
getPreconditionGroups()
Group the subexpressions that share the same preconditions
|
Iterable<Operand> |
operands()
Get all the XPath expressions associated with this instruction
(in XSLT terms, the expression present on attributes of the instruction,
as distinct from the child instructions in a sequence construction)
|
Expression |
simplify()
Simplify an expression.
|
String |
toString()
The toString() method for an expression attempts to give a representation of the expression
in an XPath-like form, but there is no guarantee that the syntax will actually be true XPath.
|
int |
which(int start,
int end,
XPathContext context)
Identify which of the choices to take
|
int |
which(int start,
XPathContext context)
Identify which of the choices to take
|
int |
which(XPathContext context)
Identify which of the choices to take
|
addToPathMap, adoptChildExpression, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, clearStreamabilityData, computeDependencies, computeSpecialProperties, computeStaticProperties, doPromotion, dynamicError, effectiveBooleanValue, evaluateAsString, evaluatePendingUpdates, explain, getCardinality, getConfiguration, getConstructType, getCost, getDependencies, getEvaluationMethod, getExpressionCompiler, getExpressionName, getHostLanguage, getIntegerBounds, getIntrinsicDependencies, getLocation, getNetCost, getObjectName, getPackageData, getParentExpression, getPosture, getPostureAndSweepIfKnown, getProperties, getProperty, getRetainedStaticContext, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStreamability, getStreamingAdjunct, getSweep, getSystemId, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isCallOn, isCallOnSystemFunction, isIdentical, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, iterate, iterateEvents, makeStreamingAdjunct, markTailFunctionCalls, operandList, operandSparseList, optimize, optimizeChildren, optimizeForType, process, promote, promoteChildren, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setFiltered, setFlattened, setLocation, setParentExpression, setPostureAndSweep, setRetainedStaticContext, setRetainedStaticContextLocally, setStaticProperty, simplifyChildren, staticTypeCheck, suppressValidation, toPattern, toShortString, toStreamingPattern, typeCheck, typeCheckChildren, typeError, unordered
public List<WhichOf.ChoiceExpression> choices
public WhichOf(Expression[] conditions)
conditions
- the conditions to be tested, in orderpublic ItemType getItemType()
Expression
This method should always return a result, though it may be the best approximation that is available at the time.
getItemType
in class Expression
public Expression[] getConditions()
public void export(ExpressionPresenter out)
Expression
export
in class Expression
out
- the expression presenter used to display the structurepublic void export(ExpressionPresenter out, List<Rule> rules)
public HashMap<Expression,List<WhichOf.ChoiceExpression>> getPreconditionGroups()
protected int computeCardinality()
Expression
computeCardinality
in class Expression
StaticProperty.ALLOWS_ZERO_OR_ONE
,
StaticProperty.EXACTLY_ONE
, StaticProperty.ALLOWS_ONE_OR_MORE
,
StaticProperty.ALLOWS_ZERO_OR_MORE
public Expression copy()
Expression
copy
in class Expression
public String toString()
toString
in class Expression
public Expression simplify() throws XPathException
simplify
in class Expression
XPathException
- if an error is discovered during expression
rewritingpublic Iterable<Operand> operands()
operands
in class Expression
public Item evaluateItem(XPathContext context) throws XPathException
evaluateItem
in class Expression
context
- The context in which the expression is to be evaluatedXPathException
- if any dynamic error occurs evaluating the
expressionpublic int getImplementationMethod()
Expression
getImplementationMethod
in class Expression
Expression.ITERATE_METHOD
or Expression.EVALUATE_METHOD
or
Expression.PROCESS_METHOD
public int which(XPathContext context) throws XPathException
context
- the dynamic contextXPathException
- if evaluating a condition failspublic int which(int start, XPathContext context) throws XPathException
start
- the starting index to use - supports next-matchcontext
- the dynamic contextXPathException
- if evaluating a condition failspublic int which(int start, int end, XPathContext context) throws XPathException
start
- the starting index to use - supports apply-importsend
- the ending index to use (inclusive) - supports apply-importscontext
- the dynamic contextXPathException
- if evaluating a condition failsCopyright (c) 2004-2014 Saxonica Limited. All rights reserved.