Class IdentityComparison
java.lang.Object
net.sf.saxon.expr.ComputedExpression
net.sf.saxon.expr.BinaryExpression
net.sf.saxon.expr.IdentityComparison
- All Implemented Interfaces:
Serializable, SourceLocator, Container, Expression, InstructionInfoProvider
IdentityComparison: a boolean expression that compares two nodes
for equals, not-equals, greater-than or less-than based on identity and
document ordering
- See Also:
-
Field Summary
Fields inherited from class BinaryExpression
operand0, operand1, operatorFields inherited from class ComputedExpression
locationId, staticPropertiesFields inherited from interface Expression
EVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD -
Constructor Summary
ConstructorsConstructorDescriptionIdentityComparison(Expression p1, int op, Expression p2) Create an identity comparison identifying the two operands and the operator -
Method Summary
Modifier and TypeMethodDescriptionbooleaneffectiveBooleanValue(XPathContext context) Get the effective boolean value of the expression.evaluateItem(XPathContext context) Evaluate the expressionDetermine the data type of the expressionvoidsetGenerateIdEmulation(boolean flag) Set flag to indicate different empty-sequence behavior when emulating comparison of two generate-id'stypeCheck(StaticContext env, ItemType contextItemType) Type-check the expressionMethods inherited from class BinaryExpression
computeCardinality, computeSpecialProperties, display, displayOperator, equals, getOperands, getOperator, hashCode, isAssociative, isCommutative, isInverse, iterateSubExpressions, optimize, promote, replaceSubExpression, simplifyMethods inherited from class ComputedExpression
adoptChildExpression, checkPermittedContents, computeDependencies, computeStaticProperties, doPromotion, dynamicError, evaluateAsString, getCardinality, getColumnNumber, getConstructType, getDependencies, getExecutable, getHostLanguage, getImplementationMethod, getInstructionInfo, getIntrinsicDependencies, getLineNumber, getLocationId, getLocationProvider, getParentExpression, getPublicId, getSlotsUsed, getSpecialProperties, getSystemId, hasBadParentPointer, iterate, markTailFunctionCalls, process, resetStaticProperties, setLocationId, setParentExpression, setParentExpression, suppressValidation, typeError
-
Constructor Details
-
IdentityComparison
Create an identity comparison identifying the two operands and the operator- Parameters:
p1- the left-hand operandop- the operator, as a token returned by the Tokenizer (e.g. Token.LT)p2- the right-hand operand
-
-
Method Details
-
setGenerateIdEmulation
public void setGenerateIdEmulation(boolean flag) Set flag to indicate different empty-sequence behavior when emulating comparison of two generate-id's -
typeCheck
Type-check the expression- Specified by:
typeCheckin interfaceExpression- Overrides:
typeCheckin classBinaryExpression- Parameters:
env- the static context of the expressioncontextItemType- 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 original expression, rewritten to perform necessary run-time type checks, and to perform other type-related optimizations
- Throws:
XPathException
-
evaluateItem
Evaluate the expression- Specified by:
evaluateItemin interfaceExpression- Overrides:
evaluateItemin classComputedExpression- Parameters:
context- The context in which the expression is to be evaluated- Returns:
- the node or atomic value that results from evaluating the expression; or null to indicate that the result is an empty sequence
- Throws:
XPathException- if any dynamic error occurs evaluating the expression
-
effectiveBooleanValue
Description copied from class:ComputedExpressionGet the effective boolean value of the expression. This returns false if the value is the empty sequence, a zero-length string, a number equal to zero, or the boolean false. Otherwise it returns true.- Specified by:
effectiveBooleanValuein interfaceExpression- Overrides:
effectiveBooleanValuein classComputedExpression- Parameters:
context- The context in which the expression is to be evaluated- Returns:
- the effective boolean value
- Throws:
XPathException- if any dynamic error occurs evaluating the expression
-
getItemType
Determine the data type of the expression- Parameters:
th-- Returns:
- Type.BOOLEAN
-