|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.saxon.expr.Expression net.sf.saxon.expr.BinaryExpression com.saxonica.expr.EquivalenceComparison
public class EquivalenceComparison
Class to handle equivalence comparisons of singletons. This only handles equality comparison. It follows the rules used for grouping and for XQuery 1.1 switch expressions: - each operand must be zero or one atomic values - untypedAtomic is treated as string - non-comparable values are not equal (no type errors) - two empty sequences are equal to each other - two NaN values are equal to each other
Field Summary |
---|
Fields inherited from class net.sf.saxon.expr.BinaryExpression |
---|
operand0, operand1, operator |
Fields inherited from class net.sf.saxon.expr.Expression |
---|
EVALUATE_METHOD, EVENT_FEED_METHOD, ITEM_FEED_METHOD, ITERATE_METHOD, locationId, PROCESS_METHOD, PUSH_SELECTION, staticProperties, WATCH_METHOD |
Constructor Summary | |
---|---|
EquivalenceComparison(Expression p1,
int operator,
Expression p2)
Create a singleton comparison - that is, a comparison between two singleton (0:1) sequences using the general comparison semantics |
Method Summary | |
---|---|
int |
computeCardinality()
Determine the static cardinality. |
boolean |
convertsUntypedToOther()
Determine whether untyped atomic values should be converted to the type of the other operand |
Expression |
copy()
Copy an expression. |
boolean |
effectiveBooleanValue(XPathContext context)
Evaluate the expression in a boolean context |
Item |
evaluateItem(XPathContext context)
Evaluate the expression in a given context |
protected void |
explainExtraAttributes(ExpressionPresenter out)
Add subclass-specific attributes to the expression tree explanation. |
AtomicComparer |
getAtomicComparer()
Get the AtomicComparer used to compare atomic values. |
ItemType |
getItemType(TypeHierarchy th)
Determine the data type of the expression |
int |
getSingletonOperator()
Get the primitive (singleton) operator used: one of Token.FEQ, Token.FNE, Token.FLT, Token.FGT, Token.FLE, Token.FGE |
Expression |
typeCheck(ExpressionVisitor visitor,
ItemType contextItemType)
Type-check the expression. |
Methods inherited from class net.sf.saxon.expr.BinaryExpression |
---|
computeSpecialProperties, displayOperator, equals, explain, getOperands, getOperator, hashCode, isAssociative, isCommutative, isInverse, iterateSubExpressions, optimize, promote, replaceSubExpression, setFlattened, simplify, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface net.sf.saxon.expr.ComparisonExpression |
---|
getOperands |
Constructor Detail |
---|
public EquivalenceComparison(Expression p1, int operator, Expression p2)
p1
- the first operandoperator
- the operatorp2
- the second operandMethod Detail |
---|
public Expression typeCheck(ExpressionVisitor visitor, ItemType contextItemType) throws XPathException
typeCheck
in class BinaryExpression
visitor
- an expression visitorcontextItemType
- 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 to
Type.ITEM_TYPE
XPathException
- if an error is discovered during this phase
(typically a type error)public AtomicComparer getAtomicComparer()
ComparisonExpression
getAtomicComparer
in interface ComparisonExpression
public int getSingletonOperator()
ComparisonExpression
getSingletonOperator
in interface ComparisonExpression
public boolean convertsUntypedToOther()
convertsUntypedToOther
in interface ComparisonExpression
public int computeCardinality()
computeCardinality
in class BinaryExpression
StaticProperty.ALLOWS_ZERO_OR_ONE
,
StaticProperty.EXACTLY_ONE
, StaticProperty.ALLOWS_ONE_OR_MORE
,
StaticProperty.ALLOWS_ZERO_OR_MORE
public ItemType getItemType(TypeHierarchy th)
getItemType
in class Expression
th
- the type hierarchy cache
public Expression copy()
copy
in class Expression
public Item evaluateItem(XPathContext context) throws XPathException
evaluateItem
in interface EvaluableItem
evaluateItem
in class Expression
context
- the given context for evaluation
XPathException
- if any dynamic error occurs evaluating the
expressionpublic boolean effectiveBooleanValue(XPathContext context) throws XPathException
effectiveBooleanValue
in class Expression
context
- the given context for evaluation
XPathException
- if any dynamic error occurs evaluating the
expressionprotected void explainExtraAttributes(ExpressionPresenter out)
BinaryExpression
explainExtraAttributes
in class BinaryExpression
out
- the output destination for the displayed expression tree
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |