All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jcsp.lang.ints.One2ManyChannelInt

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

public class One2ManyChannelInt
extends Object
implements ChannelInt

Description

The One2ManyChannelInt is an implementation of an ChannelInt which is safe to use with many Reading Process and only one Writing Process. If more than one writer is using the ChannelInt data may be lost. 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 One2ManyChannelInt. 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

Variable Index

 o data
The ChannelDataStoreInt used to store the data for the ChannelInt
 o readMonitor
The monitor reads must synchronize on

Constructor Index

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

Method Index

 o create(int)
Creates an array of One2ManyChannelInts.
 o create(int, ChannelDataStoreInt)
Creates an array of One2ManyChannelInt using the specified ChannelDataStoreInt.
 o read()
Reads an Object 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 readMonitor
 protected Object readMonitor
The monitor reads must synchronize on

Constructors

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

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

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

Methods

 o read
 public int read()
Reads an Object from the ChannelInt. This method also ensures only one of the readers can actually be reading at any time. All other readers are blocked until it completes the read.

Returns:
The int returned from the ChannelInt.
 o write
 public synchronized void write(int value)
Writes an int to the ChannelInt.

Parameters:
value - The int to write to the ChannelInt.
 o create
 public static One2ManyChannelInt[] create(int n)
Creates an array of One2ManyChannelInts.

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

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

All Packages  Class Hierarchy  This Package  Previous  Next  Index