|
CSP for Java (JCSP) 1.0-rc4 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jcsp.util.ints.InfiniteBufferInt
This is used to create a buffered integer channel that always accepts and never loses any input.
create
methods of One2OneChannelInt
etc.
The getState method returns EMPTY or NONEMPTYFULL, but never FULL.
An initial size for the buffer can be specified during construction.
ZeroBufferInt
,
BufferInt
,
OverWriteOldestBufferInt
,
OverWritingBufferInt
,
OverFlowingBufferInt
,
One2OneChannelInt
,
Any2OneChannelInt
,
One2AnyChannelInt
,
Any2AnyChannelInt
, Serialized FormFields inherited from interface jcsp.util.ints.ChannelDataStoreInt |
EMPTY, FULL, NONEMPTYFULL |
Constructor Summary | |
InfiniteBufferInt()
Construct a new InfiniteBufferInt with the default size (of 8). |
|
InfiniteBufferInt(int initialSize)
Construct a new InfiniteBufferInt with the specified initial size. |
Method Summary | |
Object |
clone()
Returns a new (and EMPTY) InfiniteBufferInt with the same creation parameters as this one. |
int |
get()
Returns the oldest int from the InfiniteBufferInt and removes it. |
int |
getState()
Returns the current state of the InfiniteBufferInt. |
void |
put(int value)
Puts a new int into the InfiniteBufferInt. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public InfiniteBufferInt()
public InfiniteBufferInt(int initialSize)
initialSize
- the number of ints
the InfiniteBufferInt can initially store.BufferIntSizeError
- if initialSize is zero or negative. Note: no action
should be taken to try/catch this exception
- application code generating it is in error and needs correcting.Method Detail |
public int get()
Pre-condition: getState must not currently return EMPTY.
get
in interface ChannelDataStoreInt
public void put(int value)
Implementation note: if InfiniteBufferInt is full, a new internal buffer with double the capacity is constructed and the old data copied across.
put
in interface ChannelDataStoreInt
value
- the int to put into the InfiniteBufferIntpublic int getState()
getState
in interface ChannelDataStoreInt
public Object clone()
Note: Only the initial size and structure of the InfiniteBufferInt is cloned, not any stored data.
clone
in interface ChannelDataStoreInt
clone
in class Object
|
CSP for Java (JCSP) 1.0-rc4 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |