CSP for Java
(JCSP) 1.1-rc4

org.jcsp.lang
Class Channel

java.lang.Object
  extended by org.jcsp.lang.Channel

public class Channel
extends Object

This class provides static factory methods for constructing all the different types of channel.

Channels carry either Objects or integers.

Basic channels are zero-buffered: the writer and reader processes must synchronise. Buffered channels can be made with various buffering policies: e.g. fixed size blocking FIFO (here), fixed size overwrite-oldest-when-full (here), fixed size discard-when-full (here), infinite sized FIFO (here).

Channels can be made Poisonable with user-chosen immunity (for the simple and safe shutdown of networks or sub-networks).

Channels are either one-one (connecting a single writer process with a single reader), one-any (connecting a single writer process with any number of readers), any-one (connecting any number of writer processes with a single reader) or any-any (connecting any number of writer processes with any number of readers). Do not misuse them (e.g. use a one-one to connect more than one writer process to more than one reader).

Channels are used to construct process networks. Channel ends, obtained from a channel via its in() and out() methods, should be plugged into the processes that need them. An input-end is used for reading from the channel; an output-end is used for writing to the channel. A process should not be given a whole channel – only the end that it needs.

Channel input-ends of one-one and any-one channels may be used as guards in a choice. Channel input-ends of one-any or any-any channels may not be so used.

Channel output-ends of one-one symmetric channels may also be used as guards in a choice. Channel output-ends of all other kinds of channel may not. Symmetric channels are currently an experiment: buffering and poisoning are not yet supported.

For convenience, there are also methods for constructing arrays of channels (and for extracting arrays of channel-ends from arrays of channels).

Author:
P.H. Welch

Method Summary
static Any2AnyChannel any2any()
          This constructs an Object carrying channel that may be connected to any number of writer processes and any number of reader processes.
static Any2AnyChannel any2any(ChannelDataStore buffer)
          This constructs an any-any Object channel with user chosen buffering size and policy.
static Any2AnyChannel any2any(ChannelDataStore buffer, int immunity)
          This constructs a buffered poisonable any-any Object channel.
static Any2AnyChannel any2any(int immunity)
          This constructs a poisonable any-any Object channel.
static Any2AnyChannel[] any2anyArray(int size)
          This constructs an array of any-any Object channels.
static Any2AnyChannel[] any2anyArray(int size, ChannelDataStore buffer)
          This constructs an array of buffered any-any Object channels.
static Any2AnyChannel[] any2anyArray(int size, ChannelDataStore buffer, int immunity)
          This constructs an array of buffered poisonable any-any Object channels.
static Any2AnyChannel[] any2anyArray(int size, int immunity)
          This constructs an array of poisonable any-any Object channels.
static Any2AnyChannelInt any2anyInt()
          This constructs an integer carrying channel that may be connected to any number of writer processes and any number of reader processes.
static Any2AnyChannelInt any2anyInt(ChannelDataStoreInt buffer)
          This constructs an any-any integer channel with user chosen buffering size and policy.
static Any2AnyChannelInt any2anyInt(ChannelDataStoreInt buffer, int immunity)
          This constructs a buffered poisonable any-any integer channel.
static Any2AnyChannelInt any2anyInt(int immunity)
          This constructs a poisonable any-any integer channel.
static Any2AnyChannelInt[] any2anyIntArray(int size)
          This constructs an array of any-any integer channels.
static Any2AnyChannelInt[] any2anyIntArray(int size, ChannelDataStoreInt buffer)
          This constructs an array of buffered any-any integer channels.
static Any2AnyChannelInt[] any2anyIntArray(int size, ChannelDataStoreInt buffer, int immunity)
          This constructs an array of buffered poisonable any-any integer channels.
static Any2AnyChannelInt[] any2anyIntArray(int size, int immunity)
          This constructs an array of poisonable any-any integer channels.
static Any2OneChannel any2one()
          This constructs an Object carrying channel that may be connected to any number of writer processes, but only one reader at a time.
static Any2OneChannel any2one(ChannelDataStore buffer)
          This constructs an any-one Object channel with user chosen buffering size and policy.
static Any2OneChannel any2one(ChannelDataStore buffer, int immunity)
          This constructs a buffered poisonable any-one Object channel.
static Any2OneChannel any2one(int immunity)
          This constructs a poisonable any-one Object channel.
static Any2OneChannel[] any2oneArray(int size)
          This constructs an array of any-one Object channels.
static Any2OneChannel[] any2oneArray(int size, ChannelDataStore buffer)
          This constructs an array of buffered any-one Object channels.
static Any2OneChannel[] any2oneArray(int size, ChannelDataStore buffer, int immunity)
          This constructs an array of buffered poisonable any-one Object channels.
static Any2OneChannel[] any2oneArray(int size, int immunity)
          This constructs an array of poisonable any-one Object channels.
static Any2OneChannelInt any2oneInt()
          This constructs an integer carrying channel that may be connected to any number of writer processes, but only one reader at a time.
static Any2OneChannelInt any2oneInt(ChannelDataStoreInt buffer)
          This constructs an any-one integer channel with user chosen buffering size and policy.
static Any2OneChannelInt any2oneInt(ChannelDataStoreInt buffer, int immunity)
          This constructs a buffered poisonable any-one integer channel.
static Any2OneChannelInt any2oneInt(int immunity)
          This constructs a poisonable any-one integer channel.
static Any2OneChannelInt[] any2oneIntArray(int size)
          This constructs an array of any-one integer channels.
static Any2OneChannelInt[] any2oneIntArray(int size, ChannelDataStoreInt buffer)
          This constructs an array of buffered any-one integer channels.
static Any2OneChannelInt[] any2oneIntArray(int size, ChannelDataStoreInt buffer, int immunity)
          This constructs an array of buffered poisonable any-one integer channels.
