com.saxonica.expr

## Class OuterForExpression

- java.lang.Object
- - net.sf.saxon.expr.Expression
  - - net.sf.saxon.expr.Assignation
    - - net.sf.saxon.expr.ForExpression
      - - com.saxonica.expr.OuterForExpression

- All Implemented Interfaces:
    Serializable, SourceLocator, LocationProvider, SaxonLocator, Binding, InstructionInfo, Locator

      public class OuterForExpression
      extends ForExpression

  Expression class that implements the "outer for" clause of XQuery 1.1
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class net.sf.saxon.expr.ForExpression

      `ForExpression.EventMappingAction, ForExpression.MappingAction`

  - ### Field Summary

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

      `positionVariable`

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

      `action, requiredType, sequence, slotNumber, variableName`

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

      `EFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, EVENT_FEED_METHOD, INHERITED_CONTEXT, INSPECTION_CONTEXT, ITEM_FEED_METHOD, ITERATE_METHOD, locationId, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, NAVIGATION_CONTEXT, NODE_VALUE_CONTEXT, PROCESS_METHOD, PUSH_SELECTION, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, W3C_CONSUMING, W3C_FREE_RANGING, W3C_GROUP_CONSUMING, W3C_MOTIONLESS, WATCH_METHOD`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `OuterForExpression()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Expression` | `copy()` Copy an expression.
    `void` | `evaluatePendingUpdates(XPathContext context, PendingUpdateList pul)` Evaluate an updating expression, adding the results to a Pending Update List.
    `protected void` | `explainSpecializedAttributes(ExpressionPresenter out)`
    `ExpressionCompiler` | `getExpressionCompiler()` Return the compiler of the OuterFor expression
    `protected int` | `getRangeVariableCardinality()` Get the cardinality of the range variable
    `SequenceIterator` | `iterate(XPathContext context)` Iterate over the result of the expression
    `EventIterator` | `iterateEvents(XPathContext context)` Deliver the result of the expression as a sequence of events.
    `Expression` | `optimize(ExpressionVisitor visitor, ExpressionVisitor.ContextItemType contextItemType)` Optimize the expression
    `void` | `process(XPathContext context)` Process this expression as an instruction, writing results to the current outputter

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

      `checkPermittedContents, computeCardinality, explain, extendBindingList, getConstructType, getExpressionName, getImplementationMethod, getIntegerBounds, getItemType, getPositionVariable, getPositionVariableName, getRequiredSlots, getStreamability, hasVariableBinding, isVacuousExpression, markTailFunctionCalls, promoteWhereClause, setPositionVariable, setSlotNumber, toString, typeCheck`

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

      `addReference, addToPathMap, checkForUpdatingSubexpressions, evaluateVariable, getAction, getIntegerBoundsForVariable, getLocalSlotNumber, getNominalReferenceCount, getObjectName, getRequiredType, getSequence, getVariableEQName, getVariableName, getVariableQName, isAssignable, isGlobal, isIndexedVariable, isUpdatingExpression, iterateSubExpressionInfo, iterateSubExpressions, promote, refineTypeInformation, replaceSubExpression, replaceVariable, setAction, setIndexedVariable, setRequiredType, setSequence, setVariableQName, simplify, suppressValidation`

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

      `adoptChildExpression, computeDependencies, computeSpecialProperties, computeStaticProperties, doPromotion, dynamicError, effectiveBooleanValue, evaluateAsString, evaluateItem, explain, getCardinality, getColumnNumber, getColumnNumber, getContainer, getDependencies, getEvaluationMethod, getExecutable, getHostLanguage, getIntrinsicDependencies, getLineNumber, getLineNumber, getLocationId, getLocationProvider, getProperties, getProperty, getPublicId, getSlotsUsed, getSpecialProperties, getStreamingAdjunct, getSystemId, getSystemId, implementsStaticTypeCheck, isSubtreeExpression, resetLocalStaticProperties, setContainer, setEvaluationMethod, setFiltered, setFlattened, setLocationId, staticTypeCheck, toPattern, toStreamingPattern, typeError`

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

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

- - ### Constructor Detail

    - #### OuterForExpression

          public OuterForExpression()

  - ### Method Detail

    - #### getRangeVariableCardinality

          protected int getRangeVariableCardinality()

      Get the cardinality of the range variable
      Overrides:
        `getRangeVariableCardinality` in class `ForExpression`
      Returns:
        the cardinality of the range variable (StaticProperty.EXACTLY_ONE). in a subclass

    - #### optimize

          public Expression optimize(ExpressionVisitor visitor,
                            ExpressionVisitor.ContextItemType contextItemType)
                              throws XPathException

      Optimize the expression
      Overrides:
        `optimize` in class `ForExpression`
      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()

      Copy an expression. This makes a deep copy.
      Overrides:
        `copy` in class `ForExpression`
      Returns:
        the copy of the original expression

    - #### iterate

          public SequenceIterator iterate(XPathContext context)
                                   throws XPathException

      Iterate over the result of the expression
      Overrides:
        `iterate` in class `ForExpression`
      Parameters:
        `context` - supplies the context for evaluation
      Returns:
        a SequenceIterator that can be used to iterate over the result of the expression
      Throws:
        `XPathException` - if any dynamic error occurs evaluating the expression

    - #### iterateEvents

          public EventIterator iterateEvents(XPathContext context)
                                      throws XPathException

      Deliver the result of the expression as a sequence of events.
      Overrides:
        `iterateEvents` in class `ForExpression`
      Parameters:
        `context` - The dynamic evaluation context
      Returns:
        the result of the expression as an iterator over a sequence of PullEvent objects
      Throws:
        `XPathException` - if a dynamic error occurs during expression evaluation

    - #### process

          public void process(XPathContext context)
                       throws XPathException

      Process this expression as an instruction, writing results to the current outputter
      Overrides:
        `process` in class `ForExpression`
      Parameters:
        `context` - The dynamic context, giving access to the current node, the current variables, etc.
      Throws:
        `XPathException` - if a dynamic error occurs

    - #### evaluatePendingUpdates

          public void evaluatePendingUpdates(XPathContext context,
                                    PendingUpdateList pul)
                                      throws XPathException

      Evaluate an updating expression, adding the results to a Pending Update List. The default implementation of this method, which is used for non-updating expressions, throws an UnsupportedOperationException
      Overrides:
        `evaluatePendingUpdates` in class `ForExpression`
      Parameters:
        `context` - the XPath dynamic evaluation context
        `pul` - the pending update list to which the results should be written
      Throws:
        `XPathException` - if evaluation fails

    - #### getExpressionCompiler

          public ExpressionCompiler getExpressionCompiler()

      Return the compiler of the OuterFor expression
      Overrides:
        `getExpressionCompiler` in class `ForExpression`
      Returns:
        the relevant ExpressionCompiler

    - #### explainSpecializedAttributes

          protected void explainSpecializedAttributes(ExpressionPresenter out)

      Overrides:
        `explainSpecializedAttributes` in class `ForExpression`

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