All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jcsp.lang.ints.Many2ManyChannelInt

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

public class Many2ManyChannelInt
extends Object
implements ChannelInt

Description

The Many2ManyChannelInt is an implementation of an ChannelInt which is safe to use with many Reading Process and many Writing Process.

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 Many2ManyChannelInt. 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
 o writeMonitor
The monitor writes must synchronize on

Constructor Index

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

Method Index

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

 o writeMonitor
 protected Object writeMonitor
The monitor writes must synchronize on

Constructors

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

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

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

Methods

 o read
 public int read()
Reads an int 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 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 object to write to the ChannelInt.
 o create
 public static Many2ManyChannelInt[] create(int n)
Creates an array of Many2ManyChannelInts.

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

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

All Packages  Class Hierarchy  This Package  Previous  Next  Index