static Any2OneChannelInt[] any2oneIntArray(int size, int immunity)
          This constructs an array of poisonable any-one integer channels.
static Any2AnyChannel createAny2Any()
          Deprecated. Use the any2any() method instead.
static Any2AnyChannel createAny2Any(ChannelDataStore buffer)
          Deprecated. Use the any2any(ChannelDataStore) method instead.
static Any2AnyChannel[] createAny2Any(ChannelDataStore buffer, int n)
          Deprecated. Use the any2anyArray(int,ChannelDataStore) method instead.
static Any2AnyChannel[] createAny2Any(int n)
          Deprecated. Use the any2anyArray(int) method instead.
static Any2OneChannel createAny2One()
          Deprecated. Use the any2one() method instead.
static Any2OneChannel createAny2One(ChannelDataStore buffer)
          Deprecated. Use the any2one(ChannelDataStore) method instead.
static Any2OneChannel[] createAny2One(ChannelDataStore buffer, int n)
          Deprecated. Use the any2oneArray(int,ChannelDataStore) method instead.
static Any2OneChannel[] createAny2One(int n)
          Deprecated. Use the any2oneArray(int) method instead.
static One2AnyChannel createOne2Any()
          Deprecated. Use the one2any() method instead.
static One2AnyChannel createOne2Any(ChannelDataStore buffer)
          Deprecated. Use the one2any(ChannelDataStore) method instead.
static One2AnyChannel[] createOne2Any(ChannelDataStore buffer, int n)
          Deprecated. Use the one2anyArray(int,ChannelDataStore) method instead.
static One2AnyChannel[] createOne2Any(int n)
          Deprecated. Use the one2anyArray(int) method instead.
static One2OneChannel createOne2One()
          Deprecated. Use the one2one() method instead.
static One2OneChannel createOne2One(ChannelDataStore buffer)
          Deprecated. Use the one2one(ChannelDataStore) method instead.
static One2OneChannel[] createOne2One(ChannelDataStore buffer, int n)
          Deprecated. Use the one2oneArray(int,ChannelDataStore) method instead.
static One2OneChannel[] createOne2One(int n)
          Deprecated. Use the one2oneArray(int) method instead.
static SharedChannelInput[] getInputArray(Any2AnyChannel[] c)
          This extracts the input-ends from the given channel array.
static SharedChannelInputInt[] getInputArray(Any2AnyChannelInt[] c)
          This extracts the input-ends from the given channel array.
static AltingChannelInput[] getInputArray(Any2OneChannel[] c)
          This extracts the input-ends from the given channel array.
static AltingChannelInputInt[] getInputArray(Any2OneChannelInt[] c)
          This extracts the input-ends from the given channel array.
static SharedChannelInput[] getInputArray(One2AnyChannel[] c)
          This extracts the input-ends from the given channel array.
static SharedChannelInputInt[] getInputArray(One2AnyChannelInt[] c)
          This extracts the input-ends from the given channel array.
static AltingChannelInput[] getInputArray(One2OneChannel[] c)
          This extracts the input-ends from the given channel array.
static AltingChannelInputInt[] getInputArray(One2OneChannelInt[] c)
          This extracts the input-ends from the given channel array.
static SharedChannelOutput[] getOutputArray(Any2AnyChannel[] c)
          This extracts the output-ends from the given channel array.
static SharedChannelOutputInt[] getOutputArray(Any2AnyChannelInt[] c)
          This extracts the output-ends from the given channel array.
static SharedChannelOutput[] getOutputArray(Any2OneChannel[] c)
          This extracts the output-ends from the given channel array.
static SharedChannelOutputInt[] getOutputArray(Any2OneChannelInt[] c)
          This extracts the output-ends from the given channel array.
static ChannelOutput[] getOutputArray(One2AnyChannel[] c)
          This extracts the output-ends from the given channel array.
static ChannelOutputInt[] getOutputArray(One2AnyChannelInt[] c)
          This extracts the output-ends from the given channel array.
static ChannelOutput[] getOutputArray(One2OneChannel[] c)
          This extracts the output-ends from the given channel array.
static ChannelOutputInt[] getOutputArray(One2OneChannelInt[] c)
          This extracts the output-ends from the given channel array.
static One2AnyChannel one2any()
          This constructs an Object carrying channel that may only be connected to one writer at a time, but any number of reader processes.
static One2AnyChannel one2any(ChannelDataStore buffer)
          This constructs a one-any Object channel with user chosen buffering size and policy.
static One2AnyChannel one2any(ChannelDataStore buffer, int immunity)
          This constructs a buffered poisonable one-any Object channel.
static One2AnyChannel one2any(int immunity)
          This constructs a poisonable one-any Object channel.
static One2AnyChannel[] one2anyArray(int size)
          This constructs an array of one-any Object channels.
static One2AnyChannel[] one2anyArray(int size, ChannelDataStore buffer)
          This constructs an array of buffered one-any Object channels.
static One2AnyChannel[] one2anyArray(int size, ChannelDataStore buffer, int immunity)
          This constructs an array of buffered poisonable one-any Object channels.
static One2AnyChannel[] one2anyArray(int size, int immunity)
          This constructs an array of poisonable one-any Object channels.
static One2AnyChannelInt one2anyInt()
          This constructs an integer carrying channel that may only be connected to one writer at a time, but any number of reader processes.
static One2AnyChannelInt one2anyInt(ChannelDataStoreInt buffer)
          This constructs a one-any integer channel with user chosen buffering size and policy.
static One2AnyChannelInt one2anyInt(ChannelDataStoreInt buffer, int immunity)
          This constructs a buffered poisonable one-any integer channel.
static One2AnyChannelInt one2anyInt(int immunity)
          This constructs a poisonable one-any integer channel.
static One2AnyChannelInt[] one2anyIntArray(int size)
          This constructs an array of one-any integer channels.
