All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jcsp.util.ints.ZeroBufferInt

java.lang.Object
   |
   +----jcsp.lang.ints.ChannelDataStoreInt
           |
           +----jcsp.util.ints.ZeroBufferInt

public class ZeroBufferInt
extends ChannelDataStoreInt

Description

The ZeroBufferInt class is an implementation of ChannelDataStoreInt which allows one int to be sent across the ChannelInt at any one time.

The getState method will return EMPTY if the ChannelInt does not contain an int and FULL if it does.

Author:
P.D.Austin

Constructor Index

 o ZeroBufferInt()

Method Index

 o clone()
Returns a new Object with the same creation parameters as this Object.
 o get()
Returns the int from the ZeroBufferInt.
 o getState()
Returns the current state of the ZeroBufferInt, should be called to ensure the Pre-conditions of the other methods are not broken.
 o put(int)
Puts a new int into the ZeroBufferInt.

Constructors

 o ZeroBufferInt
 public ZeroBufferInt()

Methods

 o get
 protected int get()
Returns the int from the ZeroBufferInt.

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 int from the ChannelDataStoreInt
Overrides:
get in class ChannelDataStoreInt
 o put
 protected void put(int value)
Puts a new int into the ZeroBufferInt.

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 int to put in the ChannelDataStoreInt
Overrides:
put in class ChannelDataStoreInt
 o getState
 protected int getState()
Returns the current state of the ZeroBufferInt, should be called to ensure the Pre-conditions of the other methods are not broken.

Returns:
The current state of the ZeroBufferInt (EMPTY or FULL)
Overrides:
getState in class ChannelDataStoreInt
 o 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 ChannelDataStoreInt

All Packages  Class Hierarchy  This Package  Previous  Next  Index