All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jcsp.lang.ints.ChannelDataStoreInt

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

public abstract class ChannelDataStoreInt
extends Object
implements Cloneable

Description

ChannelDataStoreInt defines the interface to the storage mechanism used by the ChannelInts defined in the jcsp.lang package to store data passed across the ChannelInts. The use of an interface enables the storage policy to be defined by constructing one of the ChannelInts specifying the storage type instead of creating new ChannelInt types for each storage policy. This keeps the number of classes to a minimum.

The ChannelDataStoreInt implementations are only safe to be used within a single Thread of control and do not check to see if the operations are valid. It is the responsibility of the caller to ensure that only one Thread will be updating the instance at any one time and that any pre-conditions are met.

NOTE: All classes in this library that use ChannelDataStoreInts ensure they are used safely.

Author:
P.D.Austin
See Also:
ZeroBuffer, Buffer, OverWritingBuffer, OverWriteOldestBuffer, InifiniteBuffer, BlackHole, Timer

Variable Index

 o EMPTY
Specifies that the ChannelDataStoreInt is empty and cannot give further data
 o FULL
Specifies that the ChannelDataStoreInt is full and cannot accept further data
 o NONEMPTYFULL
Specifies that the ChannelDataStoreInt is neither empty or full and can give and accept further data.

Constructor Index

 o ChannelDataStoreInt()

Method Index

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

Variables

 o NONEMPTYFULL
 protected static int NONEMPTYFULL
Specifies that the ChannelDataStoreInt is neither empty or full and can give and accept further data.

 o EMPTY
 protected static int EMPTY
Specifies that the ChannelDataStoreInt is empty and cannot give further data

 o FULL
 protected static int FULL
Specifies that the ChannelDataStoreInt is full and cannot accept further data

Constructors

 o ChannelDataStoreInt
 public ChannelDataStoreInt()

Methods

 o put
 protected abstract void put(int value)
Puts a new int into the ChannelDataStoreInt. NOTE: getState should be called before this method to check that the state is not FULL. If the state is FULL unpredictable results will occur. Pre-condition: The state must not be FULL

Parameters:
value - The int to put in the ChannelDataStore
 o get
 protected abstract int get()
Returns the next available int from the ChannelDataStoreInt. NOTE: getState should be called before this method to check that the state is not EMPTY. If the state is EMPTY unpredictable results will occur. Pre-condition: The state must not be EMPTY

Returns:
The next available int from the ChannelDataStoreInt
 o getState
 protected abstract int getState()
Returns the current state of the ChannelDataStoreInt, should be called to ensure the Pre-conditions of the other methods are not broken.

Returns:
The current state of the ChannelDataStoreInt (EMPTY, NONEMPTYFULL or FULL)
 o clone
 protected abstract 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 Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index