static One2AnyChannelInt[] one2anyIntArray(int size, ChannelDataStoreInt buffer)
          This constructs an array of buffered one-any integer channels.
static One2AnyChannelInt[] one2anyIntArray(int size, ChannelDataStoreInt buffer, int immunity)
          This constructs an array of buffered poisonable one-any integer channels.
static One2AnyChannelInt[] one2anyIntArray(int size, int immunity)
          This constructs an array of poisonable one-any integer channels.
static One2OneChannel one2one()
          This constructs an Object carrying channel that may only be connected to one writer and one reader process at a time.
static One2OneChannel one2one(ChannelDataStore buffer)
          This constructs a one-one Object channel with user chosen buffering size and policy.
static One2OneChannel one2one(ChannelDataStore buffer, int immunity)
          This constructs a buffered poisonable one-one Object channel.
static One2OneChannel one2one(int immunity)
          This constructs a poisonable one-one Object channel.
static One2OneChannel[] one2oneArray(int size)
          This constructs an array of one-one Object channels.
static One2OneChannel[] one2oneArray(int size, ChannelDataStore buffer)
          This constructs an array of buffered one-one Object channels.
static One2OneChannel[] one2oneArray(int size, ChannelDataStore buffer, int immunity)
          This constructs an array of buffered poisonable one-one Object channels.
static One2OneChannel[] one2oneArray(int size, int immunity)
          This constructs an array of poisonable one-one Object channels.
static One2OneChannelInt one2oneInt()
          This constructs an integer carrying channel that may only be connected to one writer and one reader process at a time.
static One2OneChannelInt one2oneInt(ChannelDataStoreInt buffer)
          This constructs a one-one integer channel with user chosen buffering size and policy.
static One2OneChannelInt one2oneInt(ChannelDataStoreInt buffer, int immunity)
          This constructs a buffered poisonable one-one integer channel.
static One2OneChannelInt one2oneInt(int immunity)
          This constructs a poisonable one-one integer channel.
static One2OneChannelInt[] one2oneIntArray(int size)
          This constructs an array of one-one integer channels.
static One2OneChannelInt[] one2oneIntArray(int size, ChannelDataStoreInt buffer)
          This constructs an array of buffered one-one integer channels.
static One2OneChannelInt[] one2oneIntArray(int size, ChannelDataStoreInt buffer, int immunity)
          This constructs an array of buffered poisonable one-one integer channels.
static One2OneChannelInt[] one2oneIntArray(int size, int immunity)
          This constructs an array of poisonable one-one integer channels.
static One2OneChannelSymmetric one2oneSymmetric()
          This constructs an Object carrying channel that may only be connected to one writer and one reader process at a time.
static One2OneChannelSymmetric[] one2oneSymmetricArray(int size)
          This constructs an array of symmetric one-one Object channels.
static One2OneChannelSymmetricInt one2oneSymmetricInt()
          This constructs an integer carrying channel that may only be connected to one writer and one reader process at a time.
static One2OneChannelSymmetricInt[] one2oneSymmetricIntArray(int size)
          This constructs an array of symmetric one-one integer channels.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

one2one

public static One2OneChannel one2one()
This constructs an Object carrying channel that may only be connected to one writer and one reader process at a time. The channel is zero-buffered – the writer and reader processes must synchronise.

Returns:
the channel.

one2any

public static One2AnyChannel one2any()
This constructs an Object carrying channel that may only be connected to one writer at a time, but any number of reader processes. The readers contend safely with each other to take the next message. Each message flows from the writer to just one of the readers – this is not a broadcasting channel. The channel is zero-buffered – the writer and reader processes must synchronise.

Returns:
the channel.

any2one

public static Any2OneChannel any2one()
This constructs an Object carrying channel that may be connected to any number of writer processes, but only one reader at a time. The writers contend safely with each other to send the next message. Each message flows from just one of the writers to the reader – this is not a combining channel. The channel is zero-buffered – the writer and reader processes must synchronise.

Returns:
the channel.

any2any

public static Any2AnyChannel any2any()
This constructs an Object carrying channel that may be connected to any number of writer processes and any number of reader processes. The writers contend safely with each other to send the next message. The readers contend safely with each other to take the next message. Each message flows from just one of the writers to just one of the readers – this is not a broadcasting-and-combining channel. The channel is zero-buffered – the writer and reader processes must synchronise.

Returns:
the channel.

one2one

public static One2OneChannel one2one(ChannelDataStore buffer)
This constructs a one-one Object channel with user chosen buffering size and policy.

Parameters:
buffer - defines size and policy (the channel will clone its own).
Returns:
the channel.

one2any

public static One2AnyChannel one2any(ChannelDataStore buffer)
This constructs a one-any Object channel with user chosen buffering size and policy.

Parameters:
buffer - defines size and policy (the channel will clone its own).
Returns:
the channel.

any2one

public static Any2OneChannel any2one(ChannelDataStore buffer)
This constructs an any-one Object channel with user chosen buffering size and policy.

Parameters:
buffer - defines size and policy (the channel will clone its own).
Returns:
the channel.

any2any

public static Any2AnyChannel any2any(ChannelDataStore buffer)
This constructs an any-any Object channel with user chosen buffering size and policy.

Parameters:
buffer - defines size and policy (the channel will clone its own).
Returns:
the channel.

one2one

public static One2OneChannel one2one(int immunity)
This constructs a poisonable one-one Object channel.

Parameters:
immunity - the channel is immune to poison strengths up to and including this level.
Returns:
the channel.

one2any

public static One2AnyChannel one2any(int immunity)
This constructs a poisonable one-any Object channel.

Parameters:
immunity - the channel is immune to poison strengths up to and including this level.
Returns:
the channel.

any2one

public static Any2OneChannel any2one(int immunity)
This constructs a poisonable any-one Object channel.

