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

net.sf.jabb.util.parallel.Pipeline Maven / Gradle / Ivy

There is a newer version: 1.0.73
Show newest version
/**
 * 
 */
package net.sf.jabb.util.parallel;

import java.util.concurrent.Future;

/**
 * A pipeline is a set of data processing elements connected in series, 
 * where the output of one element is the input of the next one. 
 * The elements of a pipeline are often executed in parallel.
 * 
 * @author James Hu
 *
 */
public interface Pipeline {
	/**
	 * Feed an input, and get a future of the final result in return.
	 * @param input	the input
	 * @return	future of the final result.
	 */
	Future feed(I input);
	
	/**
	 * The intermediate output between two connected pipelines.
	 * @author James
	 *
	 * @param 	Type of the output from the upstream pipeline
	 * @param 	Type of the output from the downstream pipeline
	 */
	public static class IntermediateOutput{
		O1 outputFromUpstream;
		Future futureFromDownstream;
		
		IntermediateOutput(O1 output, Future future){
			this.outputFromUpstream = output;
			this.futureFromDownstream = future;
		}
		
		public O1 getOutputFromUpstream() {
			return outputFromUpstream;
		}
		public Future getFutureFromDownstream() {
			return futureFromDownstream;
		}
		
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy