public class ZeroBuffer<T> extends java.lang.Object implements ChannelDataStore<T>, java.io.Serializable
Channel
(Channel.one2one(org.jcsp.util.ChannelDataStore) etc.).
The getState method will return FULL if there is an output waiting on the channel and EMPTY if there is not.
| Modifier and Type | Field and Description |
|---|---|
private int |
state
The current state
|
private T |
value
The Object
|
EMPTY, FULL, NONEMPTYFULL| Constructor and Description |
|---|
ZeroBuffer() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
clone()
Returns a new (and EMPTY) ZeroBuffer with the same
creation parameters as this one.
|
void |
endGet()
Ends the extended rendezvous by clearing the buffer.
|
T |
get()
Returns the Object from the ZeroBuffer.
|
int |
getState()
Returns the current state of the ZeroBuffer.
|
void |
put(T value)
Puts a new Object into the ZeroBuffer.
|
void |
removeAll()
Deletes all items in the buffer, leaving it empty.
|
T |
startGet()
Begins an extended rendezvous - simply returns the next object in the buffer.
|
private int state
private T value
public T get()
Pre-condition: getState must not currently return EMPTY.
get in interface ChannelDataStore<T>public T startGet()
startGet in interface ChannelDataStore<T>ChannelDataStore.endGet()public void endGet()
endGet in interface ChannelDataStore<T>ChannelDataStore.startGet()public void put(T value)
Pre-condition: getState must not currently return FULL.
put in interface ChannelDataStore<T>value - the Object to put into the ZeroBufferpublic int getState()
getState in interface ChannelDataStore<T>public java.lang.Object clone()
Note: Only the size and structure of the ZeroBuffer is cloned, not any stored data.
clone in interface ChannelDataStore<T>clone in class java.lang.Objectpublic void removeAll()
ChannelDataStoreremoveAll in interface ChannelDataStore<T>