Parameters:
immunity - the channel is immune to poison strengths up to and including this level.
Returns:
the channel.

any2any

public static Any2AnyChannel any2any(int immunity)
This constructs a poisonable any-any Object channel.

Parameters:
immunity - the channel is immune to poison strengths up to and including this level.
Returns:
the channel.

one2one

public static One2OneChannel one2one(ChannelDataStore buffer,
                                     int immunity)
This constructs a buffered poisonable one-one Object channel.

Parameters:
buffer - defines size and policy (the channel will clone its own).
immunity - the channel is immune to poison strengths up to and including this level.
Returns:
the channel.

one2any

public static One2AnyChannel one2any(ChannelDataStore buffer,
                                     int immunity)
This constructs a buffered poisonable one-any Object channel.

Parameters:
buffer - defines size and policy (the channel will clone its own).
immunity - the channel is immune to poison strengths up to and including this level.
Returns:
the channel.

any2one

public static Any2OneChannel any2one(ChannelDataStore buffer,
                                     int immunity)
This constructs a buffered poisonable any-one Object channel.

Parameters:
buffer - defines size and policy (the channel will clone its own).
immunity - the channel is immune to poison strengths up to and including this level.
Returns:
the channel.

any2any

public static Any2AnyChannel any2any(ChannelDataStore buffer,
                                     int immunity)
This constructs a buffered poisonable any-any Object channel.

Parameters:
buffer - defines size and policy (the channel will clone its own).
immunity - the channel is immune to poison strengths up to and including this level.
Returns:
the channel.

one2oneArray

public static One2OneChannel[] one2oneArray(int size)
This constructs an array of one-one Object channels.

Parameters:
size - defines size of the array (must be positive).
Returns:
the channel array.

one2anyArray

public static One2AnyChannel[] one2anyArray(int size)
This constructs an array of one-any Object channels.

Parameters:
size - defines size of the array (must be positive).
Returns:
the channel array.

any2oneArray

public static Any2OneChannel[] any2oneArray(int size)
This constructs an array of any-one Object channels.

Parameters:
size - defines size of the array (must be positive).
Returns:
the channel array.

any2anyArray

public static Any2AnyChannel[] any2anyArray(int size)
This constructs an array of any-any Object channels.

Parameters:
size - defines size of the array (must be positive).
Returns:
the channel array.

one2oneArray

public static One2OneChannel[] one2oneArray(int size,
                                            int immunity)
This constructs an array of poisonable one-one Object channels.

Parameters:
size - defines size of the array (must be positive).
immunity - the channels are immune to poison strengths up to and including this level.
Returns:
the channel array.

one2anyArray

public static One2AnyChannel[] one2anyArray(int size,
                                            int immunity)
This constructs an array of poisonable one-any Object channels.

Parameters:
size - defines size of the array (must be positive).
immunity - the channels are immune to poison strengths up to and including this level.
Returns:
the channel array.

any2oneArray

public static Any2OneChannel[] any2oneArray(int size,
                                            int immunity)
This constructs an array of poisonable any-one Object channels.

Parameters:
size - defines size of the array (must be positive).
immunity - the channels are immune to poison strengths up to and including this level.
Returns:
the channel array.

any2anyArray

public static Any2AnyChannel[] any2anyArray(int size,
                                            int immunity)
This constructs an array of poisonable any-any Object channels.

Parameters:
size - defines size of the array (must be positive).
immunity - the channels are immune to poison strengths up to and including this level.
Returns:
the channel array.

one2oneArray

public static One2OneChannel[] one2oneArray(int size,
                                            ChannelDataStore buffer)
This constructs an array of buffered one-one Object channels.

Parameters:
size - defines size of the array (must be positive).
buffer - defines size and policy (the channel will clone its own).
Returns:
the channel array.

one2anyArray

public static One2AnyChannel[] one2anyArray(int size,
                                            ChannelDataStore buffer)
This constructs an array of buffered one-any Object channels.

Parameters:
size - defines size of the array (must be positive).
buffer - defines size and policy (the channel will clone its own).
Returns:
the channel array.

any2oneArray

public static Any2OneChannel[] any2oneArray(int size,
                                            ChannelDataStore buffer)
This constructs an array of buffered any-one Object channels.

Parameters:
size - defines size of the array (must be positive).
buffer - defines size and policy (the channel will clone its own).
Returns:
the channel array.

any2anyArray

public static Any2AnyChannel[] any2anyArray(int size,
                                            ChannelDataStore buffer)
This constructs an array of buffered any-any Object channels.

Parameters:
size - defines size of the array (must be positive).
buffer - defines size and policy (the channel will clone its own).
Returns:
the channel array.

one2oneArray

public static One2OneChannel[] one2oneArray(int size,
                                            ChannelDataStore buffer,
                                            int immunity)
This constructs an array of buffered poisonable one-one Object channels.

Parameters:
size - defines size of the array (must be positive).
buffer - defines size and policy (the channel will clone its own).
immunity - the channels are immune to poison strengths up to and including this level.
Returns:
the channel array.

one2anyArray

public static One2AnyChannel[] one2anyArray(int size,
                                            ChannelDataStore buffer,
                                            int immunity)
This constructs an array of buffered poisonable one-any Object channels.

Parameters:
size - defines size of the array (must be positive).
buffer - defines size and policy (the channel will clone its own).
immunity - the channels are immune to poison strengths up to and including this level.
Returns:
the channel array.

any2oneArray

public static Any2OneChannel[] any2oneArray(int size,
                                            ChannelDataStore buffer,
                                            int immunity)
This constructs an array of buffered poisonable any-one Object channels.

Parameters:
size - defines size of the array (must be positive).
buffer - defines size and policy (the channel will clone its own).
immunity - the channels are immune to poison strengths up to and including this level.
Returns:
the channel array.

