net.sf.saxon.expr
Class SingletonIntersectExpression

java.lang.Object
  extended by net.sf.saxon.expr.Expression
      extended by net.sf.saxon.expr.BinaryExpression
          extended by net.sf.saxon.expr.VennExpression
              extended by net.sf.saxon.expr.SingletonIntersectExpression
All Implemented Interfaces:
Serializable, SourceLocator, LocationProvider, SaxonLocator, InstructionInfo, Locator

public class SingletonIntersectExpression
extends VennExpression

This expression is equivalent to (A intersect B) in the case where A has cardinality zero-or-one. This is handled as a special case because the standard sort-merge algorithm involves an unnecessary sort on B.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.sf.saxon.expr.BinaryExpression
operand0, operand1, operator
 
Fields inherited from class net.sf.saxon.expr.Expression
EFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, EVENT_FEED_METHOD, ITEM_FEED_METHOD, ITERATE_METHOD, locationId, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, PROCESS_METHOD, PUSH_SELECTION, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, WATCH_METHOD
 
Constructor Summary
SingletonIntersectExpression(Expression p1, int op, Expression p2)
          Special case of an intersect expression where the first argument is a singleton
 
Method Summary
 Expression copy()
          Copy an expression.
protected  String displayOperator()
          Display the operator used by this binary expression
 boolean effectiveBooleanValue(XPathContext c)
          Get the effective boolean value.
 String getExpressionName()
          Get a name identifying the kind of expression, in terms meaningful to a user.
 SequenceIterator iterate(XPathContext c)
          Iterate over the value of the expression.
 
Methods inherited from class net.sf.saxon.expr.VennExpression
computeCardinality, computeSpecialProperties, equals, gatherComponents, getItemType, hashCode, optimize, simplify, typeCheck
 
Methods inherited from class net.sf.saxon.expr.BinaryExpression
explain, explainExtraAttributes, getArguments, getOperands, getOperator, isAssociative, isCommutative, isInverse, iterateSubExpressions, promote, replaceSubExpression, setFlattened, toString
 
Methods inherited from class net.sf.saxon.expr.Expression
addToPathMap, adoptChildExpression, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeStaticProperties, doPromotion, dynamicError, evaluateAsString, evaluateItem, evaluatePendingUpdates, explain, getCardinality, getColumnNumber, getColumnNumber, getConstructType, getContainer, getDependencies, getEvaluationMethod, getExecutable, getHostLanguage, getImplementationMethod, getIntegerBounds, getIntrinsicDependencies, getLineNumber, getLineNumber, getLocationId, getLocationProvider, getObjectName, getProperties, getProperty, getPublicId, getSlotsUsed, getSpecialProperties, getSystemId, getSystemId, hasLoopingSubexpression, hasVariableBinding, implementsStaticTypeCheck, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, iterateEvents, iterateSameFocusSubExpressions, markTailFunctionCalls, process, resetLocalStaticProperties, setContainer, setEvaluationMethod, setFiltered, setLocationId, staticTypeCheck, suppressValidation, typeError
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SingletonIntersectExpression

public SingletonIntersectExpression(Expression p1,
                                    int op,
                                    Expression p2)
Special case of an intersect expression where the first argument is a singleton

Parameters:
p1 - the first argument, always a singleton
op - the operator, always Token.INTERSECT
p2 - the second argument
Method Detail

copy

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

Overrides:
copy in class VennExpression
Returns:
the copy of the original expression

iterate

public SequenceIterator iterate(XPathContext c)
                         throws XPathException
Iterate over the value of the expression. The result will always be sorted in document order, with duplicates eliminated

Overrides:
iterate in class VennExpression
Parameters:
c - The context for evaluation
Returns:
a SequenceIterator representing the union of the two operands
Throws:
XPathException - if any dynamic error occurs evaluating the expression

effectiveBooleanValue

public boolean effectiveBooleanValue(XPathContext c)
                              throws XPathException
Get the effective boolean value. In the case of a union expression, this is reduced to an OR expression, for efficiency

Overrides:
effectiveBooleanValue in class VennExpression
Parameters:
c - The context in which the expression is to be evaluated
Returns:
the effective boolean value
Throws:
XPathException - if any dynamic error occurs evaluating the expression

getExpressionName

public String getExpressionName()
Description copied from class: VennExpression
Get a name identifying the kind of expression, in terms meaningful to a user.

Overrides:
getExpressionName in class VennExpression
Returns:
a name identifying the kind of expression, in terms meaningful to a user. The name will always be in the form of a lexical XML QName, and should match the name used in explain() output displaying the expression.

displayOperator

protected String displayOperator()
Display the operator used by this binary expression

Overrides:
displayOperator in class BinaryExpression
Returns:
String representation of the operator (for diagnostic display only)


Copyright (c) 2004-2011 Saxonica Limited. All rights reserved.