org.exist.xquery
Class ValueComparison

java.lang.Object
  extended by org.exist.xquery.AbstractExpression
      extended by org.exist.xquery.PathExpr
          extended by org.exist.xquery.BinaryOp
              extended by org.exist.xquery.GeneralComparison
                  extended by org.exist.xquery.ValueComparison
All Implemented Interfaces:
CompiledXQuery, Expression, IndexUseReporter, Optimizable, RewritableExpression, org.xmldb.api.base.CompiledExpression

public class ValueComparison
extends GeneralComparison


Nested Class Summary
 
Nested classes/interfaces inherited from class org.exist.xquery.GeneralComparison
GeneralComparison.IndexFlags
 
Field Summary
 
Fields inherited from class org.exist.xquery.GeneralComparison
cached, collationArg, invalidNodeEvaluation, inWhereClause, optimizeChild, optimizeSelf, relation, rightOpDeps, truncation
 
Fields inherited from class org.exist.xquery.PathExpr
inPredicate, keepVirtual, LOG, parent, staticContext, steps
 
Fields inherited from class org.exist.xquery.AbstractExpression
column, context, contextDocSet, contextId, line, unordered
 
Fields inherited from interface org.exist.xquery.Expression
DOT_TEST, EXPRESSION_ID_INVALID, IGNORE_CONTEXT, IN_NODE_CONSTRUCTOR, IN_PREDICATE, IN_UPDATE, IN_WHERE_CLAUSE, NEED_INDEX_INFO, NO_CONTEXT_ID, NON_STREAMABLE, POSITIONAL_PREDICATE, SINGLE_STEP_EXECUTION, UNORDERED, USE_TREE_TRAVERSAL
 
Constructor Summary
ValueComparison(XQueryContext context, Expression left, Expression right, int relation)
           
ValueComparison(XQueryContext context, int relation)
           
 
Method Summary
static boolean compareAtomic(java.text.Collator collator, AtomicValue lv, AtomicValue rv, int truncation, int relation)
          Cast the atomic operands into a comparable type and compare them.
 void dump(ExpressionDumper dumper)
          Write a diagnostic dump of the expression to the passed ExpressionDumper.
protected  Sequence genericCompare(Sequence contextSequence, Item contextItem)
          Generic, slow implementation.
protected  Sequence nodeSetCompare(NodeSet nodes, Sequence contextSequence)
          Optimized implementation, which can be applied if the left operand returns a node set.
 java.lang.String toString()
           
 
Methods inherited from class org.exist.xquery.GeneralComparison
accept, analyze, canOptimize, checkForQNameIndex, eval, genericCompare, getCollator, getDependencies, getOptimizeAxis, getRelation, hasUsedIndex, optimizeOnChild, optimizeOnSelf, preSelect, quickNodeSetCompare, resetState, returnsType, setCollation, simplifyOperands, switchOperands
 
Methods inherited from class org.exist.xquery.BinaryOp
getLeft, getRight, setContextDocSet, setLeft, setRight, simplify
 
Methods inherited from class org.exist.xquery.PathExpr
add, add, addPath, addPredicate, allowMixNodesInReturn, dump, getCardinality, getColumn, getContext, getDocumentSet, getExpression, getLastExpression, getLength, getLine, getLiteralValue, getParent, getPrimaryAxis, getSubExpression, getSubExpressionCount, isValid, replaceExpression, replaceLastExpression, reset, setContext, setPrimaryAxis, setUseStaticContext
 
Methods inherited from class org.exist.xquery.AbstractExpression
eval, getContextDocSet, getContextId, getExpressionId, getSource, match, needsReset, setASTNode, setContextId, setLocation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.exist.xquery.Expression
allowMixNodesInReturn, eval, getCardinality, getColumn, getContext, getContextDocSet, getContextId, getExpressionId, getLine, getParent, getPrimaryAxis, getSource, getSubExpression, getSubExpressionCount, match, needsReset, setASTNode, setContextDocSet, setContextId, setLocation, setPrimaryAxis, simplify
 
Methods inherited from interface org.exist.xquery.CompiledXQuery
eval, getSource
 

Constructor Detail

ValueComparison

public ValueComparison(XQueryContext context,
                       int relation)
Parameters:
context -
relation -

ValueComparison

public ValueComparison(XQueryContext context,
                       Expression left,
                       Expression right,
                       int relation)
Parameters:
context -
left -
right -
relation -
Method Detail

genericCompare

protected Sequence genericCompare(Sequence contextSequence,
                                  Item contextItem)
                           throws XPathException
Description copied from class: GeneralComparison
Generic, slow implementation. Applied if none of the possible optimizations can be used.

Overrides:
genericCompare in class GeneralComparison
Returns:
The Sequence resulting from the comparison
Throws:
XPathException

nodeSetCompare

protected Sequence nodeSetCompare(NodeSet nodes,
                                  Sequence contextSequence)
                           throws XPathException
Description copied from class: GeneralComparison
Optimized implementation, which can be applied if the left operand returns a node set. In this case, the left expression is executed first. All matching context nodes are then passed to the right expression.

Overrides:
nodeSetCompare in class GeneralComparison
Parameters:
nodes - DOCUMENT ME!
contextSequence - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
XPathException - DOCUMENT ME!

compareAtomic

public static boolean compareAtomic(java.text.Collator collator,
                                    AtomicValue lv,
                                    AtomicValue rv,
                                    int truncation,
                                    int relation)
                             throws XPathException
Cast the atomic operands into a comparable type and compare them.

Throws:
XPathException

dump

public void dump(ExpressionDumper dumper)
Description copied from interface: Expression
Write a diagnostic dump of the expression to the passed ExpressionDumper.

Specified by:
dump in interface Expression
Overrides:
dump in class GeneralComparison
Parameters:
dumper - the expression dumper to write to

toString

public java.lang.String toString()
Overrides:
toString in class GeneralComparison