jconch.pipeline.impl
Class CollectionProducer<T>

java.lang.Object
  extended by jconch.pipeline.PipeStage
      extended by jconch.pipeline.Producer<T>
          extended by jconch.pipeline.impl.CollectionProducer<T>
All Implemented Interfaces:
PipeElement

public abstract class CollectionProducer<T>
extends Producer<T>

A producer which provides elements from a given collection.

Author:
Robert Fischer

Field Summary
 
Fields inherited from class jconch.pipeline.Producer
link
 
Constructor Summary
CollectionProducer(java.util.Collection<T> data, ThreadingModel model, PipeLink<T> out)
          Constructor.
 
Method Summary
 java.util.Collection<T> getCollection()
          Gets the collection backing the instance.
protected  boolean isExhausted()
          Determines if the producer is done producing elements.
 T produceItem()
          Method that must be implemented to queue the producer.
 
Methods inherited from class jconch.pipeline.Producer
execute, getLinkOut, isFinished
 
Methods inherited from class jconch.pipeline.PipeStage
getThreadingModel, isStarted, logMessage, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionProducer

public CollectionProducer(java.util.Collection<T> data,
                          ThreadingModel model,
                          PipeLink<T> out)
Constructor.

Parameters:
data - The collection to draw elements from.
Throws:
org.apache.commons.lang.NullArgumentException - If the argument is null
Method Detail

isExhausted

protected boolean isExhausted()
Determines if the producer is done producing elements.

Specified by:
isExhausted in class Producer<T>
Returns:
If the collection is empty.

produceItem

public T produceItem()
Description copied from class: Producer
Method that must be implemented to queue the producer.

Specified by:
produceItem in class Producer<T>
Returns:

getCollection

public java.util.Collection<T> getCollection()
Gets the collection backing the instance.