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
public class GeneralComparison10 extends BinaryExpression implements Callable
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
Fields Modifier and Type Field Description protected AtomicComparer
comparer
protected int
singletonOperator
-
Fields 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
Constructors Constructor Description GeneralComparison10(Expression p0, int op, Expression p1)
Create a general comparison identifying the two operands and the operator
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BooleanValue
call(XPathContext context, Sequence[] arguments)
Evaluate the expression: interface for use by compiled bytecodeprotected int
computeCardinality()
Determine the static cardinality.Expression
copy(RebindingMap rebindings)
Copy an expression.boolean
effectiveBooleanValue(XPathContext context)
Evaluate the expression giving a boolean resultBooleanValue
evaluateItem(XPathContext context)
Evaluate the expression in a given contextprotected void
explainExtraAttributes(ExpressionPresenter out)
Add subclass-specific attributes to the expression tree explanation.Elaborator
getElaborator()
Make an elaborator for this expressionItemType
getItemType()
Determine the data type of the expressionExpression
optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo)
Optimize the expressionvoid
setAtomicComparer(AtomicComparer comparer)
protected java.lang.String
tag()
Get the element name used to identify this expression in exported expression formatExpression
typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo)
Type-check the expression-
Methods 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 Detail
-
singletonOperator
protected int singletonOperator
-
comparer
protected AtomicComparer comparer
-
-
Constructor Detail
-
GeneralComparison10
public GeneralComparison10(Expression p0, int op, Expression p1)
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 Detail
-
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
public void setAtomicComparer(AtomicComparer comparer)
-
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
public BooleanValue evaluateItem(XPathContext context) throws XPathException
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
public BooleanValue call(XPathContext context, Sequence[] arguments) throws XPathException
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
public boolean effectiveBooleanValue(XPathContext context) throws XPathException
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
public Expression copy(RebindingMap rebindings)
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
public ItemType getItemType()
Determine the data type of the expression- Specified by:
getItemType
in classExpression
- Returns:
- Type.BOOLEAN
-
explainExtraAttributes
protected void explainExtraAttributes(ExpressionPresenter out)
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
protected java.lang.String 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
public Elaborator getElaborator()
Description copied from class:Expression
Make an elaborator for this expression- Overrides:
getElaborator
in classExpression
- Returns:
- an appropriate
Elaborator
-
-