public class CompareToIntegerConstant extends UnaryExpression implements ComparisonExpression
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 |
---|
CompareToIntegerConstant(Expression operand,
int operator,
long comparand)
Create the expression
|
Modifier and Type | Method and Description |
---|---|
int |
computeCardinality()
Determine the static cardinality.
|
int |
computeHashCode()
Hashcode supporting equals()
|
int |
computeSpecialProperties()
Get the static properties of this expression (other than its type).
|
boolean |
convertsUntypedToOther()
Determine whether untyped atomic values should be converted to the type of the other operand
|
Expression |
copy(RebindingMap rebindings)
Copy an expression.
|
boolean |
effectiveBooleanValue(XPathContext context)
Get the effective boolean value of the expression.
|
boolean |
equals(java.lang.Object other)
Is this expression the same as another expression?
|
BooleanValue |
evaluateItem(XPathContext context)
Evaluate an expression as a single item.
|
void |
export(ExpressionPresenter destination)
Diagnostic print of expression structure.
|
AtomicComparer |
getAtomicComparer()
Get the AtomicComparer used to compare atomic values.
|
long |
getComparand()
Get the integer value on the rhs of the expression
|
int |
getComparisonOperator()
Get the comparison operator
|
java.lang.String |
getExpressionName()
Get a name identifying the kind of expression, in terms meaningful to a user.
|
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.
|
Operand |
getLhs()
Get the two operands of the comparison
|
Expression |
getLhsExpression() |
protected OperandRole |
getOperandRole()
Get the usage (in terms of streamability analysis) of the single operand
|
Operand |
getRhs() |
Expression |
getRhsExpression() |
int |
getSingletonOperator()
Get the primitive (singleton) operator used: one of Token.FEQ, Token.FNE, Token.FLT, Token.FGT,
Token.FLE, Token.FGE
|
Expression |
optimize(ExpressionVisitor visitor,
ContextItemStaticInfo contextInfo)
Perform optimisation of an expression and its subexpressions.
|
java.lang.String |
toShortString()
Produce a short string identifying the expression for use in error messages
|
java.lang.String |
toString()
The toString() method for an expression attempts to give a representation of the expression
in an XPath-like form.
|
displayOperator, getBaseExpression, getOperand, operands, setBaseExpression, typeCheck
addToPathMap, adoptChildExpression, allowExtractingCommonSubexpressions, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeStaticProperties, dynamicError, evaluateAsString, 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, isInstruction, isLiftable, isMultiThreaded, isStaticPropertiesKnown, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, iterate, markTailFunctionCalls, operandList, operandSparseList, optimizeChildren, prepareForStreaming, process, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setExtraProperty, setFiltered, setFlattened, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplify, simplifyChildren, staticTypeCheck, suppressValidation, toPattern, typeCheckChildren, typeError, unordered, verifyParentPointers
public CompareToIntegerConstant(Expression operand, int operator, long comparand)
protected OperandRole getOperandRole()
UnaryExpression
getOperandRole
in class UnaryExpression
public Expression getLhsExpression()
getLhsExpression
in interface ComparisonExpression
public Operand getLhs()
ComparisonExpression
getLhs
in interface ComparisonExpression
public Expression getRhsExpression()
getRhsExpression
in interface ComparisonExpression
public Operand getRhs()
getRhs
in interface ComparisonExpression
public long getComparand()
public int getComparisonOperator()
public int getImplementationMethod()
getImplementationMethod
in class Expression
Expression.EVALUATE_METHOD
public int computeSpecialProperties()
UnaryExpression
computeSpecialProperties
in class UnaryExpression
public Expression copy(RebindingMap rebindings)
copy
in class Expression
rebindings
- public boolean equals(java.lang.Object other)
equals
in class UnaryExpression
other
- the expression to be compared with this onepublic int computeHashCode()
computeHashCode
in class UnaryExpression
public BooleanValue 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 boolean effectiveBooleanValue(XPathContext context) throws XPathException
effectiveBooleanValue
in class Expression
context
- The context in which the expression is to be evaluatedXPathException
- if any dynamic error occurs evaluating the
expressionpublic int computeCardinality()
UnaryExpression
computeCardinality
in class UnaryExpression
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 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 UnaryExpression
visitor
- the 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 java.lang.String getExpressionName()
getExpressionName
in class Expression
public ItemType getItemType()
This method should always return a result, though it may be the best approximation that is available at the time.
getItemType
in class UnaryExpression
public void export(ExpressionPresenter destination) throws XPathException
export
in interface ExportAgent
export
in class UnaryExpression
destination
- 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.public java.lang.String toString()
The toString() method for an expression attempts to give a representation of the expression in an XPath-like form.
For subclasses of Expression that represent XPath expressions, the result should always be a string that parses as an XPath 3.0 expression
toString
in class UnaryExpression
public java.lang.String toShortString()
toShortString
in class UnaryExpression
public AtomicComparer getAtomicComparer()
getAtomicComparer
in interface ComparisonExpression
public int getSingletonOperator()
getSingletonOperator
in interface ComparisonExpression
public boolean convertsUntypedToOther()
convertsUntypedToOther
in interface ComparisonExpression
Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.