|
CSP for Java (JCSP) 1.1-rc4 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jcsp.plugNplay.ints.DeparaplexInt
public final class DeparaplexInt
This demultiplexes data from its input channel to its output channel array.
ParaplexInt
process on the other
end of its in channel back to separate streams (its out
channels). It assumes that ParaplexInt
operates on the same
size array of channels as its out array. It conforms to
contract required by ParaplexInt
for a process receiving its packets.
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.ints.*; public class DeparaplexIntExample { public static void main (String[] args) { final One2OneChannelInt[] a = Channel.one2oneIntArray (3); final One2OneChannel b = Channel.one2one (); final One2OneChannelInt[] c = Channel.one2oneIntArray (3); final One2OneChannel d = Channel.one2one (); new Parallel ( new CSProcess[] { new NumbersInt (a[0].out ()), new SquaresInt (a[1].out ()), new FibonacciInt (a[2].out ()), new ParaplexInt (Channel.getInputArray (a), b.out ()), new DeparaplexInt (b.in (), Channel.getOutputArray (c)), new ParaplexInt (Channel.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 (); } }
ParaplexInt
,
MultiplexInt
,
DemultiplexInt
Constructor Summary | |
---|---|
DeparaplexInt(ChannelInput in,
ChannelOutputInt[] out)
Construct a new DeparaplexInt process with the input Channel in and the output Channels out. |
Method Summary | |
---|---|
void |
run()
The main body of this process. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DeparaplexInt(ChannelInput in, ChannelOutputInt[] out)
in
- the input channelout
- the output ChannelsMethod Detail |
---|
public void run()
run
in interface CSProcess
|
CSP for Java (JCSP) 1.1-rc4 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |