Class Channel
- java.lang.Object
-
- 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 achoice
. 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 asguards
in achoice
. 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
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <T> Any2AnyChannel<T>
any2any()
This constructs an Object carrying channel that may be connected to any number of writer processes and any number of reader processes.static <T> Any2AnyChannel<T>
any2any(int immunity)
This constructs a poisonable any-any Object channel.static <T> Any2AnyChannel<T>
any2any(ChannelDataStore<T> buffer)
This constructs an any-any Object channel with user chosen buffering size and policy.static <T> Any2AnyChannel<T>
any2any(ChannelDataStore<T> buffer, int immunity)
This constructs a buffered poisonable any-any Object channel.static <T> Any2AnyChannel<T>[]
any2anyArray(int size)
This constructs an array of any-any Object channels.static <T> Any2AnyChannel<T>[]
any2anyArray(int size, int immunity)
This constructs an array of poisonable any-any Object channels.static <T> Any2AnyChannel<T>[]
any2anyArray(int size, ChannelDataStore<T> buffer)
This constructs an array of buffered any-any Object channels.static <T> Any2AnyChannel<T>[]
any2anyArray(int size, ChannelDataStore<T> buffer, int immunity)
This constructs an array of buffered 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(int immunity)
This constructs a poisonable any-any integer channel.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[]
any2anyIntArray(int size)
This constructs an array of any-any integer channels.static Any2AnyChannelInt[]
any2anyIntArray(int size, int immunity)
This constructs an array of poisonable 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 <T> Any2OneChannel<T>
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 <T> Any2OneChannel<T>
any2one(int immunity)
This constructs a poisonable any-one Object channel.static <T> Any2OneChannel<T>
any2one(ChannelDataStore<T> buffer)
This constructs an any-one Object channel with user chosen buffering size and policy.static <T> Any2OneChannel<T>
any2one(ChannelDataStore<T> buffer, int immunity)
This constructs a buffered poisonable any-one Object channel.static <T> Any2OneChannel<T>[]
any2oneArray(int size)
This constructs an array of any-one Object channels.static <T> Any2OneChannel<T>[]
any2oneArray(int size, int immunity)
This constructs an array of poisonable any-one Object channels.static <T> Any2OneChannel<T>[]
any2oneArray(int size, ChannelDataStore<T> buffer)
This constructs an array of buffered any-one Object channels.static <T> Any2OneChannel<T>[]
any2oneArray(int size, ChannelDataStore<T> buffer, int immunity)
This constructs an array of buffered 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(int immunity)
This constructs a poisonable any-one integer channel.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[]
any2oneIntArray(int size)
This constructs an array of any-one integer channels.static Any2OneChannelInt[]
any2oneIntArray(int size, int immunity)
This constructs an array of poisonable 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 Any2AnyChannel
createAny2Any()
Deprecated.Use theany2any()
method instead.static Any2AnyChannel[]
createAny2Any(int n)
Deprecated.Use theany2anyArray(int)
method instead.static Any2AnyChannel
createAny2Any(ChannelDataStore buffer)
Deprecated.Use theany2any(ChannelDataStore)
method instead.static Any2AnyChannel[]
createAny2Any(ChannelDataStore buffer, int n)
Deprecated.Use theany2anyArray(int,ChannelDataStore)
method instead.static Any2OneChannel
createAny2One()
Deprecated.Use theany2one()
method instead.static Any2OneChannel[]
createAny2One(int n)
Deprecated.Use theany2oneArray(int)
method instead.static Any2OneChannel
createAny2One(ChannelDataStore buffer)
Deprecated.Use theany2one(ChannelDataStore)
method instead.static Any2OneChannel[]
createAny2One(ChannelDataStore buffer, int n)
Deprecated.Use theany2oneArray(int,ChannelDataStore)
method instead.static One2AnyChannel
createOne2Any()
Deprecated.Use theone2any()
method instead.static One2AnyChannel[]
createOne2Any(int n)
Deprecated.Use theone2anyArray(int)
method instead.static One2AnyChannel
createOne2Any(ChannelDataStore buffer)
Deprecated.Use theone2any(ChannelDataStore)
method instead.static One2AnyChannel[]
createOne2Any(ChannelDataStore buffer, int n)
Deprecated.Use theone2anyArray(int,ChannelDataStore)
method instead.static One2OneChannel
createOne2One()
Deprecated.Use theone2one()
method instead.static One2OneChannel[]
createOne2One(int n)
Deprecated.Use theone2oneArray(int)
method instead.static One2OneChannel
createOne2One(ChannelDataStore buffer)
Deprecated.Use theone2one(ChannelDataStore)
method instead.static One2OneChannel[]
createOne2One(ChannelDataStore buffer, int n)
Deprecated.Use theone2oneArray(int,ChannelDataStore)
method instead.static <T> SharedChannelInput<T>[]
getInputArray(Any2AnyChannel<T>[] 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 <T> AltingChannelInput<T>[]
getInputArray(Any2OneChannel<T>[] 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 <T> SharedChannelInput<T>[]
getInputArray(One2AnyChannel<T>[] 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 <T> AltingChannelInput<T>[]
getInputArray(One2OneChannel<T>[] 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 <T> SharedChannelOutput<T>[]
getOutputArray(Any2AnyChannel<T>[] 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 <T> SharedChannelOutput<T>[]
getOutputArray(Any2OneChannel<T>[] 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 <T> ChannelOutput<T>[]
getOutputArray(One2AnyChannel<T>[] 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 <T> ChannelOutput<T>[]
getOutputArray(One2OneChannel<T>[] 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 <T> One2AnyChannel<T>
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 <T> One2AnyChannel<T>
one2any(int immunity)
This constructs a poisonable one-any Object channel.static <T> One2AnyChannel<T>
one2any(ChannelDataStore<T> buffer)
This constructs a one-any Object channel with user chosen buffering size and policy.static <T> One2AnyChannel<T>
one2any(ChannelDataStore<T> buffer, int immunity)
This constructs a buffered poisonable one-any Object channel.static <T> One2AnyChannel<T>[]
one2anyArray(int size)
This constructs an array of one-any Object channels.static <T> One2AnyChannel<T>[]
one2anyArray(int size, int immunity)
This constructs an array of poisonable one-any Object channels.static <T> One2AnyChannel<T>[]
one2anyArray(int size, ChannelDataStore<T> buffer)
This constructs an array of buffered one-any Object channels.static <T> One2AnyChannel<T>[]
one2anyArray(int size, ChannelDataStore<T> buffer, int immunity)
This constructs an array of buffered 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(int immunity)
This constructs a poisonable one-any integer channel.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[]
one2anyIntArray(int size)
This constructs an array of one-any integer channels.static One2AnyChannelInt[]
one2anyIntArray(int size, int immunity)
This constructs an array of poisonable 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 <T> One2OneChannel<T>
one2one()
This constructs an Object carrying channel that may only be connected to one writer and one reader process at a time.static <T> One2OneChannel<T>
one2one(int immunity)
This constructs a poisonable one-one Object channel.static <T> One2OneChannel<T>
one2one(ChannelDataStore<T> buffer)
This constructs a one-one Object channel with user chosen buffering size and policy.static <T> One2OneChannel<T>
one2one(ChannelDataStore<T> buffer, int immunity)
This constructs a buffered poisonable one-one Object channel.static <T> One2OneChannel<T>[]
one2oneArray(int size)
This constructs an array of one-one Object channels.static <T> One2OneChannel<T>[]
one2oneArray(int size, int immunity)
This constructs an array of poisonable one-one Object channels.static <T> One2OneChannel<T>[]
one2oneArray(int size, ChannelDataStore<T> buffer)
This constructs an array of buffered one-one Object channels.static <T> One2OneChannel<T>[]
one2oneArray(int size, ChannelDataStore<T> buffer, int immunity)
This constructs an array of buffered 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(int immunity)
This constructs a poisonable one-one integer channel.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[]
one2oneIntArray(int size)
This constructs an array of one-one integer channels.static One2OneChannelInt[]
one2oneIntArray(int size, int immunity)
This constructs an array of poisonable 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 <T> One2OneChannelSymmetric<T>
one2oneSymmetric()
This constructs an Object carrying channel that may only be connected to one writer and one reader process at a time.static <T> One2OneChannelSymmetric<T>[]
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.
-
-
-
Method Detail
-
one2one
public static <T> One2OneChannel<T> 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 <T> One2AnyChannel<T> 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 <T> Any2OneChannel<T> 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 <T> Any2AnyChannel<T> 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 <T> One2OneChannel<T> one2one(ChannelDataStore<T> 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 <T> One2AnyChannel<T> one2any(ChannelDataStore<T> 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 <T> Any2OneChannel<T> any2one(ChannelDataStore<T> 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 <T> Any2AnyChannel<T> any2any(ChannelDataStore<T> 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 <T> One2OneChannel<T> 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 <T> One2AnyChannel<T> 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 <T> Any2OneChannel<T> 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 <T> Any2AnyChannel<T> 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 <T> One2OneChannel<T> one2one(ChannelDataStore<T> 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 <T> One2AnyChannel<T> one2any(ChannelDataStore<T> 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 <T> Any2OneChannel<T> any2one(ChannelDataStore<T> 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 <T> Any2AnyChannel<T> any2any(ChannelDataStore<T> 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 <T> One2OneChannel<T>[] 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 <T> One2AnyChannel<T>[] 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 <T> Any2OneChannel<T>[] 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 <T> Any2AnyChannel<T>[] 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 <T> One2OneChannel<T>[] 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 <T> One2AnyChannel<T>[] 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 <T> Any2OneChannel<T>[] 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 <T> Any2AnyChannel<T>[] 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 <T> One2OneChannel<T>[] one2oneArray(int size, ChannelDataStore<T> 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 <T> One2AnyChannel<T>[] one2anyArray(int size, ChannelDataStore<T> 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 <T> Any2OneChannel<T>[] any2oneArray(int size, ChannelDataStore<T> 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 <T> Any2AnyChannel<T>[] any2anyArray(int size, ChannelDataStore<T> 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 <T> One2OneChannel<T>[] one2oneArray(int size, ChannelDataStore<T> 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 <T> One2AnyChannel<T>[] one2anyArray(int size, ChannelDataStore<T> 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 <T> Any2OneChannel<T>[] any2oneArray(int size, ChannelDataStore<T> 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 <T> Any2AnyChannel<T>[] any2anyArray(int size, ChannelDataStore<T> 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 <T> One2OneChannelSymmetric<T> 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 anAlternative
: both ends may be so used.- Returns:
- the channel.
-
one2oneSymmetricArray
public static <T> One2OneChannelSymmetric<T>[] 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 anAlternative
: 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 <T> AltingChannelInput<T>[] getInputArray(One2OneChannel<T>[] 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 <T> SharedChannelInput<T>[] getInputArray(One2AnyChannel<T>[] 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 <T> AltingChannelInput<T>[] getInputArray(Any2OneChannel<T>[] 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 <T> SharedChannelInput<T>[] getInputArray(Any2AnyChannel<T>[] 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 <T> ChannelOutput<T>[] getOutputArray(One2OneChannel<T>[] 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 <T> ChannelOutput<T>[] getOutputArray(One2AnyChannel<T>[] 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 <T> SharedChannelOutput<T>[] getOutputArray(Any2OneChannel<T>[] 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 <T> SharedChannelOutput<T>[] getOutputArray(Any2AnyChannel<T>[] 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 theone2one()
method instead.Constructs and returns aOne2OneChannel
object.- Returns:
- the channel.
- See Also:
ChannelFactory.createOne2One()
-
createAny2One
public static Any2OneChannel createAny2One()
Deprecated.Use theany2one()
method instead.Constructs and returns anAny2OneChannel
object.- Returns:
- the channel.
- See Also:
ChannelFactory.createAny2One()
-
createOne2Any
public static One2AnyChannel createOne2Any()
Deprecated.Use theone2any()
method instead.Constructs and returns aOne2AnyChannel
object.- Returns:
- the channel.
- See Also:
ChannelFactory.createOne2Any()
-
createAny2Any
public static Any2AnyChannel createAny2Any()
Deprecated.Use theany2any()
method instead.Constructs and returns anAny2AnyChannel
object.- Returns:
- the channel.
- See Also:
ChannelFactory.createAny2Any()
-
createOne2One
public static One2OneChannel[] createOne2One(int n)
Deprecated.Use theone2oneArray(int)
method instead.Constructs and returns an array ofOne2OneChannel
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 theany2oneArray(int)
method instead.Constructs and returns an array ofAny2OneChannel
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 theone2anyArray(int)
method instead.Constructs and returns an array ofOne2AnyChannel
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 theany2anyArray(int)
method instead.Constructs and returns an array ofAny2AnyChannel
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 theone2one(ChannelDataStore)
method instead.Constructs and returns a
One2OneChannel
object which uses the specifiedChannelDataStore
object as a buffer.The buffer supplied to this method is cloned before it is inserted into the channel.
- Parameters:
buffer
- theChannelDataStore
to use.- Returns:
- the buffered channel.
- See Also:
BufferedChannelFactory.createOne2One(ChannelDataStore)
,ChannelDataStore
-
createAny2One
public static Any2OneChannel createAny2One(ChannelDataStore buffer)
Deprecated.Use theany2one(ChannelDataStore)
method instead.Constructs and returns a
Any2OneChannel
object which uses the specifiedChannelDataStore
object as a buffer.The buffer supplied to this method is cloned before it is inserted into the channel.
- Parameters:
buffer
- theChannelDataStore
to use.- Returns:
- the buffered channel.
- See Also:
BufferedChannelFactory.createAny2One(ChannelDataStore)
,ChannelDataStore
-
createOne2Any
public static One2AnyChannel createOne2Any(ChannelDataStore buffer)
Deprecated.Use theone2any(ChannelDataStore)
method instead.Constructs and returns a
One2AnyChannel
object which uses the specifiedChannelDataStore
object as a buffer.The buffer supplied to this method is cloned before it is inserted into the channel.
- Parameters:
buffer
- theChannelDataStore
to use.- Returns:
- the buffered channel.
- See Also:
BufferedChannelFactory.createOne2Any(ChannelDataStore)
,ChannelDataStore
-
createAny2Any
public static Any2AnyChannel createAny2Any(ChannelDataStore buffer)
Deprecated.Use theany2any(ChannelDataStore)
method instead.Constructs and returns a
Any2AnyChannel
object which uses the specifiedChannelDataStore
object as a buffer.The buffer supplied to this method is cloned before it is inserted into the channel.
- Parameters:
buffer
- theChannelDataStore
to use.- Returns:
- the buffered channel.
- See Also:
BufferedChannelFactory.createAny2Any(ChannelDataStore)
,ChannelDataStore
-
createOne2One
public static One2OneChannel[] createOne2One(ChannelDataStore buffer, int n)
Deprecated.Use theone2oneArray(int,ChannelDataStore)
method instead.Constructs and returns an array of
One2OneChannel
objects which use the specifiedChannelDataStore
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
- theChannelDataStore
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 theany2oneArray(int,ChannelDataStore)
method instead.Constructs and returns an array of
Any2OneChannel
objects which use the specifiedChannelDataStore
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
- theChannelDataStore
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 theone2anyArray(int,ChannelDataStore)
method instead.Constructs and returns an array of
One2AnyChannel
objects which use the specifiedChannelDataStore
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
- theChannelDataStore
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 theany2anyArray(int,ChannelDataStore)
method instead.Constructs and returns an array of
Any2AnyChannel
objects which use the specifiedChannelDataStore
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
- theChannelDataStore
to use.n
- the size of the array of channels.- Returns:
- the array of buffered channels.
- See Also:
BufferedChannelArrayFactory.createAny2Any(ChannelDataStore, int)
,ChannelDataStore
-
-