any2anyArray

public static Any2AnyChannel[] any2anyArray(int size,
                                            ChannelDataStore buffer,
                                            int immunity)
This constructs an array of buffered poisonable any-any Object channels.

Parameters:
size - defines size of the array (must be positive).
buffer - defines size and policy (the channel will clone its own).
immunity - the channels are immune to poison strengths up to and including this level.
Returns:
the channel array.

one2oneSymmetric

public static One2OneChannelSymmetric one2oneSymmetric()
This constructs an Object carrying channel that may only be connected to one writer and one reader process at a time. The channel is zero-buffered – the writer and reader processes must synchronise.

The symmetry relates to the use of the channel's ends as guards in an Alternative: both ends may be so used.

Returns:
the channel.

one2oneSymmetricArray

public static One2OneChannelSymmetric[] one2oneSymmetricArray(int size)
This constructs an array of symmetric one-one Object channels.

Parameters:
size - defines size of the array (must be positive).
Returns:
the channel array.

one2oneInt

public static One2OneChannelInt one2oneInt()
This constructs an integer carrying channel that may only be connected to one writer and one reader process at a time. The channel is zero-buffered – the writer and reader processes must synchronise.

Returns:
the channel.

one2anyInt

public static One2AnyChannelInt one2anyInt()
This constructs an integer carrying channel that may only be connected to one writer at a time, but any number of reader processes. The readers contend safely with each other to take the next message. Each message flows from the writer to just one of the readers – this is not a broadcasting channel. The channel is zero-buffered – the writer and reader processes must synchronise.

Returns:
the channel.

any2oneInt

public static Any2OneChannelInt any2oneInt()
This constructs an integer carrying channel that may be connected to any number of writer processes, but only one reader at a time. The writers contend safely with each other to send the next message. Each message flows from just one of the writers to the reader – this is not a combining channel. The channel is zero-buffered – the writer and reader processes must synchronise.

Returns:
the channel.

any2anyInt

public static Any2AnyChannelInt any2anyInt()
This constructs an integer carrying channel that may be connected to any number of writer processes and any number of reader processes. The writers contend safely with each other to send the next message. The readers contend safely with each other to take the next message. Each message flows from just one of the writers to just one of the readers – this is not a broadcasting-and-combining channel. The channel is zero-buffered – the writer and reader processes must synchronise.

Returns:
the channel.

one2oneInt

public static One2OneChannelInt one2oneInt(ChannelDataStoreInt buffer)
This constructs a one-one integer channel with user chosen buffering size and policy.

Parameters:
buffer - defines size and policy (the channel will clone its own).
Returns:
the channel.

one2anyInt

public static One2AnyChannelInt one2anyInt(ChannelDataStoreInt buffer)
This constructs a one-any integer channel with user chosen buffering size and policy.

Parameters:
buffer - defines size and policy (the channel will clone its own).
Returns:
the channel.

any2oneInt

public static Any2OneChannelInt any2oneInt(ChannelDataStoreInt buffer)
This constructs an any-one integer channel with user chosen buffering size and policy.

Parameters:
buffer - defines size and policy (the channel will clone its own).
Returns:
the channel.

any2anyInt

public static Any2AnyChannelInt any2anyInt(ChannelDataStoreInt buffer)
This constructs an any-any integer channel with user chosen buffering size and policy.

Parameters:
buffer - defines size and policy (the channel will clone its own).
Returns:
the channel.

one2oneInt

public static One2OneChannelInt one2oneInt(int immunity)
This constructs a poisonable one-one integer channel.

Parameters:
immunity - the channel is immune to poison strengths up to and including this level.
Returns:
the channel.

one2anyInt

public static One2AnyChannelInt one2anyInt(int immunity)
This constructs a poisonable one-any integer channel.

Parameters:
immunity - the channel is immune to poison strengths up to and including this level.
Returns:
the channel.

any2oneInt

public static Any2OneChannelInt any2oneInt(int immunity)
This constructs a poisonable any-one integer channel.

Parameters:
immunity - the channel is immune to poison strengths up to and including this level.
Returns:
the channel.

any2anyInt

public static Any2AnyChannelInt any2anyInt(int immunity)
This constructs a poisonable any-any integer channel.

Parameters:
immunity - the channel is immune to poison strengths up to and including this level.
Returns:
the channel.

one2oneInt

public static One2OneChannelInt one2oneInt(ChannelDataStoreInt buffer,
                                           int immunity)
This constructs a buffered poisonable one-one integer channel.

Parameters:
buffer - defines size and policy (the channel will clone its own).
immunity - the channel is immune to poison strengths up to and including this level.
Returns:
the channel.

one2anyInt

public static One2AnyChannelInt one2anyInt(ChannelDataStoreInt buffer,
                                           int immunity)
This constructs a buffered poisonable one-any integer channel.

Parameters:
buffer - defines size and policy (the channel will clone its own).
immunity - the channel is immune to poison strengths up to and including this level.
Returns:
the channel.

any2oneInt

public static Any2OneChannelInt any2oneInt(ChannelDataStoreInt buffer,
                                           int immunity)
This constructs a buffered poisonable any-one integer channel.

Parameters:
buffer - defines size and policy (the channel will clone its own).
immunity - the channel is immune to poison strengths up to and including this level.
Returns:
the channel.

any2anyInt

public static Any2AnyChannelInt any2anyInt(ChannelDataStoreInt buffer,
                                           int immunity)
This constructs a buffered poisonable any-any integer channel.

Parameters:
buffer - defines size and policy (the channel will clone its own).
immunity - the channel is immune to poison strengths up to and including this level.
Returns:
the channel.

one2oneIntArray

public static One2OneChannelInt[] one2oneIntArray(int size)
This constructs an array of one-one integer channels.

