org.debellor.core
Class Cell.Stream

java.lang.Object
  extended by org.debellor.core.Cell.Stream
Enclosing class:
Cell

public static class Cell.Stream
extends java.lang.Object

Represents a stream of samples flowing between two cells. Instance of Stream is created by the sender on receiver's request (Cell.open()). Then, it can be used by the receiver to retrieve consecutive samples. Stream object is tightly coupled with its parent cell (the sender), until the stream is closed.

Author:
Marcin Wojnarski

Field Summary
 Sample.SampleType sampleType
          Common properties (type) of all samples that will be generated by this stream.
 
Method Summary
 void close()
          Closes the stream.
 Sample next()
          Returns next sample of data from this stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sampleType

public final Sample.SampleType sampleType
Common properties (type) of all samples that will be generated by this stream.

Method Detail

next

public final Sample next()
                  throws CellException
Returns next sample of data from this stream. Data represented by Sample object are immutable, so the same data object (Sample or subclass of DataObject) can be referenced by many cells at the same time.

End of data is reported by returning null value. In such case, next() can be still called any number of times, but every time it will return null.

Returns:
null if no more samples are available. This should be checked to detect end of stream.
Throws:
CellException

close

public final void close()
                 throws CellException
Closes the stream. After closing, this stream object cannot be used any more.

Throws:
CellException