All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jcsp.lang.ints.One2OneChannelInt

java.lang.Object
   |
   +----jcsp.lang.ints.AltingChannelInputInt
           |
           +----jcsp.lang.ints.AltingChannelInt
                   |
                   +----jcsp.lang.ints.One2OneChannelInt

public class One2OneChannelInt
extends AltingChannelInt

Description

The One2OneChannelInt is an implementation of an AltingChannelInt which is safe to use with only one Reading Process and one Writing Process. If either more than one reader or writer is using the ChannelInt data may either be lost or read from the ChannelInt more than once. In some cases it may cause the ChannelInt to be left in an unstable state.

This implementation of the ChannelInt uses Objects which conform to the ChannelDataStoreInt interface to store the data sent across the ChannelInt. This enables the storage policy to be defined when the channel is constructed. Also system constructors can define their own storage types.

This class also defines two static methods that can be used to create an array of One2OneChannelInt. The first of the two can be used to create an array with the default ChannelDataStoreInt and the second allows the type of the ChannelDataStoreInt to be specified.

Author:
P.D.Austin
See Also:
AlternativeInt

Variable Index

 o alt
The AlternativeInt class which will control the selection
 o data
The ChannelDataStoreInt used to store the data for the ChannelInt

Constructor Index

 o One2OneChannelInt()
Constructs a new One2OneChannelInt with a ZeroBufferInt ChannelDataStoreInt.
 o One2OneChannelInt(ChannelDataStoreInt)
Constructs a new One2OneChannelInt with the specified ChannelDataStoreInt.

Method Index

 o create(int)
Creates an array of One2OneChannelInts.
 o create(int, ChannelDataStoreInt)
Creates an array of One2OneChannelInts using the specified ChannelIntDataStore.
 o read()
Reads an int from the ChannelInt.
 o write(int)
Writes an int to the ChannelInt.

Variables

 o data
 protected ChannelDataStoreInt data
The ChannelDataStoreInt used to store the data for the ChannelInt

 o alt
 protected AlternativeInt alt
The AlternativeInt class which will control the selection

Constructors

 o One2OneChannelInt
 public One2OneChannelInt()
Constructs a new One2OneChannelInt with a ZeroBufferInt ChannelDataStoreInt.

 o One2OneChannelInt
 public One2OneChannelInt(ChannelDataStoreInt data)
Constructs a new One2OneChannelInt with the specified ChannelDataStoreInt.

Parameters:
data - The ChannelDataStoreInt used to store the data for the ChannelInt

Methods

 o read
 public synchronized int read()
Reads an int from the ChannelInt.

Returns:
The object returned from the ChannelInt.
Overrides:
read in class AltingChannelInputInt
 o write
 public synchronized void write(int value)
Writes an int to the ChannelInt.

Parameters:
value - The int to write to the ChannelInt.
Overrides:
write in class AltingChannelInt
 o create
 public static One2OneChannelInt[] create(int n)
Creates an array of One2OneChannelInts.

Parameters:
n - The number of channels to create in the array
Returns:
The array of One2OneChannelInt
 o create
 public static One2OneChannelInt[] create(int n,
                                          ChannelDataStoreInt store)
Creates an array of One2OneChannelInts using the specified ChannelIntDataStore.

Parameters:
n - The number of channels to create in the array
Returns:
The array of One2OneChannelInt

All Packages  Class Hierarchy  This Package  Previous  Next  Index