org.jcreme.processing
Interface Producer

All Known Implementing Classes:
AbstractProducer, MonitorableProducer, RMIProducer

public interface Producer

The interface describing the common behaviors to every producer. This Interface along with the Consumer Interface is designed to enable to easily string "consumption - production" pieces together. It enables to separate the successive operations applied to data so that the developers can concentrate their efforts on the operations themselves and not on how they are to be stringed or how the application will be architectured (distributed producers and consumers, pools, load balancing...) The architecture issues merely appear at deployment time.

Version:
$Revision: 1.2 $
Author:
$Author: dbregeon $

Method Summary
 boolean isProductionOver()
          Returns true if the production is over, false if not.
 java.lang.Object nextItem()
          Returns the next item free for consumption.
 boolean produceItem()
          Produces next item, i.e. marks it as consumable.
 void setProductionOver(boolean bool)
          Sets a flag that shows whether the production is over.
 boolean validateItem(java.lang.Object theItem)
          Validates an item, i.e. marks it as having been consumed.
 

Method Detail

setProductionOver

public void setProductionOver(boolean bool)
Sets a flag that shows whether the production is over.

Parameters:
bool - The boolean value that the flag has to be set on.

isProductionOver

public boolean isProductionOver()
Returns true if the production is over, false if not.

Returns:
True if the production is over, false if not.

nextItem

public java.lang.Object nextItem()
Returns the next item free for consumption.

Returns:
The next item free for consumption.

validateItem

public boolean validateItem(java.lang.Object theItem)
Validates an item, i.e. marks it as having been consumed.

Parameters:
theItem - The item to be validated.
Returns:
true if the object was validated.

produceItem

public boolean produceItem()
Produces next item, i.e. marks it as consumable.

Returns:
True if there are still objects to produce, false otherwise.


Copyright 2006 null. All Rights Reserved.