jconch.pipeline
Class Processor<IN_T,OUT_T>

java.lang.Object
  extended by jconch.pipeline.PipelineStage
      extended by jconch.pipeline.Processor<IN_T,OUT_T>
Type Parameters:
IN_T - The input type.
OUT_T - The output type.
Direct Known Subclasses:
TransformerProcessor

public abstract class Processor<IN_T,OUT_T>
extends PipelineStage

A processing pipe in the pipeline.

Author:
Robert Fischer

Constructor Summary
protected Processor(ThreadingModel threading, PipeLink<IN_T> inLink, PipeLink<OUT_T> outLink)
          Creates a new intance of Processor.
 
Method Summary
 void execute()
          Executes one round of processing for this pipeline stage.
protected  PipeLink<IN_T> getLinkIn()
          Provides the pipe link that is being drawn from.
 PipeLink<OUT_T> getLinkOut()
          Provides the pipeline link out.
 boolean isFinished()
          If the pipeline is not supposed to handle any more elements, either because of an error or because a producer is exhausted.
abstract  OUT_T process(IN_T item)
          The argument that implements the processing for this class.
 
Methods inherited from class jconch.pipeline.PipelineStage
getThreadingModel, isStarted, logMessage, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Processor

protected Processor(ThreadingModel threading,
                    PipeLink<IN_T> inLink,
                    PipeLink<OUT_T> outLink)
Creates a new intance of Processor.

Parameters:
threading -
Method Detail

process

public abstract OUT_T process(IN_T item)
The argument that implements the processing for this class.

Parameters:
item - The item to process.
Returns:
The processed item, or null to drop it.

execute

public final void execute()
Description copied from class: PipelineStage
Executes one round of processing for this pipeline stage.

Specified by:
execute in class PipelineStage

isFinished

public boolean isFinished()
Description copied from class: PipelineStage
If the pipeline is not supposed to handle any more elements, either because of an error or because a producer is exhausted.

Specified by:
isFinished in class PipelineStage
Returns:
If the pipeline is done producing/consuming elements.

getLinkOut

public PipeLink<OUT_T> getLinkOut()
Provides the pipeline link out.

Returns:
The link that the producer feeds into; never null.

getLinkIn

protected PipeLink<IN_T> getLinkIn()
Provides the pipe link that is being drawn from.

Returns:
The inbound pipe link.