net.sf.saxon.expr

Class SingletonComparison

public class SingletonComparison extends BinaryExpression

Class to handle comparisons of singletons. Unlike ValueComparison, this class converts untyped atomic values to the type of the other argument, and returns false (rather than ()) if either operand is ().
Constructor Summary
SingletonComparison(Expression p1, int operator, Expression p2)
Method Summary
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
voidsetComparator(Comparator comp, XPathContext context)

Constructor Detail

SingletonComparison

public SingletonComparison(Expression p1, int operator, Expression p2)

Method Detail

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

setComparator

public void setComparator(Comparator comp, XPathContext context)