net.sf.saxon.expr

## Class GroupVariableReference

- java.lang.Object
- - net.sf.saxon.expr.Expression
  - - net.sf.saxon.expr.VariableReference
    - - net.sf.saxon.expr.LocalVariableReference
      - - net.sf.saxon.expr.GroupVariableReference

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

      public class GroupVariableReference
      extends LocalVariableReference

  This is a variant of LocalVariableReference used when the variable in question represents the group bound by the bind-group attribute of xsl:for-each-group. It differs in that the streaming behavior is different
  See Also:
    Serialized Form

- - ### Field Summary

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

      `binding, constantValue, staticType`

    - ### 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
    `GroupVariableReference()`
    `GroupVariableReference(Binding binding)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `computeCardinality()` Get the static cardinality
    `int` | `computeSpecialProperties()` Determine the special properties of this expression.
    `Expression` | `copy()` Create a clone copy of this VariableReference
    `ForEachGroup` | `getControllingExpression()`
    `int` | `getStreamability(int syntacticContext, boolean allowExtensions, List<String> reasons)` Get the "sweep" of this expression as defined in the W3C streamability specifications.
    `GroupVariableReferenceAdjunct` | `getStreamingAdjunct()` Get a class that supports streamed evaluation of this expression
    `Expression` | `optimize(ExpressionVisitor visitor, ExpressionVisitor.ContextItemType contextItemType)` Type-check the expression.
    `void` | `setControllingExpression(ForEachGroup feg)`
    `Pattern` | `toStreamingPattern(Configuration config, List<String> reasonForFailure)` Convert this expression to a streaming pattern (a pattern used internally to match nodes during push processing of an event stream)

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

      `evaluateVariable, getExpressionCompiler, getSlotNumber, setSlotNumber`

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

      `addToPathMap, equals, evaluateItem, explain, fixup, getBinding, getDisplayName, getEQName, getImplementationMethod, getIntegerBounds, getIntrinsicDependencies, getItemType, hashCode, isFiltered, isFlattened, isInLoop, iterate, process, promote, refineVariableType, setFiltered, setFlattened, setStaticType, toString, typeCheck`

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

      `adoptChildExpression, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeStaticProperties, doPromotion, dynamicError, effectiveBooleanValue, evaluateAsString, evaluatePendingUpdates, explain, getCardinality, getColumnNumber, getColumnNumber, getConstructType, getContainer, getDependencies, getEvaluationMethod, getExecutable, getExpressionName, getHostLanguage, getLineNumber, getLineNumber, getLocationId, getLocationProvider, getObjectName, getProperties, getProperty, getPublicId, getSlotsUsed, getSpecialProperties, getSystemId, getSystemId, hasVariableBinding, implementsStaticTypeCheck, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, iterateEvents, iterateSubExpressionInfo, iterateSubExpressions, markTailFunctionCalls, replaceSubExpression, resetLocalStaticProperties, setContainer, setEvaluationMethod, setLocationId, simplify, staticTypeCheck, suppressValidation, toPattern, typeError`

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

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

- - ### Constructor Detail

    - #### GroupVariableReference

          public GroupVariableReference()

    - #### GroupVariableReference

          public GroupVariableReference(Binding binding)

  - ### Method Detail

    - #### optimize

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

      Description copied from class: `VariableReference`
      Type-check the expression. At this stage details of the static type must be known. If the variable has a compile-time value, this is substituted for the variable reference
      Overrides:
        `optimize` in class `VariableReference`
      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()

      Create a clone copy of this VariableReference
      Overrides:
        `copy` in class `LocalVariableReference`
      Returns:
        the cloned copy

    - #### setControllingExpression

          public void setControllingExpression(ForEachGroup feg)

    - #### getControllingExpression

          public ForEachGroup getControllingExpression()

    - #### computeSpecialProperties

          public int computeSpecialProperties()

      Determine the special properties of this expression. The properties such as document-ordering are the same as the properties of the grouping population as a whole.
      Overrides:
        `computeSpecialProperties` in class `VariableReference`
      Returns:
        `StaticProperty.NON_CREATIVE` (unless the variable is assignable using saxon:assign)

    - #### computeCardinality

          public int computeCardinality()

      Get the static cardinality
      Overrides:
        `computeCardinality` in class `VariableReference`
      Returns:
        the computed cardinality, as one of the values `StaticProperty.ALLOWS_ZERO_OR_ONE`, `StaticProperty.EXACTLY_ONE`, `StaticProperty.ALLOWS_ONE_OR_MORE`, `StaticProperty.ALLOWS_ZERO_OR_MORE`

    - #### getStreamability

          public int getStreamability(int syntacticContext,
                             boolean allowExtensions,
                             List<String> reasons)

      Description copied from class: `Expression`
      Get the "sweep" of this expression as defined in the W3C streamability specifications. This provides an assessment of stylesheet code against the W3C criteria for guaranteed streamability, and is implemented to allow these criteria to be tested. It is not the case that all expression that emerge as streamable from this analysis are currently capable of being streamed by Saxon
      Overrides:
        `getStreamability` in class `VariableReference`
      Parameters:
        `syntacticContext` - one of the values `Expression.NAVIGATION_CONTEXT`, `Expression.NODE_VALUE_CONTEXT`, `Expression.INHERITED_CONTEXT`, `Expression.INSPECTION_CONTEXT`
        `allowExtensions` - if false, the definition of "guaranteed streamability" in the W3C specification is used. If true, Saxon extensions are permitted, which make some
        `reasons` - the caller may supply a list, in which case the implementation may add to this list a message explaining why the construct is not streamable, suitable for inclusion in an error message.
      Returns:
        one of the values `Expression.W3C_MOTIONLESS`, `Expression.W3C_CONSUMING`, `Expression.W3C_GROUP_CONSUMING`, `Expression.W3C_FREE_RANGING`

    - #### getStreamingAdjunct

          public GroupVariableReferenceAdjunct getStreamingAdjunct()

      Get a class that supports streamed evaluation of this expression
      Overrides:
        `getStreamingAdjunct` in class `Expression`
      Returns:
        the relevant StreamingAdjunct, or null if none is available

    - #### toStreamingPattern

          public Pattern toStreamingPattern(Configuration config,
                                   List<String> reasonForFailure)

      Convert this expression to a streaming pattern (a pattern used internally to match nodes during push processing of an event stream)
      Overrides:
        `toStreamingPattern` in class `Expression`
      Parameters:
        `config` - the Saxon configuration
        `reasonForFailure` - a list which will be populated with messages giving reasons why the expression cannot be converted
      Returns:
        the equivalent pattern if conversion succeeds; otherwise null

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