public class OverFlowingBuffer
This is used to create a buffered object channel that always accepts input, discarding its last entered data if full.
The getState method returns EMPTY or NONEMPTYFULL, but never FULL.
Constructor and description |
---|
OverFlowingBuffer
(int size) Construct a new OverFlowingBuffer with the specified size. |
Type | Name and description |
---|---|
Object |
clone() Returns a new (and EMPTY) OverFlowingBuffer with the same creation parameters as this one. |
void |
endGet() Removes the oldest object from the buffer. |
Object |
get() Returns the oldest Object from the OverFlowingBuffer and removes it. |
int |
getState() Returns the current state of the OverFlowingBuffer. |
void |
put(Object value) Puts a new Object into the OverFlowingBuffer. |
void |
removeAll() |
Object |
startGet() Returns the oldest object from the buffer but does not remove it. |
Construct a new OverFlowingBuffer with the specified size.
size
- the number of Objects the OverFlowingBuffer can store.Returns a new (and EMPTY) OverFlowingBuffer with the same creation parameters as this one.
Note: Only the size and structure of the OverFlowingBuffer is cloned, not any stored data.
Removes the oldest object from the buffer.
Returns the oldest Object from the OverFlowingBuffer and removes it.
Pre-condition: getState must not currently return EMPTY.
Returns the current state of the OverFlowingBuffer.
Puts a new Object into the OverFlowingBuffer.
If OverFlowingBuffer is full, the item is discarded.
value
- the Object to put into the OverFlowingBufferReturns the oldest object from the buffer but does not remove it. Pre-condition: getState must not currently return EMPTY.
JCSP for Java 1.8 generated 14-10-2016 by Jon Kerridge, Edinburgh Napier University - j dot kerridge at napier dot ac dot uk