All Packages Class Hierarchy This Package Previous Next Index
Class jcsp.lang.ints.Many2OneChannelInt
java.lang.Object
|
+----jcsp.lang.ints.AltingChannelInputInt
|
+----jcsp.lang.ints.AltingChannelInt
|
+----jcsp.lang.ints.Many2OneChannelInt
- public class Many2OneChannelInt
- extends AltingChannelInt
Description
The Many2OneChannelInt is an implementation of an AltingChannelInt which
is safe to use with only one Reading Process and Many Writing Process.
If more than one reader is using the ChannelInt data may 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 Many2OneChannelInt. 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 Alternative class which will control the selection
-
data
- The ChannelDataStoreInt used to store the data for the ChannelInt
-
writeMonitor
- The monitor writes must synchronize on
-
Many2OneChannelInt()
- Constructs a new Many2OneChannelInt with a ZeroBufferInt ChannelDataStoreInt.
-
Many2OneChannelInt(ChannelDataStoreInt)
- Constructs a new Many2OneChannelInt with the specified ChannelDataStoreInt.
-
create(int)
- Creates an array of Many2OneChannelInts.
-
create(int, ChannelDataStoreInt)
- Creates an array of Many2OneChannelInt using the specified ChannelDataStoreInt.
-
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 Alternative class which will control the selection
writeMonitor
protected Object writeMonitor
- The monitor writes must synchronize on
Many2OneChannelInt
public Many2OneChannelInt()
- Constructs a new Many2OneChannelInt with a ZeroBufferInt ChannelDataStoreInt.
Many2OneChannelInt
public Many2OneChannelInt(ChannelDataStoreInt o)
- Constructs a new Many2OneChannelInt 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 int returned from the ChannelInt.
- Overrides:
- read in class AltingChannelInputInt
write
public void write(int value)
- Writes an int to the ChannelInt. This method also ensures only one
of the writers can actually be writing at any time. All other writers
are blocked until it completes the write.
- Parameters:
- value - The int to write to the ChannelInt.
- Overrides:
- write in class AltingChannelInt
create
public static Many2OneChannelInt[] create(int n)
- Creates an array of Many2OneChannelInts.
- Parameters:
- n - The number of channels to create in the array
- Returns:
- The array of Many2OneChannelInt
create
public static Many2OneChannelInt[] create(int n,
ChannelDataStoreInt store)
- Creates an array of Many2OneChannelInt using the specified ChannelDataStoreInt.
- Parameters:
- n - The number of channels to create in the array
- Returns:
- The array of Many2OneChannelInt
All Packages Class Hierarchy This Package Previous Next Index