All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.lumiomedical.flow.stream.StreamOut Maven / Gradle / Ivy

package com.lumiomedical.flow.stream;

import com.lumiomedical.flow.FlowOut;
import com.lumiomedical.flow.actor.accumulator.Accumulator;
import com.lumiomedical.flow.actor.loader.Loader;
import com.lumiomedical.flow.actor.transformer.BiTransformer;
import com.lumiomedical.flow.actor.transformer.Transformer;
import com.lumiomedical.flow.node.Node;

import java.util.Collection;

/**
 * @author Pierre Lecerf ([email protected])
 * Created on 2020/12/01
 */
public interface StreamOut extends Node
{
    /**
     * Binds the current node into a Transformer, resulting in a new StreamPipe node.
     *
     * @param transformer a Transformer actor
     * @param  Output type of the pipe node
     * @return the resulting StreamPipe node
     */
     StreamPipe into(Transformer transformer);

    /**
     * Binds the current node into a Loader, resulting in a new StreamSink node.
     *
     * @param loader a Loader actor
     * @return the resulting StreamSink node
     */
    StreamSink into(Loader loader);

    /**
     * Synonymous with into(Transformer), has the advantage of not allowing ambiguous lambdas.
     * @see #into(Transformer)
     */
    default  StreamPipe pipe(Transformer transformer)
    {
        return this.into(transformer);
    }

    /**
     * Synonymous with into(Loader), has the advantage of not allowing ambiguous lambdas.
     * @see #into(Loader)
     */
    default StreamSink sink(Loader loader)
    {
        return this.into(loader);
    }

    /**
     * Joins the current stream node with another non-stream flow using a bi-transformer join function.
     *
     * @param input Flow with which to join the current flow.
     * @param transformer A bi-transformer function for performing the join.
     * @param  Input type from another flow
     * @param  Output type of the joined flow
     * @return
     */
     StreamJoin join(FlowOut input, BiTransformer transformer);

    /**
     *
     * @param accumulator
     * @param 
     * @return
     */
     StreamAccumulator accumulate(Accumulator accumulator);

    /**
     *
     * @return
     */
    default StreamAccumulator> accumulate()
    {
        return this.accumulate(input -> input);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy