public class OverWriteOldestBufferInt extends java.lang.Object implements ChannelDataStoreInt, java.io.Serializable
Channel
(Channel.one2oneInt(org.jcsp.util.ints.ChannelDataStoreInt)
etc.).
The getState method returns EMPTY or NONEMPTYFULL, but never FULL.
ZeroBufferInt
,
BufferInt
,
OverWritingBufferInt
,
OverFlowingBufferInt
,
InfiniteBufferInt
,
ChannelInt
,
Serialized FormEMPTY, FULL, NONEMPTYFULL
Constructor and Description |
---|
OverWriteOldestBufferInt(int size)
Construct a new OverWriteOldestBufferInt with the specified size.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Returns a new (and EMPTY) OverWriteOldestBufferInt with the same
creation parameters as this one.
|
void |
endGet()
See
startGet() for a description of the semantics of this method. |
int |
get()
Returns the oldest int from the OverWriteOldestBufferInt and removes it.
|
int |
getState()
Returns the current state of the OverWriteOldestBufferInt.
|
void |
put(int value)
Puts a new int into the OverWriteOldestBufferInt.
|
void |
removeAll() |
int |
startGet()
Begins an extended rendezvous by the reader.
|
public OverWriteOldestBufferInt(int size)
size
- the number of ints the OverWriteOldestBufferInt can store.BufferIntSizeError
- if size 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.public int get()
Pre-condition: getState must not currently return EMPTY.
get
in interface ChannelDataStoreInt
public int startGet()
get()
). While an extended rendezvous is ongoing, the
writer may (repeatedly) write to the buffer, without ever blocking.
When the reader finishes an extended rendezvous, the following options are possible:
startGet
in interface ChannelDataStoreInt
ChannelDataStoreInt.endGet()
public void endGet()
startGet()
for a description of the semantics of this method.endGet
in interface ChannelDataStoreInt
ChannelDataStoreInt.startGet()
public void put(int value)
If OverWriteOldestBufferInt is full, the oldest item left unread in the buffer will be overwritten.
put
in interface ChannelDataStoreInt
value
- the int to put into the OverWriteOldestBufferIntpublic int getState()
getState
in interface ChannelDataStoreInt
public java.lang.Object clone()
Note: Only the size and structure of the OverWriteOldestBufferInt is cloned, not any stored data.
clone
in interface ChannelDataStoreInt
clone
in class java.lang.Object
public void removeAll()
removeAll
in interface ChannelDataStoreInt
Copyright © 1996–2018. All rights reserved.