com.lumiomedical.flow.FlowOut Maven / Gradle / Ivy
package com.lumiomedical.flow;
import com.lumiomedical.flow.actor.generator.Generator;
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.io.output.Recipient;
import com.lumiomedical.flow.node.Node;
import com.lumiomedical.flow.stream.StreamGenerator;
import java.util.UUID;
import java.util.function.Function;
/**
* Concept representing a Node with a potential downstream.
* It features an "output" of type O which can be processed by a Pipe, Join or Sink.
*
* FlowOut nodes include Sources, Pipes and Joins.
*
* @author Pierre Lecerf ([email protected])
* Created on 2020/03/01
*/
public interface FlowOut extends Node
{
/**
* Binds the current node into a Transformer, resulting in a new Pipe node.
*
* @param transformer a Transformer actor
* @param Output type of the pipe node
* @return the resulting Pipe node
*/
Pipe into(Transformer transformer);
/**
* Binds the current node into a Loader, resulting in a new Sink node.
*
* @param loader a Loader actor
* @return the resulting Sink node
*/
Sink into(Loader loader);
/**
* Synonymous with into(Transformer), has the advantage of not allowing ambiguous lambdas.
* @see #into(Transformer)
*/
default Pipe pipe(Transformer transformer)
{
return this.into(transformer);
}
/**
* Synonymous with into(Loader), has the advantage of not allowing ambiguous lambdas.
* @see #into(Loader)
*/
default Sink sink(Loader loader)
{
return this.into(loader);
}
/**
* Joins the current node with another 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 the resulting Join node
*/
Join join(FlowOut input, BiTransformer transformer);
/**
* Initiates a stream from the current node, results in a new StreamGenerator node.
*
* @param generatorSupplier a Generator creation function
* @param Output type of the stream generator node
* @return the resulting StreamGenerator node
*/
StreamGenerator stream(Function> generatorSupplier);
/**
*
* @param name
* @return
*/
Recipient collect(String name);
/**
*
* @return
*/
default Recipient collect()
{
return this.collect(UUID.randomUUID().toString());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy