quarks.oplet.core

Class Split<T>

  • Type Parameters:
    T - Type of the tuple.
    All Implemented Interfaces:
    java.io.Serializable, java.lang.AutoCloseable, Consumer<T>, Oplet<T,T>


    public class Split<T>
    extends AbstractOplet<T,T>
    implements Consumer<T>
    Split a stream into multiple streams depending on the result of a splitter function.
    For each tuple a function is called:
    • If the return is negative the tuple is dropped.
    • Otherwise the return value is modded by the number of output ports and the result is the output port index the tuple is submitted to.
    See Also:
    Serialized Form
    • Method Detail

      • start

        public void start()
        Description copied from interface: Oplet
        Start the oplet. Oplets must not submit any tuples not derived from input tuples until this method is called.
        Specified by:
        start in interface Oplet<T,T>
      • getInputs

        public java.util.List<Consumer<T>> getInputs()
        Description copied from interface: Oplet
        Get the input stream data handlers for this oplet. The number of handlers must equal the number of configured input ports. Each tuple arriving on an input port will be sent to the stream handler for that input port.
        Specified by:
        getInputs in interface Oplet<T,T>
        Returns:
        list of consumers
      • accept

        public void accept(T tuple)
        Description copied from interface: Consumer
        Apply the function to value.
        Specified by:
        accept in interface Consumer<T>
        Parameters:
        tuple - Value function is applied to.
      • close

        public void close()
                   throws java.lang.Exception
        Specified by:
        close in interface java.lang.AutoCloseable
        Throws:
        java.lang.Exception

Copyright IBM 2015,2016 - 2f6ad0e-20160307-0902