Package com.saxonica.ee.stream.adjunct

## Class SwitchAdjunct

- java.lang.Object
- - com.saxonica.ee.stream.adjunct.StreamingAdjunct
  - - com.saxonica.ee.stream.adjunct.TransmissionAdjunct
    - - com.saxonica.ee.stream.adjunct.SwitchAdjunct

- All Implemented Interfaces:
    `FeedMaker`

      public class SwitchAdjunct
      extends TransmissionAdjunct

  Streaming code to implement a switch expression, which results from optimizing a choose where all the branches have similar test conditions. Unlike a choose, the conditions cannot be consuming: this is because the conditions must be similar, and if one is consuming then several will be consuming.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `SwitchAdjunct()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `WatchMaker` | `getWatchMaker​(boolean forGrouping)` | Get a WatchMaker, a factory class that creates a Watch to evaluate this expression in streaming mode.
    `ItemFeed` | `makeItemFeed​(WatchManager watchManager, ItemFeed out, XPathContext context)` |
    `Trigger` | `makeTransmissionFlow​(WatchManager watchManager, Expression exp, ItemFeed out, XPathContext context)` | Make a Trigger that implements this expression in streaming mode.
    `void` | `setExpression​(Expression expression)` | Set the expression being processed by this StreamingAdjunct

    - ### Methods inherited from class com.saxonica.ee.stream.adjunct.StreamingAdjunct

      `computeStreamability, findConsumingArg, getConfiguration, getDefaultFeedMaker, getExpression, getFeedMaker, makeStreamingAdjunct, setConfiguration, toStreamingPattern`

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

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

- - ### Constructor Detail

    - #### SwitchAdjunct

          public SwitchAdjunct()

  - ### Method Detail

    - #### setExpression

          public void setExpression​(Expression expression)

      Description copied from class: `StreamingAdjunct`
      Set the expression being processed by this StreamingAdjunct
      Overrides:
        `setExpression` in class `StreamingAdjunct`
      Parameters:
        `expression` - the expression being processed

    - #### getWatchMaker

          public WatchMaker getWatchMaker​(boolean forGrouping)
                                   throws XPathException

      Description copied from class: `StreamingAdjunct`
      Get a WatchMaker, a factory class that creates a Watch to evaluate this expression in streaming mode. This method will only be called if the getImplementationMethod() method of the expression includes the value `Expression.WATCH_METHOD`
      Overrides:
        `getWatchMaker` in class `TransmissionAdjunct`
      Parameters:
        `forGrouping` - true if the selected items are being grouped
      Returns:
        a Watchmaker to evaluate the expression, or null if it is not streamable with respect to the specificed argument.
      Throws:
        `XPathException` - in the event of a failure

    - #### makeTransmissionFlow

          public Trigger makeTransmissionFlow​(WatchManager watchManager,
                                              Expression exp,
                                              ItemFeed out,
                                              XPathContext context)
                                       throws XPathException

      Description copied from class: `TransmissionAdjunct`
      Make a Trigger that implements this expression in streaming mode. This method is used for an expression that is striding or crawling, and it delivers a Trigger connected to a sequence of Feeds which together have the effect of delivering a sequence of events and/or items that together represent the results of this instruction. This method MUST be implemented for every expression that has an operand whose usage is transmission (and for every such operand).
      Overrides:
        `makeTransmissionFlow` in class `TransmissionAdjunct`
      Parameters:
        `watchManager` - the WatchManager that fires this trigger
        `exp` - the expression
        `out` - the next action in the push pipeline for evaluation
        `context` - the XPath dynamic context
      Returns:
        the Trigger (a Watch with a pattern)
      Throws:
        `XPathException` - if a dynamic evaluation error occurs.

    - #### makeItemFeed

          public ItemFeed makeItemFeed​(WatchManager watchManager,
                                       ItemFeed out,
                                       XPathContext context)
                                throws XPathException

      Throws:
        `XPathException`