Class Pump

java.lang.Object
  |
  +--Pump

public class Pump
extends java.lang.Object

A Pump synchronizes the flow between any number of paired DataSources and DataSinks. Points are drawn from each source at the same rate. Points are pumped into each sink as they are drawn.

See Also:
DataSink, DataSource

Constructor Summary
Pump()
          Sole constructor.
 
Method Summary
 void addPair(DataSource dsrc, DataSink dsnk)
          Add a new paired source/sink.
 int max()
          Determines the larges expected value from all data sources.
 boolean pump()
          Synchronously move the next point from each source to its associated sink.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Pump

public Pump()
Sole constructor.

Method Detail

addPair

public void addPair(DataSource dsrc,
                    DataSink dsnk)
Add a new paired source/sink.

Parameters:
dsrc - the data source which should be drained in lock step with all the others.
dsnk - the data sink to which points drained from dsrc are delivered.

max

public int max()
Determines the larges expected value from all data sources.

Returns:
maximum of all source maximums.

pump

public boolean pump()
Synchronously move the next point from each source to its associated sink.

Returns:
true if all sources are empty. Otherwise false