jjil.core
Class Sequence

java.lang.Object
  extended by jjil.core.PipelineStage
      extended by jjil.core.Sequence

public class Sequence
extends PipelineStage

Sequence is used to construct a sequence of image processing pipeline stages. Each Sequence object contains a PipelineStage, which can be null, and a Sequence object, which can also be null. The PipelineStage is the head of the list of PipelineStage's starting here, and the Sequence object is the rest of the list. The Sequence object can be non-null only if the PipelineStage object is non-null.

Hungarian prefix is 'seq'.

Author:
webb

Constructor Summary
Sequence()
          Creates a new instance of Sequence with no pipeline.
Sequence(PipelineStage p)
          Creates a new instance of Sequence with a single PipelineStage.
 
Method Summary
 void add(PipelineStage p)
          add an additional PipelineStage at the end of the current Sequence.
 Image getFront()
          Returns the Image produced by the last stage in the pipeline.
 boolean isEmpty()
          Returns true iff the pipeline has no image available
 void push(Image i)
          Process an image by the pipeline.
 java.lang.String toString()
          Return a string describing the pipeline in fully parenthesized list notation.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Sequence

public Sequence()
Creates a new instance of Sequence with no pipeline.


Sequence

public Sequence(PipelineStage p)
Creates a new instance of Sequence with a single PipelineStage.

Parameters:
p - the PipelineStage.
Method Detail

add

public void add(PipelineStage p)
add an additional PipelineStage at the end of the current Sequence.

Parameters:
p - the PipelineStage to be added.

isEmpty

public boolean isEmpty()
Returns true iff the pipeline has no image available

Overrides:
isEmpty in class PipelineStage
Returns:
true iff the pipeline has no image available.

getFront

public Image getFront()
               throws Error
Returns the Image produced by the last stage in the pipeline. Overrides PipelineStage.getFront.

Overrides:
getFront in class PipelineStage
Returns:
the Image produced by the pipeline.
Throws:
Error - if no image is available.

push

public void push(Image i)
          throws Error
Process an image by the pipeline. The image is pushed onto the beginning of the pipeline, and then each stage's output is passed to the next stage, until the end of the pipeline is reached. Overrides PipelineStage.push(Image).

Specified by:
push in class PipelineStage
Parameters:
i - the image to be pushed.
Throws:
Error - if the pipeline is empty.

toString

public java.lang.String toString()
Return a string describing the pipeline in fully parenthesized list notation. E.g., a pipeline consisting of three stages A, B, and C will be represented as "(A (B C))".

Overrides:
toString in class java.lang.Object
Returns:
the string describing the pipeline.