org.specrunner.pipeline.core
Class PipelineImpl

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.AbstractSequentialList<E>
              extended by java.util.LinkedList<IPipe>
                  extended by org.specrunner.pipeline.core.PipelineImpl
All Implemented Interfaces:
Serializable, Cloneable, Iterable<IPipe>, Collection<IPipe>, Deque<IPipe>, List<IPipe>, Queue<IPipe>, IPipe, IPipeline

public class PipelineImpl
extends LinkedList<IPipe>
implements IPipeline

Default implementation of a pipeline.

Author:
Thiago Santos
See Also:
Serialized Form

Field Summary
protected  List<IPipeListener> listeners
          List of listeners.
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
PipelineImpl()
          Superclass constructor.
PipelineImpl(Collection<? extends IPipe> c)
          Superclass constructor.
 
Method Summary
 void addPipelineListener(IPipeListener listener)
          Add a listener.
 boolean check(IChannel channel)
          Check if a pipe must perform something on channel.
protected  void fireAfterCheck(IChannel channel, IPipe source)
          Fire event on channel.
protected  void fireAfterPerform(IChannel channel, IPipe source)
          Fire event on channel.
protected  void fireBeforeCheck(IChannel channel, IPipe source)
          Fire event on channel.
protected  void fireBeforePerform(IChannel channel, IPipe source)
          Fire event on channel.
 IChannel process(IChannel channel)
          Perform some transformation over the channel.
 void removePipelineListener(IPipeListener listener)
          Remove a listener.
 
Methods inherited from class java.util.LinkedList
add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, descendingIterator, element, get, getFirst, getLast, indexOf, lastIndexOf, listIterator, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, remove, remove, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, set, size, toArray, toArray
 
Methods inherited from class java.util.AbstractSequentialList
iterator
 
Methods inherited from class java.util.AbstractList
equals, hashCode, listIterator, removeRange, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArray, toArray
 
Methods inherited from interface java.util.Deque
iterator
 

Field Detail

listeners

protected List<IPipeListener> listeners
List of listeners.

Constructor Detail

PipelineImpl

public PipelineImpl()
Superclass constructor.


PipelineImpl

public PipelineImpl(Collection<? extends IPipe> c)
Superclass constructor.

Parameters:
c - A set of pipes.
Method Detail

check

public boolean check(IChannel channel)
              throws AbortException
Description copied from interface: IPipe
Check if a pipe must perform something on channel. If the channel is corrupted the pipe must throw AbortException.

Specified by:
check in interface IPipe
Parameters:
channel - The information channel.
Returns:
true, if pipe must perform something on channel, false, otherwise.
Throws:
AbortException - If the channel is corrupted.

process

public IChannel process(IChannel channel)
                 throws AbortException,
                        PipelineException
Description copied from interface: IPipe
Perform some transformation over the channel.

Specified by:
process in interface IPipe
Parameters:
channel - The channel.
Returns:
The pipe itself.
Throws:
AbortException - On processing errors.
PipelineException - On processing errors.

addPipelineListener

public void addPipelineListener(IPipeListener listener)
Description copied from interface: IPipeline
Add a listener.

Specified by:
addPipelineListener in interface IPipeline
Parameters:
listener - A listener.

removePipelineListener

public void removePipelineListener(IPipeListener listener)
Description copied from interface: IPipeline
Remove a listener.

Specified by:
removePipelineListener in interface IPipeline
Parameters:
listener - A listener.

fireBeforeCheck

protected void fireBeforeCheck(IChannel channel,
                               IPipe source)
Fire event on channel.

Parameters:
channel - The channel.
source - The source pipe.

fireAfterCheck

protected void fireAfterCheck(IChannel channel,
                              IPipe source)
Fire event on channel.

Parameters:
channel - The channel.
source - The source pipe.

fireBeforePerform

protected void fireBeforePerform(IChannel channel,
                                 IPipe source)
Fire event on channel.

Parameters:
channel - The channel.
source - The source pipe.

fireAfterPerform

protected void fireAfterPerform(IChannel channel,
                                IPipe source)
Fire event on channel.

Parameters:
channel - The channel.
source - The source pipe.


Copyright © 2014. All rights reserved.