public final class DeparaplexInt
This demultiplexes data from its input channel to its output channel array.
In each cycle, it inputs one packet and outputs its contents in parallel to each of its output channels. The parallel output means that the process will wait until each item is accepted by every channel -- in whatever order is demanded by its environment. The ordering of the channels in the out array, therefore, makes no difference to the functionality of this process.
Input Channels | ||
---|---|---|
in | int[] | A packet carrying the paraplexed data. |
Output Channels | ||
out[] | int | Most channels in this package carry integers. |
import org.jcsp.lang.*; import org.jcsp.plugNplay.*; class DeparaplexIntTest { public static void main (String[] args) { final One2OneChannelInt[] a = ChannelInt.createOne2One (3); final One2OneChannel b = Channel.createOne2One (); final One2OneChannelInt[] c = ChannelInt.createOne2One (3); final One2OneChannel d = Channel.createOne2One (); new Parallel ( new CSProcess[] { new NumbersInt (a[0].out ()), new SquaresInt (a[1].out ()), new FibonacciInt (a[2].out ()), new ParaplexInt (ChannelInt.getInputArray (a), b.out ()), new DeparaplexInt (b.in (), ChannelInt.getOutputArray (c)), new ParaplexInt (ChannelInt.getInputArray (c), d.out ()), new CSProcess () { public void run () { System.out.println ("\n\t\tNumbers\t\tSquares\t\tFibonacci\n"); while (true) { int[] data = (int[]) d.in ().read (); for (int i = 0; i < data.length; i++) { System.out.print ("\t\t" + data[i]); } System.out.println (); } } } } ).run (); } }
Constructor and description |
---|
DeparaplexInt
(ChannelInput in, ChannelOutputInt[] out) Construct a new DeparaplexInt process with the input Channel in and the output Channels out. |
Construct a new DeparaplexInt process with the input Channel in and the output Channels out. The ordering of the Channels in the out array make no difference to the functionality of this process.
in
- the input channelout
- the output ChannelsJCSP for Java 1.8 generated 14-10-2016 by Jon Kerridge, Edinburgh Napier University - j dot kerridge at napier dot ac dot uk