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
-
-
Field Summary
Fields Modifier and Type Field and Description static java.lang.String
IBM_COPYRIGHT
-
Constructor Summary
Constructors Constructor and Description MostRecent()
-
Method Summary
Methods Modifier and Type Method and Description void
clear()
Clear the most recent tuple and punctuation mark by callingclearMostRecentTuple()
andclearMostRecentMark()
.void
clearMostRecentMark()
Clear the most recent punctuation mark.void
clearMostRecentTuple()
Clear the most recent tuple.StreamingData.Punctuation
getMostRecentMark()
Return the most recent punctuation that is seen on the stream.T
getMostRecentTuple()
Return the most recent tuple that is seen on the stream.void
mark(StreamingData.Punctuation mark)
Save the most recent punctuation mark.void
tuple(T tuple)
Save the most recent tuple.
-
-
-
Field Detail
-
IBM_COPYRIGHT
public static final java.lang.String IBM_COPYRIGHT
- See Also:
- Constant Field Values
-
-
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.
-
clear
public void clear()
Clear the most recent tuple and punctuation mark by callingclearMostRecentTuple()
andclearMostRecentMark()
.
-
clearMostRecentMark
public void clearMostRecentMark()
Clear the most recent punctuation mark. After this callgetMostRecentMark()
returnsnull
until a punctuation mark is seen on the stream.
-
clearMostRecentTuple
public void clearMostRecentTuple()
Clear the most recent tuple. After this callgetMostRecentTuple()
returnsnull
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()
returnstuple
untilclearMostRecentTuple()
is called.- Specified by:
tuple
in interfaceStreamHandler<T>
- Parameters:
tuple
- The tuple.- Throws:
java.lang.Exception
- Failure to process the tuple.
-
mark
public void mark(StreamingData.Punctuation mark) throws java.lang.Exception
Save the most recent punctuation mark. After this call,getMostRecentMark()
returnsmark
untilclearMostRecentMark()
is called.- Specified by:
mark
in interfaceStreamHandler<T>
- Parameters:
mark
- The punctuation mark.- Throws:
java.lang.Exception
- Failure to process the punctuation mark.
-
-