net.sf.saxon.expr

Class GeneralComparison10

Implemented Interfaces:
EvaluableItem, InstructionInfoProvider, SequenceIterable, Serializable, SourceLocator

public class GeneralComparison10
extends BinaryExpression

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, as defined in the Oct 2004 revision of the specifications.

Field Summary

protected AtomicComparer
comparer
protected int
singletonOperator

Fields inherited from class net.sf.saxon.expr.BinaryExpression

operand0, operand1, operator

Fields inherited from class net.sf.saxon.expr.Expression

EVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD, locationId, staticProperties

Constructor Summary

GeneralComparison10(Expression p0, int op, Expression p1)
Create a general comparison identifying the two operands and the operator

Method Summary

int
computeCardinality()
Determine the static cardinality.
Expression
copy()
Copy an expression.
protected String
displayOperator()
boolean
effectiveBooleanValue(XPathContext context)
Evaluate the expression in a boolean context
Item
evaluateItem(XPathContext context)
Evaluate the expression in a given context
ItemType
getItemType(TypeHierarchy th)
Determine the data type of the expression
Expression
optimize(ExpressionVisitor visitor, ItemType contextItemType)
Optimize the expression
Expression
typeCheck(ExpressionVisitor visitor, ItemType contextItemType)
Type-check the expression

Methods inherited from class net.sf.saxon.expr.BinaryExpression

computeCardinality, computeSpecialProperties, displayOperator, equals, explain, getOperands, getOperator, hashCode, isAssociative, isCommutative, isInverse, iterateSubExpressions, optimize, promote, replaceSubExpression, setFlattened, simplify, toString, typeCheck

Methods inherited from class net.sf.saxon.expr.Expression

addToPathMap, adoptChildExpression, checkPermittedContents, computeCardinality, computeDependencies, computeSpecialProperties, computeStaticProperties, copy, display, doPromotion, dynamicError, effectiveBooleanValue, evaluateAsString, evaluateItem, explain, explain, findParentOf, getCardinality, getColumnNumber, getConstructType, getContainer, getDependencies, getExecutable, getHostLanguage, getImplementationMethod, getInstructionInfo, getIntrinsicDependencies, getItemType, getLineNumber, getLocationId, getLocationProvider, getPublicId, getSlotsUsed, getSpecialProperties, getSystemId, hasLoopingSubexpression, implementsStaticTypeCheck, iterate, iterateEvents, iterateSubExpressions, markTailFunctionCalls, optimize, process, promote, replaceSubExpression, resetLocalStaticProperties, setContainer, setFiltered, setFlattened, setLocationId, simplify, staticTypeCheck, suppressValidation, toString, typeCheck, typeError

Field Details

comparer

protected AtomicComparer comparer

singletonOperator

protected int singletonOperator

Constructor Details

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 operand
op - the operator, as a token returned by the Tokenizer (e.g. Token.LT)
p1 - the right-hand operand

Method Details

computeCardinality

public int computeCardinality()
Determine the static cardinality. Returns [1..1]
Overrides:
computeCardinality in interface BinaryExpression

copy

public Expression copy()
Copy an expression. This makes a deep copy.
Overrides:
copy in interface Expression
Returns:
the copy of the original expression

displayOperator

protected String displayOperator()
Overrides:
displayOperator in interface BinaryExpression

effectiveBooleanValue

public boolean effectiveBooleanValue(XPathContext context)
            throws XPathException
Evaluate the expression in a boolean context
Overrides:
effectiveBooleanValue in interface Expression
Parameters:
context - the given context for evaluation
Returns:
a boolean representing the result of the numeric comparison of the two operands

evaluateItem

public Item evaluateItem(XPathContext context)
            throws XPathException
Evaluate the expression in a given context
Specified by:
evaluateItem in interface EvaluableItem
Overrides:
evaluateItem in interface Expression
Parameters:
context - the given context for evaluation
Returns:
a BooleanValue representing the result of the numeric comparison of the two operands

getItemType

public ItemType getItemType(TypeHierarchy th)
Determine the data type of the expression
Overrides:
getItemType in interface Expression
Parameters:
th - the type hierarchy cache
Returns:
Type.BOOLEAN

optimize

public Expression optimize(ExpressionVisitor visitor,
                           ItemType contextItemType)
            throws XPathException
Optimize the expression
Overrides:
optimize in interface BinaryExpression
Returns:
the checked expression

typeCheck

public Expression typeCheck(ExpressionVisitor visitor,
                            ItemType contextItemType)
            throws XPathException
Type-check the expression
Overrides:
typeCheck in interface BinaryExpression
Returns:
the checked expression