public class ArithmeticExpression extends BinaryExpression
ArithmeticExpression10| Modifier and Type | Field and Description |
|---|---|
protected Calculator |
calculator |
operatorEFFECTIVE_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 |
|---|
ArithmeticExpression(Expression p0,
int operator,
Expression p1)
Create an arithmetic expression
|
| Modifier and Type | Method and Description |
|---|---|
static AtomicValue |
compute(AtomicValue value0,
int operator,
AtomicValue value1,
XPathContext context)
Static method to apply arithmetic to two values
|
int |
computeSpecialProperties()
Determine the special properties of this expression
|
Expression |
copy(RebindingMap rebindings)
Copy an expression.
|
AtomicValue |
evaluateItem(XPathContext context)
Evaluate the expression.
|
protected void |
explainExtraAttributes(ExpressionPresenter out)
Add subclass-specific attributes to the expression tree explanation.
|
Calculator |
getCalculator()
Get the calculator allocated to evaluate this expression
|
java.lang.String |
getExpressionName()
Get a name identifying the kind of expression, in terms meaningful to a user.
|
IntegerValue[] |
getIntegerBounds()
For an expression that returns an integer or a sequence of integers, get
a lower and upper bound on the values of the integers that may be returned, from
static analysis.
|
PlainType |
getItemType()
Determine the data type of the expression, insofar as this is known statically
|
UType |
getStaticUType(UType contextItemType)
Get the static type of the expression as a UType, following precisely the type
inference rules defined in the XSLT 3.0 specification.
|
static int |
mapOpCode(int op)
Map operator codes from those in the Token class to those in the Calculator class
|
void |
resetLocalStaticProperties()
Reset the static properties of the expression to -1, so that they have to be recomputed
next time they are used.
|
void |
setCalculator(Calculator calculator)
Set the calculator allocated to evaluate this expression
|
protected java.lang.String |
tag()
Get the element name used to identify this expression in exported expression format
|
Expression |
typeCheck(ExpressionVisitor visitor,
ContextItemStaticInfo contextInfo)
Type-check the expression statically.
|
computeCardinality, computeHashCode, displayOperator, equals, export, getImplementationMethod, getLhs, getLhsExpression, getOperandRole, getOperator, getRhs, getRhsExpression, isAssociative, isCommutative, isInverse, operands, optimize, setFlattened, setLhsExpression, setRhsExpression, toShortString, toStringaddToPathMap, adoptChildExpression, allowExtractingCommonSubexpressions, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeStaticProperties, dynamicError, effectiveBooleanValue, evaluateAsString, evaluatePendingUpdates, explain, getCardinality, getConfiguration, getConstructType, getCost, getDependencies, getEvaluationMethod, getExtraProperty, getInterpretedExpression, getIntrinsicDependencies, getLocalRetainedStaticContext, getLocation, getNetCost, getObjectName, getPackageData, getParentExpression, getProperties, getProperty, getRetainedStaticContext, getScopingExpression, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStaticType, getStreamerName, hasCompatibleStaticContext, hashCode, hasSpecialProperty, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isCallOn, isEqual, isIdentical, isInstruction, isLiftable, isMultiThreaded, isStaticPropertiesKnown, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, iterate, markTailFunctionCalls, operandList, operandSparseList, optimizeChildren, prepareForStreaming, process, restoreParentPointers, setEvaluationMethod, setExtraProperty, setFiltered, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplify, simplifyChildren, staticTypeCheck, suppressValidation, toPattern, typeCheckChildren, typeError, unordered, verifyParentPointersprotected Calculator calculator
public ArithmeticExpression(Expression p0, int operator, Expression p1)
p0 - the first operandoperator - the operator, for example Token.PLUSp1 - the second operandpublic java.lang.String getExpressionName()
getExpressionName in class Expressionpublic int computeSpecialProperties()
computeSpecialProperties in class BinaryExpressionStaticProperty.NO_NODES_NEWLY_CREATED. This is overridden
for some subclasses.public void setCalculator(Calculator calculator)
calculator - the calculator to be usedpublic Calculator getCalculator()
public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException
typeCheck in class BinaryExpressionvisitor - an expression visitorcontextInfo - Information available statically about the context item: whether it is (possibly)
absent; its static type; its streaming posture.XPathException - if an error is discovered during this phase
(typically a type error)public IntegerValue[] getIntegerBounds()
getIntegerBounds in class Expressionpublic Expression copy(RebindingMap rebindings)
copy in class Expressionrebindings - public static AtomicValue compute(AtomicValue value0, int operator, AtomicValue value1, XPathContext context) throws XPathException
value0 - the first valueoperator - the operator as denoted in the Calculator class, for example Calculator.PLUSvalue1 - the second valuecontext - the XPath dynamic evaluation contextXPathException - if a dynamic error occurs during evaluationpublic static int mapOpCode(int op)
op - an operator denoted by a constant in the Token class, for example Token.PLUSCalculator class, for example
Calculator.PLUSpublic PlainType getItemType()
getItemType in class Expressionpublic UType getStaticUType(UType contextItemType)
getStaticUType in class ExpressioncontextItemType - public void resetLocalStaticProperties()
resetLocalStaticProperties in class Expressionpublic AtomicValue evaluateItem(XPathContext context) throws XPathException
evaluateItem in class Expressioncontext - The context in which the expression is to be evaluatedXPathException - if any dynamic error occurs evaluating the
expressionprotected java.lang.String tag()
BinaryExpressiontag in class BinaryExpressionprotected void explainExtraAttributes(ExpressionPresenter out)
BinaryExpressionexplainExtraAttributes in class BinaryExpressionout - the output destination for the displayed expression treeCopyright (c) 2004-2020 Saxonica Limited. All rights reserved.