Package com.saxonica.ee.stream.watch

## Class StreamWatch

- java.lang.Object
- - com.saxonica.ee.stream.watch.AbstractWatch
  - - com.saxonica.ee.stream.watch.StreamWatch

- All Implemented Interfaces:
    `Watch`

      public class StreamWatch
      extends AbstractWatch

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `StreamWatch​(Inversion action, WatchManager watchManager, XPathContext context)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `endSelectedParentNode​(Location locationId)` | Signal that the endElement event has occurred for the element whose startElement event caused the Watch to be activated.
    `FleetingParentNode` | `getAnchorNode()` | Get the anchor node for the watch.
    `boolean` | `matchesNode​(FleetingNode node, XPathContext context)` | Determine whether the watch matches a given node
    `boolean` | `matchesNodesOfKind​(UType kind)` | Ask whether the Watch is capable of matching nodes of a particular kind
    `void` | `setAnchorNode​(FleetingParentNode anchor)` | Set the anchor node for the watch.
    `Receiver` | `startSelectedParentNode​(FleetingParentNode node, Location locationId)` | Signal that an element or document node has been found that matches the selection that this Watch is looking for.

    - ### Methods inherited from class com.saxonica.ee.stream.watch.AbstractWatch

      `close, getNamespaceResolver, getPipelineConfiguration, open, processItem, setNamespaceResolver, setPipelineConfiguration`

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

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

- - ### Constructor Detail

    - #### StreamWatch

          public StreamWatch​(Inversion action,
                             WatchManager watchManager,
                             XPathContext context)

  - ### Method Detail

    - #### matchesNode

          public boolean matchesNode​(FleetingNode node,
                                     XPathContext context)
                              throws XPathException

      Determine whether the watch matches a given node
      Parameters:
        `node` - the node to be tested
        `context` - the XPath dynamic context
      Returns:
        true if the node is one of those the Watch is looking out for
      Throws:
        `XPathException` - if a dynamic error occurs

    - #### matchesNodesOfKind

          public boolean matchesNodesOfKind​(UType kind)

      Ask whether the Watch is capable of matching nodes of a particular kind
      Parameters:
        `kind` - the node kind
      Returns:
        true if the watch is capabl of matching

    - #### setAnchorNode

          public void setAnchorNode​(FleetingParentNode anchor)

      Set the anchor node for the watch. This is the node to which the watch is scoped, typically the context node for the streamable path expression that defines the root of the subtree within which nodes are being sought.
      Parameters:
        `anchor` - The anchor node within which the watch is scoped

    - #### getAnchorNode

          public FleetingParentNode getAnchorNode()

      Get the anchor node for the watch. This is the node to which the watch is scoped, typically the context node for the streamable path expression that defines the root of the subtree within which nodes are being sought.
      Returns:
        The anchor node within which the watch is scoped

    - #### startSelectedParentNode

          public Receiver startSelectedParentNode​(FleetingParentNode node,
                                                  Location locationId)
                                           throws XPathException

      Signal that an element or document node has been found that matches the selection that this Watch is looking for. This method is called by the WatchManager while processing the startElement or startDocument event that matches the selection.
      Parameters:
        `node` - the element or document node whose start event has been matched
        `locationId` - the location associated with the element or document node (may be the location of the instruction that created it)
      Returns:
        a Receiver to be notified of all events starting with the startElement/startDocument event for the matched element, and ending with the endElement event for that element; or null if this feature is not required.
      Throws:
        `XPathException` - May be raised if a dynamic error occurs

    - #### endSelectedParentNode

          public void endSelectedParentNode​(Location locationId)
                                     throws XPathException

      Signal that the endElement event has occurred for the element whose startElement event caused the Watch to be activated.
      Parameters:
        `locationId` - the location of the element
      Throws:
        `XPathException` - May be raised if a constraint implemented by this Watch is violated