Parameters:
size - defines size of the array (must be positive).
Returns:
the channel array.

one2anyIntArray

public static One2AnyChannelInt[] one2anyIntArray(int size)
This constructs an array of one-any integer channels.

Parameters:
size - defines size of the array (must be positive).
Returns:
the channel array.

any2oneIntArray

public static Any2OneChannelInt[] any2oneIntArray(int size)
This constructs an array of any-one integer channels.

Parameters:
size - defines size of the array (must be positive).
Returns:
the channel array.

any2anyIntArray

public static Any2AnyChannelInt[] any2anyIntArray(int size)
This constructs an array of any-any integer channels.

Parameters:
size - defines size of the array (must be positive).
Returns:
the channel array.

one2oneIntArray

public static One2OneChannelInt[] one2oneIntArray(int size,
                                                  int immunity)
This constructs an array of poisonable one-one integer channels.

Parameters:
size - defines size of the array (must be positive).
immunity - the channels are immune to poison strengths up to and including this level.
Returns:
the channel array.

one2anyIntArray

public static One2AnyChannelInt[] one2anyIntArray(int size,
                                                  int immunity)
This constructs an array of poisonable one-any integer channels.

Parameters:
size - defines size of the array (must be positive).
immunity - the channels are immune to poison strengths up to and including this level.
Returns:
the channel array.

any2oneIntArray

public static Any2OneChannelInt[] any2oneIntArray(int size,
                                                  int immunity)
This constructs an array of poisonable any-one integer channels.

Parameters:
size - defines size of the array (must be positive).
immunity - the channels are immune to poison strengths up to and including this level.
Returns:
the channel array.

any2anyIntArray

public static Any2AnyChannelInt[] any2anyIntArray(int size,
                                                  int immunity)
This constructs an array of poisonable any-any integer channels.

Parameters:
size - defines size of the array (must be positive).
immunity - the channels are immune to poison strengths up to and including this level.
Returns:
the channel array.

one2oneIntArray

public static One2OneChannelInt[] one2oneIntArray(int size,
                                                  ChannelDataStoreInt buffer)
This constructs an array of buffered one-one integer channels.

Parameters:
size - defines size of the array (must be positive).
buffer - defines size and policy (the channel will clone its own).
Returns:
the channel array.

one2anyIntArray

public static One2AnyChannelInt[] one2anyIntArray(int size,
                                                  ChannelDataStoreInt buffer)
This constructs an array of buffered one-any integer channels.

Parameters:
size - defines size of the array (must be positive).
buffer - defines size and policy (the channel will clone its own).
Returns:
the channel array.

any2oneIntArray

public static Any2OneChannelInt[] any2oneIntArray(int size,
                                                  ChannelDataStoreInt buffer)
This constructs an array of buffered any-one integer channels.

Parameters:
size - defines size of the array (must be positive).
buffer - defines size and policy (the channel will clone its own).
Returns:
the channel array.

any2anyIntArray

public static Any2AnyChannelInt[] any2anyIntArray(int size,
                                                  ChannelDataStoreInt buffer)
This constructs an array of buffered any-any integer channels.

Parameters:
size - defines size of the array (must be positive).
buffer - defines size and policy (the channel will clone its own).
Returns:
the channel array.

one2oneIntArray

public static One2OneChannelInt[] one2oneIntArray(int size,
                                                  ChannelDataStoreInt buffer,
                                                  int immunity)
This constructs an array of buffered poisonable one-one integer channels.

Parameters:
size - defines size of the array (must be positive).
buffer - defines size and policy (the channel will clone its own).
immunity - the channels are immune to poison strengths up to and including this level.
Returns:
the channel array.

one2anyIntArray

public static One2AnyChannelInt[] one2anyIntArray(int size,
                                                  ChannelDataStoreInt buffer,
                                                  int immunity)
This constructs an array of buffered poisonable one-any integer channels.

Parameters:
size - defines size of the array (must be positive).
buffer - defines size and policy (the channel will clone its own).
immunity - the channels are immune to poison strengths up to and including this level.
Returns:
the channel array.

any2oneIntArray

public static Any2OneChannelInt[] any2oneIntArray(int size,
                                                  ChannelDataStoreInt buffer,
                                                  int immunity)
This constructs an array of buffered poisonable any-one integer channels.

Parameters:
size - defines size of the array (must be positive).
buffer - defines size and policy (the channel will clone its own).
immunity - the channels are immune to poison strengths up to and including this level.
Returns:
the channel array.

any2anyIntArray

public static Any2AnyChannelInt[] any2anyIntArray(int size,
                                                  ChannelDataStoreInt buffer,
                                                  int immunity)
This constructs an array of buffered poisonable any-any integer channels.

Parameters:
size - defines size of the array (must be positive).
buffer - defines size and policy (the channel will clone its own).
immunity - the channels are immune to poison strengths up to and including this level.
Returns:
the channel array.

one2oneSymmetricInt

public static One2OneChannelSymmetricInt one2oneSymmetricInt()
This constructs an integer carrying channel that may only be connected to one writer and one reader process at a time. The channel is zero-buffered – the writer and reader processes must synchronise.

The symmetry relates to the use of the channel's ends as guards in an Alternative: both ends may be so used.

Returns:
the channel.

one2oneSymmetricIntArray

public static One2OneChannelSymmetricInt[] one2oneSymmetricIntArray(int size)
This constructs an array of symmetric one-one integer channels.

Parameters:
size - defines size of the array (must be positive).
Returns:
the channel array.

getInputArray

public static AltingChannelInput[] getInputArray(One2OneChannel[] c)
This extracts the input-ends from the given channel array. Each element of the returned array is the input-end of the channel at the corresponding index in the given channel array.

Parameters:
c - an array of channels.
Returns:
the array of input-ends from the given channel array.

getInputArray

