Class ChooseAdjunct

All Implemented Interfaces:
FeedMaker

public class ChooseAdjunct extends TransmissionAdjunct
Streaming code to implement a conditional ("if/choose") expression
  • Constructor Details

    • ChooseAdjunct

      public ChooseAdjunct()
  • Method Details

    • 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
    • getFeedMaker

      public FeedMaker getFeedMaker(int arg) throws XPathException
      Description copied from class: StreamingAdjunct
      Get a FeedMaker, a factory class that creates a Feed to evaluate this expression in streaming mode. In many cases the StreamingAdjunct is itself a FeedMaker, in which case it returns itself. But where an expression has several operands, it will typically create different feeds depending on which argument is the streamed input, and in such cases the individual StreamingAdjunct makes the decision which feed to use, by returning an appropriate FeedMaker.
      Overrides:
      getFeedMaker in class StreamingAdjunct
      Parameters:
      arg - identifies the argument with respect to which the expression is to be inverted: usually 0 to indicate the first argument is the value that is streamed. Argument numbering is the same as the sequence of arguments/operands returned by the method Expression.operands()
      Returns:
      a FeedMaker 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