net.sf.saxon.expr

Class GeneralComparison10

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 AtomicComparercomparer
protected intsingletonOperator
Constructor Summary
GeneralComparison10(Expression p0, int op, Expression p1)
Create a general comparison identifying the two operands and the operator
Method Summary
intcomputeCardinality()
Determine the static cardinality.
Expressioncopy()
Copy an expression.
booleaneffectiveBooleanValue(XPathContext context)
Evaluate the expression in a boolean context
ItemevaluateItem(XPathContext context)
Evaluate the expression in a given context
protected voidexplainExtraAttributes(ExpressionPresenter out)
ItemTypegetItemType(TypeHierarchy th)
Determine the data type of the expression
Expressionoptimize(ExpressionVisitor visitor, ItemType contextItemType)
Optimize the expression
ExpressiontypeCheck(ExpressionVisitor visitor, ItemType contextItemType)
Type-check the expression

Field Detail

comparer

protected AtomicComparer comparer

singletonOperator

protected int singletonOperator

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

Method Detail

computeCardinality

public int computeCardinality()
Determine the static cardinality. Returns [1..1]

copy

public Expression copy()
Copy an expression. This makes a deep copy.

Returns: the copy of the original expression

effectiveBooleanValue

public boolean effectiveBooleanValue(XPathContext context)
Evaluate the expression in a boolean context

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)
Evaluate the expression in a given context

Parameters: context the given context for evaluation

Returns: a BooleanValue representing the result of the numeric comparison of the two operands

explainExtraAttributes

protected void explainExtraAttributes(ExpressionPresenter out)

getItemType

public ItemType getItemType(TypeHierarchy th)
Determine the data type of the expression

Parameters: th the type hierarchy cache

Returns: Type.BOOLEAN

optimize

public Expression optimize(ExpressionVisitor visitor, ItemType contextItemType)
Optimize the expression

Returns: the checked expression

typeCheck

public Expression typeCheck(ExpressionVisitor visitor, ItemType contextItemType)
Type-check the expression

Returns: the checked expression