public static SharedChannelInput[] getInputArray(One2AnyChannel[] c)
This extracts the input-ends from the given channel array. Each element of the returned array is the input-end of the channel at the corresponding index in the given channel array.

Parameters:
c - an array of channels.
Returns:
the array of input-ends from the given channel array.

getInputArray

public static AltingChannelInput[] getInputArray(Any2OneChannel[] c)
This extracts the input-ends from the given channel array. Each element of the returned array is the input-end of the channel at the corresponding index in the given channel array.

Parameters:
c - an array of channels.
Returns:
the array of input-ends from the given channel array.

getInputArray

public static SharedChannelInput[] getInputArray(Any2AnyChannel[] c)
This extracts the input-ends from the given channel array. Each element of the returned array is the input-end of the channel at the corresponding index in the given channel array.

Parameters:
c - an array of channels.
Returns:
the array of input-ends from the given channel array.

getOutputArray

public static ChannelOutput[] getOutputArray(One2OneChannel[] c)
This extracts the output-ends from the given channel array. Each element of the returned array is the output-end of the channel at the corresponding index in the given channel array.

Parameters:
c - an array of channels.
Returns:
the array of output-ends from the given channel array.

getOutputArray

public static ChannelOutput[] getOutputArray(One2AnyChannel[] c)
This extracts the output-ends from the given channel array. Each element of the returned array is the output-end of the channel at the corresponding index in the given channel array.

Parameters:
c - an array of channels.
Returns:
the array of output-ends from the given channel array.

getOutputArray

public static SharedChannelOutput[] getOutputArray(Any2OneChannel[] c)
This extracts the output-ends from the given channel array. Each element of the returned array is the output-end of the channel at the corresponding index in the given channel array.

Parameters:
c - an array of channels.
Returns:
the array of output-ends from the given channel array.

getOutputArray

public static SharedChannelOutput[] getOutputArray(Any2AnyChannel[] c)
This extracts the output-ends from the given channel array. Each element of the returned array is the output-end of the channel at the corresponding index in the given channel array.

Parameters:
c - an array of channels.
Returns:
the array of output-ends from the given channel array.

getInputArray

public static AltingChannelInputInt[] getInputArray(One2OneChannelInt[] c)
This extracts the input-ends from the given channel array. Each element of the returned array is the input-end of the channel at the corresponding index in the given channel array.

Parameters:
c - an array of channels.
Returns:
the array of input-ends from the given channel array.

getInputArray

public static SharedChannelInputInt[] getInputArray(One2AnyChannelInt[] c)
This extracts the input-ends from the given channel array. Each element of the returned array is the input-end of the channel at the corresponding index in the given channel array.

Parameters:
c - an array of channels.
Returns:
the array of input-ends from the given channel array.

getInputArray

public static AltingChannelInputInt[] getInputArray(Any2OneChannelInt[] c)
This extracts the input-ends from the given channel array. Each element of the returned array is the input-end of the channel at the corresponding index in the given channel array.

Parameters:
c - an array of channels.
Returns:
the array of input-ends from the given channel array.

getInputArray

public static SharedChannelInputInt[] getInputArray(Any2AnyChannelInt[] c)
This extracts the input-ends from the given channel array. Each element of the returned array is the input-end of the channel at the corresponding index in the given channel array.

Parameters:
c - an array of channels.
Returns:
the array of input-ends from the given channel array.

getOutputArray

public static ChannelOutputInt[] getOutputArray(One2OneChannelInt[] c)
This extracts the output-ends from the given channel array. Each element of the returned array is the output-end of the channel at the corresponding index in the given channel array.

Parameters:
c - an array of channels.
Returns:
the array of output-ends from the given channel array.

getOutputArray

public static ChannelOutputInt[] getOutputArray(One2AnyChannelInt[] c)
This extracts the output-ends from the given channel array. Each element of the returned array is the output-end of the channel at the corresponding index in the given channel array.

Parameters:
c - an array of channels.
Returns:
the array of output-ends from the given channel array.

getOutputArray

public static SharedChannelOutputInt[] getOutputArray(Any2OneChannelInt[] c)
This extracts the output-ends from the given channel array. Each element of the returned array is the output-end of the channel at the corresponding index in the given channel array.

Parameters:
c - an array of channels.
Returns:
the array of output-ends from the given channel array.

getOutputArray

public static SharedChannelOutputInt[] getOutputArray(Any2AnyChannelInt[] c)
This extracts the output-ends from the given channel array. Each element of the returned array is the output-end of the channel at the corresponding index in the given channel array.

Parameters:
c - an array of channels.
Returns:
the array of output-ends from the given channel array.

createOne2One

public static One2OneChannel createOne2One()
Deprecated. Use the one2one() method instead.

Constructs and returns a One2OneChannel object.

Returns:
the channel.
See Also:
ChannelFactory.createOne2One()

createAny2One

public static Any2OneChannel createAny2One()
Deprecated. Use the any2one() method instead.

Constructs and returns an Any2OneChannel object.

Returns:
the channel.
See Also:
ChannelFactory.createAny2One()

createOne2Any

public static One2AnyChannel createOne2Any()
Deprecated. Use the one2any() method instead.

Constructs and returns a One2AnyChannel object.

Returns:
the channel.
See Also:
ChannelFactory.createOne2Any()

createAny2Any

public static Any2AnyChannel createAny2Any()
Deprecated. Use the any2any() method instead.

Constructs and returns an Any2AnyChannel object.

Returns:
the channel.
See Also:
ChannelFactory.createAny2Any()

createOne2One

public static One2OneChannel[] createOne2One(int n)
Deprecated. Use the one2oneArray(int) method instead.

Constructs and returns an array of One2OneChannel objects.

Parameters:
n - the size of the array of channels.
Returns:
the array of channels.
See Also:
ChannelArrayFactory.createOne2One(int)

createAny2One

