Package net.sf.saxon.expr.compat
Class GeneralComparison10
java.lang.Object
net.sf.saxon.expr.Expression
net.sf.saxon.expr.BinaryExpression
net.sf.saxon.expr.compat.GeneralComparison10
- All Implemented Interfaces:
Callable
,ExportAgent
,Locatable
,IdentityComparable
,Traceable
GeneralComparison10: a boolean expression that compares two expressions
for equals, not-equals, greater-than or less-than. This implements the operators
=, !=, <, >, etc. This version of the class implements general comparisons
in XPath 1.0 backwards compatibility mode.
-
Field Summary
FieldsFields inherited from class net.sf.saxon.expr.BinaryExpression
operator
Fields inherited from class net.sf.saxon.expr.Expression
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 Summary
ConstructorsConstructorDescriptionGeneralComparison10
(Expression p0, int op, Expression p1) Create a general comparison identifying the two operands and the operator -
Method Summary
Modifier and TypeMethodDescriptioncall
(XPathContext context, Sequence[] arguments) Evaluate the expression: interface for use by compiled bytecodeprotected int
Determine the static cardinality.copy
(RebindingMap rebindings) Copy an expression.boolean
effectiveBooleanValue
(XPathContext context) Evaluate the expression giving a boolean resultevaluateItem
(XPathContext context) Evaluate the expression in a given contextprotected void
Add subclass-specific attributes to the expression tree explanation.Make an elaborator for this expressionDetermine the data type of the expressionoptimize
(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) Optimize the expressionvoid
setAtomicComparer
(AtomicComparer comparer) protected String
tag()
Get the element name used to identify this expression in exported expression formattypeCheck
(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) Type-check the expressionMethods inherited from class net.sf.saxon.expr.BinaryExpression
computeHashCode, computeSpecialProperties, displayOperator, equals, export, getImplementationMethod, getLhs, getLhsExpression, getOperandRole, getOperator, getRhs, getRhsExpression, isAssociative, isCommutative, isInverse, operands, setFlattened, setLhsExpression, setRhsExpression, toShortString, toString
Methods inherited from class net.sf.saxon.expr.Expression
addToPathMap, adoptChildExpression, allowExtractingCommonSubexpressions, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeStaticProperties, dispatchTailCall, dynamicError, evaluateAsString, explain, getCardinality, getConfiguration, getCost, getDependencies, getEvaluationMethod, getExpressionName, getExtraProperty, getIntegerBounds, getIntrinsicDependencies, getLocalRetainedStaticContext, getLocation, getNetCost, getObjectName, getPackageData, getParentExpression, getProperties, getProperty, getRetainedStaticContext, getScopingExpression, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStaticType, getStaticUType, getStreamerName, getTracingTag, hasCompatibleStaticContext, hashCode, hasSpecialProperty, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isCallOn, isEqual, isIdentical, isInstruction, isLiftable, isMultiThreaded, isStaticPropertiesKnown, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, iterate, makeElaborator, markTailFunctionCalls, operandList, operandSparseList, optimizeChildren, prepareForStreaming, process, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setExtraProperty, setFiltered, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplify, simplifyChildren, staticTypeCheck, supportsLazyEvaluation, suppressValidation, toPattern, typeCheckChildren, typeError, unordered, verifyParentPointers, withLocation
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.sf.saxon.trace.Traceable
gatherProperties
-
Field Details
-
singletonOperator
protected int singletonOperator -
comparer
-
-
Constructor Details
-
GeneralComparison10
Create a general comparison identifying the two operands and the operator- Parameters:
p0
- the left-hand operandop
- the operator, as a token returned by the Tokenizer (e.g. Token.LT)p1
- the right-hand operand
-
-
Method Details
-
computeCardinality
protected int computeCardinality()Determine the static cardinality. Returns [1..1]- Overrides:
computeCardinality
in classBinaryExpression
- Returns:
- the computed cardinality, as one of the values
StaticProperty.ALLOWS_ZERO_OR_ONE
,StaticProperty.EXACTLY_ONE
,StaticProperty.ALLOWS_ONE_OR_MORE
,StaticProperty.ALLOWS_ZERO_OR_MORE
. May also returnStaticProperty.ALLOWS_ZERO
if the result is known to be an empty sequence, orStaticProperty.ALLOWS_MANY
if if is known to return a sequence of length two or more.
-
typeCheck
public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException Type-check the expression- Overrides:
typeCheck
in classBinaryExpression
- Parameters:
visitor
- an expression visitorcontextInfo
- Information available statically about the context item: whether it is (possibly) absent; its static type; its streaming posture.- Returns:
- the checked expression
- Throws:
XPathException
- if an error is discovered during this phase (typically a type error)
-
setAtomicComparer
-
optimize
public Expression optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException Optimize the expression- Overrides:
optimize
in classBinaryExpression
- Parameters:
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 toType.ITEM_TYPE
- Returns:
- the checked expression
- Throws:
XPathException
- if an error is discovered during this phase (typically a type error)
-
evaluateItem
Evaluate the expression in a given context- Overrides:
evaluateItem
in classExpression
- Parameters:
context
- the given context for evaluation- Returns:
- a BooleanValue representing the result of the numeric comparison of the two operands
- Throws:
XPathException
- if any dynamic error occurs evaluating the expression
-
call
Evaluate the expression: interface for use by compiled bytecode- Specified by:
call
in interfaceCallable
- Parameters:
context
- the dynamic evaluation contextarguments
- the values of the arguments, supplied as SequenceIterators- Returns:
- the result of the evaluation, in the form of a SequenceIterator
- Throws:
XPathException
- if a dynamic error occurs during the evaluation of the expression
-
effectiveBooleanValue
Evaluate the expression giving a boolean result- Overrides:
effectiveBooleanValue
in classExpression
- Parameters:
context
- the given context for evaluation- Returns:
- a boolean representing the result of the comparison of the two operands
- Throws:
XPathException
- if any dynamic error occurs evaluating the expression
-
copy
Copy an expression. This makes a deep copy.- Specified by:
copy
in classExpression
- Parameters:
rebindings
- variables that must be re-bound- Returns:
- the copy of the original expression
-
getItemType
Determine the data type of the expression- Specified by:
getItemType
in classExpression
- Returns:
- Type.BOOLEAN
-
explainExtraAttributes
Description copied from class:BinaryExpression
Add subclass-specific attributes to the expression tree explanation. Default implementation does nothing; this is provided for subclasses to override.- Overrides:
explainExtraAttributes
in classBinaryExpression
- Parameters:
out
- the output destination for the displayed expression tree
-
tag
Description copied from class:BinaryExpression
Get the element name used to identify this expression in exported expression format- Overrides:
tag
in classBinaryExpression
- Returns:
- the element name used to identify this expression
-
getElaborator
Description copied from class:Expression
Make an elaborator for this expression- Overrides:
getElaborator
in classExpression
- Returns:
- an appropriate
Elaborator
-