Package net.sf.saxon.expr

## Class SingletonIntersectExpression

- java.lang.Object
- - net.sf.saxon.expr.Expression
  - - net.sf.saxon.expr.BinaryExpression
    - - net.sf.saxon.expr.VennExpression
      - - net.sf.saxon.expr.SingletonIntersectExpression

- All Implemented Interfaces:
    `ExportAgent`, `Locatable`, `IdentityComparable`, `Traceable`

      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.

- - ### Field Summary

    - ### Fields inherited from class net.sf.saxon.expr.BinaryExpression

      `operator`

    - ### Fields inherited from class net.sf.saxon.expr.Expression

      `EFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, ITEM_FEED_METHOD, ITERATE_METHOD, MAX_COST, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, PROCESS_METHOD, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, UPDATE_METHOD, WATCH_METHOD`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `SingletonIntersectExpression​(Expression p1, int op, Expression p2)` | Special case of an intersect expression where the first argument is a singleton

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static boolean` | `containsNode​(SequenceIterator iter, NodeInfo m)` | Ask whether the sequence supplied in the first argument contains the node supplied in the second
    `Expression` | `copy​(RebindingMap rebindings)` | Copy an expression.
    `protected java.lang.String` | `displayOperator()` | Display the operator used by this binary expression
    `boolean` | `effectiveBooleanValue​(XPathContext c)` | Get the effective boolean value.
    `java.lang.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.
    `Expression` | `optimize​(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType)` | Perform optimisation of an expression and its subexpressions.
    `Expression` | `simplify()` | Simplify the expression
    `protected java.lang.String` | `tag()` | Get the element name used to identify this expression in exported expression format

    - ### Methods inherited from class net.sf.saxon.expr.VennExpression

      `computeCardinality, computeHashCode, computeSpecialProperties, equals, gatherComponents, getImplementationMethod, getItemType, getOperandRole, getStaticUType, getStreamerName, toPattern, typeCheck, unordered`

    - ### Methods inherited from class net.sf.saxon.expr.BinaryExpression

      `explainExtraAttributes, export, getLhs, getLhsExpression, getOperator, getRhs, getRhsExpression, isAssociative, isCommutative, isInverse, operands, setFlattened, setLhsExpression, setRhsExpression, toShortString, toString`

    - ### Methods inherited from class net.sf.saxon.expr.Expression

      `addToPathMap, adoptChildExpression, allowExtractingCommonSubexpressions, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeStaticProperties, dynamicError, evaluateAsString, evaluateItem, evaluatePendingUpdates, explain, getCardinality, getConfiguration, getCost, getDependencies, getEvaluationMethod, getExtraProperty, getIntegerBounds, getInterpretedExpression, getIntrinsicDependencies, getLocalRetainedStaticContext, getLocation, getNetCost, getObjectName, getPackageData, getParentExpression, getProperties, getProperty, getRetainedStaticContext, getScopingExpression, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStaticType, getTracingTag, hasCompatibleStaticContext, hashCode, hasSpecialProperty, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isCallOn, isEqual, isIdentical, isInstruction, isLiftable, isMultiThreaded, isStaticPropertiesKnown, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, markTailFunctionCalls, operandList, operandSparseList, optimizeChildren, prepareForStreaming, process, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setExtraProperty, setFiltered, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplifyChildren, staticTypeCheck, suppressValidation, typeCheckChildren, typeError, verifyParentPointers`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface net.sf.saxon.trace.Traceable

      `gatherProperties`

- - ### 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

    - #### simplify

          public Expression simplify()
                              throws XPathException

      Simplify the expression
      Overrides:
        `simplify` in class `VennExpression`
      Returns:
        the simplified expression (or the original if unchanged, or if modified in-situ)
      Throws:
        `XPathException` - if an error is discovered during expression rewriting

    - #### optimize

          public Expression optimize​(ExpressionVisitor visitor,
                                     ContextItemStaticInfo contextItemType)
                              throws XPathException

      Perform optimisation of an expression and its subexpressions.

      This method is called after all references to functions and variables have been resolved to the declaration of the function or variable, and after all type checking has been done.

      Overrides:
        `optimize` in class `VennExpression`
      Parameters:
        `visitor` - an expression visitor
        `contextItemType` - 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`
      Returns:
        the original expression, rewritten if appropriate to optimize execution
      Throws:
        `XPathException` - if an error is discovered during this phase (typically a type error)

    - #### copy

          public Expression copy​(RebindingMap rebindings)

      Copy an expression. This makes a deep copy.
      Overrides:
        `copy` in class `VennExpression`
      Parameters:
        `rebindings` -
      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

    - #### containsNode

          public static boolean containsNode​(SequenceIterator iter,
                                             NodeInfo m)
                                      throws XPathException

      Ask whether the sequence supplied in the first argument contains the node supplied in the second
      Parameters:
        `iter` - an iterator over nodes. The iterator will be closed if the node is found.
        `m` - the node to be tested
      Returns:
        true if (and only if) the sequence contains the node
      Throws:
        `XPathException` - if evaluating the iterator fails

    - #### getExpressionName

          public java.lang.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 java.lang.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)

    - #### tag

          protected java.lang.String tag()

      Get the element name used to identify this expression in exported expression format
      Overrides:
        `tag` in class `VennExpression`
      Returns:
        the element name used to identify this expression