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
protected static booleancompare(AtomicValue a0, int operator, AtomicValue a1, AtomicComparer comparer, XPathContext context)
Compare two atomic values
intcomputeCardinality()
Determine the static cardinality.
protected StringdisplayOperator()
booleaneffectiveBooleanValue(XPathContext context)
Evaluate the expression in a boolean context
ItemevaluateItem(XPathContext context)
Evaluate the expression in a given context
ItemTypegetItemType(TypeHierarchy th)
Determine the data type of the expression
Expressionoptimize(Optimizer opt, StaticContext env, ItemType contextItemType)
Optimize the expression
ExpressiontypeCheck(StaticContext env, 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

compare

protected static boolean compare(AtomicValue a0, int operator, AtomicValue a1, AtomicComparer comparer, XPathContext context)
Compare two atomic values

computeCardinality

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

displayOperator

protected String displayOperator()

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

getItemType

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

Parameters: th

Returns: Type.BOOLEAN

optimize

public Expression optimize(Optimizer opt, StaticContext env, ItemType contextItemType)
Optimize the expression

Returns: the checked expression

typeCheck

public Expression typeCheck(StaticContext env, ItemType contextItemType)
Type-check the expression

Returns: the checked expression