com.saxonica.stream.watch

## Class GroupStartingWatch

- java.lang.Object
- - com.saxonica.validate.AbstractWatch
  - - com.saxonica.stream.watch.EventPushingWatch
    - - com.saxonica.stream.watch.GroupingWatch
      - - com.saxonica.stream.watch.GroupStartingWatch

- All Implemented Interfaces:
    Watch

      public class GroupStartingWatch
      extends GroupingWatch

  This class implements GroupingFeed when the group-starting-with option is used. It contains the logic to decide whether an item starts a new group, based on evaluating the group-starting-with pattern

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `GroupStartingWatch(GroupVariableReference expression, Feed out, Stack<XPathContext> contextStack)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected boolean` | `isStartOfNewGroup(boolean atStart, XPathContext context)` Determine whether the current item is the start of a new group
    `void` | `open()` Called at the start of the for-each-group instruction

    - ### Methods inherited from class com.saxonica.stream.watch.GroupingWatch

      `close, endSelectedParentNode, getControllingExpression, getLocalContext, setControllingExpression, setOuterFeed, setWatchManager, startSelectedParentNode`

    - ### Methods inherited from class com.saxonica.stream.watch.EventPushingWatch

      `getContext, getContextStack, getExpression, getParentExpressionFeed, getResult, setParentExpressionFeed`

    - ### Methods inherited from class com.saxonica.validate.AbstractWatch

      `getAnchorNode, getNamespaceResolver, getPipelineConfiguration, getSelection, notifySelectedLeafNode, setAnchorNode, setNamespaceResolver, setPipelineConfiguration, setSelection`

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

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

- - ### Constructor Detail

    - #### GroupStartingWatch

          public GroupStartingWatch(GroupVariableReference expression,
                            Feed out,
                            Stack<XPathContext> contextStack)

  - ### Method Detail

    - #### open

          public void open()
                    throws XPathException

      Called at the start of the for-each-group instruction
      Specified by:
        `open` in interface `Watch`
      Overrides:
        `open` in class `GroupingWatch`
      Throws:
        `XPathException`

    - #### isStartOfNewGroup

          protected boolean isStartOfNewGroup(boolean atStart,
                                  XPathContext context)
                                       throws XPathException

      Determine whether the current item is the start of a new group
      Specified by:
        `isStartOfNewGroup` in class `GroupingWatch`
      Parameters:
        `atStart` - true if this item is the first in the population
        `context` - the evaluation context. The item in question will be the context item
      Returns:
        true if this item is to be the first in a new group
      Throws:
        `XPathException` - if a dynamic error occurs

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