All Packages Class Hierarchy This Package Previous Next Index
Class jcsp.util.ZeroBuffer
java.lang.Object
|
+----jcsp.lang.ChannelDataStore
|
+----jcsp.util.ZeroBuffer
- public class ZeroBuffer
- extends ChannelDataStore
Description
The ZeroBuffer class is an implementation of ChannelDataStore which allows
one Object to be sent across the Channel at any one time.
The getState method will return EMPTY if the Channel does not contain
an Object and FULL if it does.
- Author:
- P.D.Austin
-
ZeroBuffer()
-
-
clone()
- Returns a new Object with the same creation parameters as this Object.
-
get()
- Returns the Object from the ZeroBuffer.
-
getState()
- Returns the current state of the ZeroBuffer, should be called to ensure
the Pre-conditions of the other methods are not broken.
-
put(Object)
- Puts a new Object into the ZeroBuffer.
ZeroBuffer
public ZeroBuffer()
get
protected Object get()
- Returns the Object from the ZeroBuffer.
NOTE: getState should be called before this method to check that the
state is not EMPTY. If the state is EMPTY the ZeroBuffer will be left in
an undefined state.
Pre-condition: The state must not be EMPTY
- Returns:
- The next available Object from the ChannelDataStore
- Overrides:
- get in class ChannelDataStore
put
protected void put(Object value)
- Puts a new Object into the ZeroBuffer.
NOTE: getState should be called before this method to check that the
state is not FULL. If the state is FULL the ZeroBuffer will be left in
an undefined state.
Pre-condition: The state must not be FULL
- Parameters:
- value - The object to put in the ChannelDataStore
- Overrides:
- put in class ChannelDataStore
getState
protected int getState()
- Returns the current state of the ZeroBuffer, should be called to ensure
the Pre-conditions of the other methods are not broken.
- Returns:
- The current state of the ZeroBuffer (EMPTY or FULL)
- Overrides:
- getState in class ChannelDataStore
clone
protected Object clone()
- Returns a new Object with the same creation parameters as this Object.
This method should be overridden by subclasses to return a new Object
that is the same type as this Object. The new instance should be created
by constructing a new instance with the same parameters as the original.
NOTE: Only the sizes of the data should be cloned not the stored data.
- Returns:
- The cloned instance of this Object.
- Overrides:
- clone in class ChannelDataStore
All Packages Class Hierarchy This Package Previous Next Index