public static Any2OneChannel[] createAny2One(int n)
Deprecated. Use the any2oneArray(int) method instead.

Constructs and returns an array of Any2OneChannel objects.

Parameters:
n - the size of the array of channels.
Returns:
the array of channels.
See Also:
ChannelArrayFactory.createAny2One(int)

createOne2Any

public static One2AnyChannel[] createOne2Any(int n)
Deprecated. Use the one2anyArray(int) method instead.

Constructs and returns an array of One2AnyChannel objects.

Parameters:
n - the size of the array of channels.
Returns:
the array of channels.
See Also:
ChannelArrayFactory.createOne2Any(int)

createAny2Any

public static Any2AnyChannel[] createAny2Any(int n)
Deprecated. Use the any2anyArray(int) method instead.

Constructs and returns an array of Any2AnyChannel objects.

Parameters:
n - the size of the array of channels.
Returns:
the array of channels.
See Also:
ChannelArrayFactory.createAny2Any(int)

createOne2One

public static One2OneChannel createOne2One(ChannelDataStore buffer)
Deprecated. Use the one2one(ChannelDataStore) method instead.

Constructs and returns a One2OneChannel object which uses the specified ChannelDataStore object as a buffer.

The buffer supplied to this method is cloned before it is inserted into the channel.

Parameters:
buffer - the ChannelDataStore to use.
Returns:
the buffered channel.
See Also:
BufferedChannelFactory.createOne2One(ChannelDataStore), ChannelDataStore

createAny2One

public static Any2OneChannel createAny2One(ChannelDataStore buffer)
Deprecated. Use the any2one(ChannelDataStore) method instead.

Constructs and returns a Any2OneChannel object which uses the specified ChannelDataStore object as a buffer.

The buffer supplied to this method is cloned before it is inserted into the channel.

Parameters:
buffer - the ChannelDataStore to use.
Returns:
the buffered channel.
See Also:
BufferedChannelFactory.createAny2One(ChannelDataStore), ChannelDataStore

createOne2Any

public static One2AnyChannel createOne2Any(ChannelDataStore buffer)
Deprecated. Use the one2any(ChannelDataStore) method instead.

Constructs and returns a One2AnyChannel object which uses the specified ChannelDataStore object as a buffer.

The buffer supplied to this method is cloned before it is inserted into the channel.

Parameters:
buffer - the ChannelDataStore to use.
Returns:
the buffered channel.
See Also:
BufferedChannelFactory.createOne2Any(ChannelDataStore), ChannelDataStore

createAny2Any

public static Any2AnyChannel createAny2Any(ChannelDataStore buffer)
Deprecated. Use the any2any(ChannelDataStore) method instead.

Constructs and returns a Any2AnyChannel object which uses the specified ChannelDataStore object as a buffer.

The buffer supplied to this method is cloned before it is inserted into the channel.

Parameters:
buffer - the ChannelDataStore to use.
Returns:
the buffered channel.
See Also:
BufferedChannelFactory.createAny2Any(ChannelDataStore), ChannelDataStore

createOne2One

public static One2OneChannel[] createOne2One(ChannelDataStore buffer,
                                             int n)
Deprecated. Use the one2oneArray(int,ChannelDataStore) method instead.

Constructs and returns an array of One2OneChannel objects which use the specified ChannelDataStore object as a buffer.

The buffer supplied to this method is cloned before it is inserted into the channel. This is why an array of buffers is not required.

Parameters:
buffer - the ChannelDataStore to use.
n - the size of the array of channels.
Returns:
the array of buffered channels.
See Also:
BufferedChannelArrayFactory.createOne2One(ChannelDataStore, int), ChannelDataStore

createAny2One

public static Any2OneChannel[] createAny2One(ChannelDataStore buffer,
                                             int n)
Deprecated. Use the any2oneArray(int,ChannelDataStore) method instead.

Constructs and returns an array of Any2OneChannel objects which use the specified ChannelDataStore object as a buffer.

The buffer supplied to this method is cloned before it is inserted into the channel. This is why an array of buffers is not required.

Parameters:
buffer - the ChannelDataStore to use.
n - the size of the array of channels.
Returns:
the array of buffered channels.
See Also:
BufferedChannelArrayFactory.createAny2One(ChannelDataStore, int), ChannelDataStore

createOne2Any

public static One2AnyChannel[] createOne2Any(ChannelDataStore buffer,
                                             int n)
Deprecated. Use the one2anyArray(int,ChannelDataStore) method instead.

Constructs and returns an array of One2AnyChannel objects which use the specified ChannelDataStore object as a buffer.

The buffer supplied to this method is cloned before it is inserted into the channel. This is why an array of buffers is not required.

Parameters:
buffer - the ChannelDataStore to use.
n - the size of the array of channels.
Returns:
the array of buffered channels.
See Also:
BufferedChannelArrayFactory.createOne2Any(ChannelDataStore, int), ChannelDataStore

createAny2Any

public static Any2AnyChannel[] createAny2Any(ChannelDataStore buffer,
                                             int n)
Deprecated. Use the any2anyArray(int,ChannelDataStore) method instead.

Constructs and returns an array of Any2AnyChannel objects which use the specified ChannelDataStore object as a buffer.

The buffer supplied to this method is cloned before it is inserted into the channel. This is why an array of buffers is not required.

Parameters:
buffer - the ChannelDataStore to use.
n - the size of the array of channels.
Returns:
the array of buffered channels.
See Also:
BufferedChannelArrayFactory.createAny2Any(ChannelDataStore, int), ChannelDataStore

CSP for Java
(JCSP) 1.1-rc4

Submit a bug or feature to jcsp-team@kent.ac.uk
Version 1.1-rc4 of the JCSP API Specification (Copyright 1997-2008 P.D.Austin and P.H.Welch - All Rights Reserved)
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.