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
-
alt
- The AlternativeInt class which will control the selection
-
data
- The ChannelDataStoreInt used to store the data for the ChannelInt
-
One2OneChannelInt()
- Constructs a new One2OneChannelInt with a ZeroBufferInt ChannelDataStoreInt.
-
One2OneChannelInt(ChannelDataStoreInt)
- Constructs a new One2OneChannelInt with the specified ChannelDataStoreInt.
-
create(int)
- Creates an array of One2OneChannelInts.
-
create(int, ChannelDataStoreInt)
- Creates an array of One2OneChannelInts using the specified ChannelIntDataStore.
-
read()
- Reads an int from the ChannelInt.
-
write(int)
- Writes an int to the ChannelInt.
data
protected ChannelDataStoreInt data
- The ChannelDataStoreInt used to store the data for the ChannelInt
alt
protected AlternativeInt alt
- The AlternativeInt class which will control the selection
One2OneChannelInt
public One2OneChannelInt()
- Constructs a new One2OneChannelInt with a ZeroBufferInt ChannelDataStoreInt.
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
read
public synchronized int read()
- Reads an int from the ChannelInt.
- Returns:
- The object returned from the ChannelInt.
- Overrides:
- read in class AltingChannelInputInt
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
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
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