com.ibm.streams.flow.handlers

Class MostRecent<T>

  • java.lang.Object
    • com.ibm.streams.flow.handlers.MostRecent<T>
  • Type Parameters:
    T - Type for the tuples on the stream
    All Implemented Interfaces:
    StreamHandler<T>


    public class MostRecent<T>
    extends java.lang.Object
    implements StreamHandler<T>
    Keeps track of the most recent tuple and punctuation mark that are seen on a stream.
    Useful for testing graphs by capturing the output of an operator after a tuple is submitted to that operator. For example, testing a filter style operator.
    Since:
    InfoSphere® Streams Version 3.1
    • Constructor Detail

      • MostRecent

        public MostRecent()
    • Method Detail

      • getMostRecentTuple

        public T getMostRecentTuple()
        Return the most recent tuple that is seen on the stream.
        Returns:
        The most recent tuple that is seen on the stream or null if a tuple has not been seen since construction or since clearMostRecentTuple() was called.
      • getMostRecentMark

        public StreamingData.Punctuation getMostRecentMark()
        Return the most recent punctuation that is seen on the stream.
        Returns:
        The most recent punctuation mark that is seen on the stream or null if a mark has not been seen since construction or since clearMostRecentMark() was called.
      • clearMostRecentMark

        public void clearMostRecentMark()
        Clear the most recent punctuation mark. After this call getMostRecentMark() returns null until a punctuation mark is seen on the stream.
      • clearMostRecentTuple

        public void clearMostRecentTuple()
        Clear the most recent tuple. After this call getMostRecentTuple() returns null until a tuple is seen on the stream.
      • tuple

        public void tuple(T tuple)
                   throws java.lang.Exception
        Save the most recent tuple. After this call, getMostRecentTuple() returns tuple until clearMostRecentTuple() is called.
        Specified by:
        tuple in interface StreamHandler<T>
        Parameters:
        tuple - The tuple.
        Throws:
        java.lang.Exception - Failure to process the tuple.