All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jcsp.lang.ChannelDataStore

java.lang.Object
   |
   +----jcsp.lang.ChannelDataStore

public abstract class ChannelDataStore
extends Object
implements Cloneable

Description

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

The ChannelDataStore 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 ChannelDataStores 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 ChannelDataStore is empty and cannot give further data
 o FULL
Specifies that the ChannelDataStore is full and cannot accept further data
 o NONEMPTYFULL
Specifies that the ChannelDataStore is neither empty or full and can give and accept further data.

Constructor Index

 o ChannelDataStore()

Method Index

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

Variables

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

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

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

Constructors

 o ChannelDataStore
 public ChannelDataStore()

Methods

 o put
 protected abstract void put(Object value)
Puts a new Object into the ChannelDataStore. 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 object to put in the ChannelDataStore
 o get
 protected abstract Object get()
Returns the next available Object from the ChannelDataStore. 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 Object from the ChannelDataStore
 o getState
 protected abstract int getState()
Returns the current state of the ChannelDataStore, should be called to ensure the Pre-conditions of the other methods are not broken.

Returns:
The current state of the ChannelDataStore (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