Interface PartialCollectEmitter<T,​I,​A,​R>

  • Type Parameters:
    T - the upstream value type
    I - the type that indicates where the first cached item should be read from
    A - the accumulator type used to collect up partial data
    R - the output type

    public interface PartialCollectEmitter<T,​I,​A,​R>
    Provides callbacks and methods to support the partial collect operator: access to cached elements, save and retrieve an input index and accumulator and produce the output instance.
    Since:
    0.18.9
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void cleanupItem​(T item)
      Call the cleanup handler of the operator for a specific upstream instance.
      void complete()
      Indicate that no further output items will be produced.
      long demand()
      Returns the number of items that can be emitted via next(Object) without overflowing the downstream.
      void dropItems​(int count)
      Remove the first count items from the cache, sending them to the cleanup handler of the operator as well as possibly triggering more requests to the upstream to replenish the buffer.
      A getAccumulator()
      Returns an optional, user-defined accumulator that can be used to aggregate partial items from upstream until enough data has been gathered.
      I getIndex()
      Reads an optional, user-defined index that can be used to store a read pointer into the very first upstream item accessible via getItem(int) to indicate from where to resume.
      T getItem​(int index)
      Access a cached item based on an index less than size().
      boolean isCancelled()
      The downstream requested cancellation.
      boolean isComplete()
      The upstream completed sending new items.
      void next​(R item)
      Signal the next output item.
      void setAccumulator​(A newAccumulator)
      Sets an optional, user-defined accumulator that can be used to aggregate partial items from upstream.
      void setIndex​(I newIndex)
      Sets an optional, user-defined index that can be used as a read poitner into the very first upstream item.
      int size()
      The number of items cached and accessible via getItem(int).
    • Method Detail

      • isCancelled

        boolean isCancelled()
        The downstream requested cancellation.
        Returns:
        true if the downstream cancelled
      • isComplete

        boolean isComplete()
        The upstream completed sending new items.
        Returns:
        true if the upstream completed
      • size

        int size()
        The number of items cached and accessible via getItem(int).
        Returns:
        the number of items cached
      • getItem

        T getItem​(int index)
        Access a cached item based on an index less than size().
        Parameters:
        index - the index
        Returns:
        the item
      • dropItems

        void dropItems​(int count)
        Remove the first count items from the cache, sending them to the cleanup handler of the operator as well as possibly triggering more requests to the upstream to replenish the buffer.
        Parameters:
        count - the number of items to drop
      • getIndex

        I getIndex()
        Reads an optional, user-defined index that can be used to store a read pointer into the very first upstream item accessible via getItem(int) to indicate from where to resume.
        Returns:
        the index object
      • setIndex

        void setIndex​(I newIndex)
        Sets an optional, user-defined index that can be used as a read poitner into the very first upstream item.
        Parameters:
        newIndex - the index object to set
      • getAccumulator

        A getAccumulator()
        Returns an optional, user-defined accumulator that can be used to aggregate partial items from upstream until enough data has been gathered.
        Returns:
        the accumulator object
      • setAccumulator

        void setAccumulator​(A newAccumulator)
        Sets an optional, user-defined accumulator that can be used to aggregate partial items from upstream.
        Parameters:
        newAccumulator - the new accumulator object
      • next

        void next​(R item)
        Signal the next output item.

        This can be called as many times as demand().

        Parameters:
        item - the item to signal
      • complete

        void complete()
        Indicate that no further output items will be produced.
      • cleanupItem

        void cleanupItem​(T item)
        Call the cleanup handler of the operator for a specific upstream instance.
        Parameters:
        item - the item to clean up
      • demand

        long demand()
        Returns the number of items that can be emitted via next(Object) without overflowing the downstream.
        Returns:
        the outstanding downstream demand