public class NumberInstruction extends Expression
NumberSequenceFormatter
which takes this sequence of integers and performs
the necessary formatting.Modifier and Type | Field and Description |
---|---|
static int |
ANY |
static java.lang.String[] |
LEVEL_NAMES |
static int |
MULTI |
static int |
SIMPLE |
static int |
SINGLE |
EFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, ITEM_FEED_METHOD, ITERATE_METHOD, MAX_COST, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, PROCESS_METHOD, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, UPDATE_METHOD, WATCH_METHOD
Constructor and Description |
---|
NumberInstruction(Expression select,
int level,
Pattern count,
Pattern from)
Construct a NumberInstruction
|
Modifier and Type | Method and Description |
---|---|
int |
computeCardinality()
Compute the static cardinality of this expression
|
Expression |
copy(RebindingMap rebindings)
Copy an expression.
|
void |
export(ExpressionPresenter out)
Diagnostic print of expression structure.
|
Pattern |
getCount()
Get the count pattern, if specified
|
java.lang.String |
getExpressionName()
Get a name identifying the kind of expression, in terms meaningful to a user.
|
Pattern |
getFrom()
Get the from pattern, if specified
|
int |
getImplementationMethod()
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().
|
ItemType |
getItemType()
Determine the static item type of the expression, as precisely possible.
|
int |
getLevel()
Get the level attribute
|
Expression |
getSelect()
Get the select expression
|
boolean |
isInstruction()
Ask whether this expression is an instruction.
|
SequenceIterator<?> |
iterate(XPathContext context)
Return an Iterator to iterate over the values of a sequence.
|
java.lang.Iterable<Operand> |
operands()
Get the immediate sub-expressions of this expression, with information about the relationship
of each expression to its parent expression.
|
Expression |
optimize(ExpressionVisitor visitor,
ContextItemStaticInfo contextInfo)
Perform optimisation of an expression and its subexpressions.
|
addToPathMap, adoptChildExpression, allowExtractingCommonSubexpressions, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeHashCode, computeSpecialProperties, computeStaticProperties, dynamicError, effectiveBooleanValue, equals, evaluateAsString, evaluateItem, evaluatePendingUpdates, explain, getCardinality, getConfiguration, getConstructType, getCost, getDependencies, getEvaluationMethod, getExtraProperty, getIntegerBounds, getInterpretedExpression, getIntrinsicDependencies, getLocalRetainedStaticContext, getLocation, getNetCost, getObjectName, getPackageData, getParentExpression, getProperties, getProperty, getRetainedStaticContext, getScopingExpression, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStaticType, getStaticUType, getStreamerName, hasCompatibleStaticContext, hashCode, hasSpecialProperty, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isCallOn, isEqual, isIdentical, isLiftable, isMultiThreaded, isStaticPropertiesKnown, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, markTailFunctionCalls, operandList, operandSparseList, optimizeChildren, prepareForStreaming, process, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setExtraProperty, setFiltered, setFlattened, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplify, simplifyChildren, staticTypeCheck, suppressValidation, toPattern, toShortString, toString, typeCheck, typeCheckChildren, typeError, unordered, verifyParentPointers
public static final int SINGLE
public static final int MULTI
public static final int ANY
public static final int SIMPLE
public static final java.lang.String[] LEVEL_NAMES
public NumberInstruction(Expression select, int level, Pattern count, Pattern from)
select
- the expression supplied in the select attributelevel
- one of "single", "level", "multi"count
- the pattern supplied in the count attributefrom
- the pattern supplied in the from attributepublic boolean isInstruction()
isInstruction
in class Expression
public java.lang.Iterable<Operand> operands()
Expression
If the expression is a Callable, then it is required that the order of the operands returned by this function is the same as the order of arguments supplied to the corresponding call() method.
operands
in class Expression
public int getLevel()
public Pattern getCount()
public Pattern getFrom()
public Expression getSelect()
public Expression copy(RebindingMap rebindings)
copy
in class Expression
rebindings
- a mutable list of (old binding, new binding) pairs
* that is used to update the bindings held in any
* local variable references that are copied.public 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 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
. May also return StaticProperty.ALLOWS_ZERO
if
the result is known to be an empty sequence, or StaticProperty.ALLOWS_MANY
if
if is known to return a sequence of length two or more.public int getImplementationMethod()
getImplementationMethod
in class Expression
Expression.ITERATE_METHOD
or Expression.EVALUATE_METHOD
or
Expression.PROCESS_METHOD
public Expression optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException
This method is called after all references to functions and variables have been resolved to the declaration of the function or variable, and after all type checking has been done.
optimize
in class Expression
visitor
- an expression visitorcontextInfo
- the static type of "." at the point where this expression is invoked.
The parameter is set to null if it is known statically that the context item will be undefined.
If the type of the context item is not known statically, the argument is set to
Type.ITEM_TYPE
XPathException
- if an error is discovered during this phase
(typically a type error)public SequenceIterator<?> iterate(XPathContext context) throws XPathException
Expression
iterate
in class Expression
context
- supplies the context for evaluationXPathException
- if any dynamic error occurs evaluating the
expressionpublic java.lang.String getExpressionName()
Expression
getExpressionName
in class Expression
public void export(ExpressionPresenter out) throws XPathException
export
in interface ExportAgent
export
in class Expression
out
- the expression presenter used to display the structureXPathException
- if the export fails, for example if an expression is found that won't work
in the target environment.Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.