public class OverFlowingBufferInt
This is used to create a buffered integer 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 |
---|
OverFlowingBufferInt
(int size) Construct a new OverFlowingBufferInt with the specified size. |
Type | Name and description |
---|---|
Object |
clone() Returns a new (and EMPTY) OverFlowingBufferInt with the same creation parameters as this one. |
void |
endGet() Removes the oldest integer from the buffer. |
int |
get() Returns the oldest int from the OverFlowingBufferInt and removes it. |
int |
getState() Returns the current state of the OverFlowingBufferInt. |
void |
put(int value) Puts a new int into the OverFlowingBufferInt. |
void |
removeAll() |
int |
startGet() Returns the oldest integer from the buffer but does not remove it. |
Construct a new OverFlowingBufferInt with the specified size.
size
- the number of ints the OverFlowingBufferInt can store.Returns a new (and EMPTY) OverFlowingBufferInt with the same creation parameters as this one.
Note: Only the size and structure of the OverFlowingBufferInt is cloned, not any stored data.
Removes the oldest integer from the buffer.
Returns the oldest int from the OverFlowingBufferInt and removes it.
Pre-condition: getState must not currently return EMPTY.
Returns the current state of the OverFlowingBufferInt.
Puts a new int into the OverFlowingBufferInt.
If OverFlowingBufferInt is full, the item is discarded.
value
- the int to put into the OverFlowingBufferIntReturns the oldest integer 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