|
CSP for Java (JCSP) 1.1-rc1 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jcsp.plugNplay.Plex
public final class Plex
Fair multiplexes its input Object stream array into one output stream.
Input Channels | ||
---|---|---|
in[] | java.lang.Object | The input streams. |
Output Channels | ||
out | java.lang.Object | The multiplexed output stream. |
import org.jcsp.lang.*; import org.jcsp.plugNplay.*; public final class PlexExample { public static void main (String[] argv) { final One2OneChannel[] a = Channel.createOne2One (3); final One2OneChannel[] b = Channel.createOne2One (3); final One2OneChannel c = Channel.createOne2One (); new Parallel ( new CSProcess[] { new Numbers (a[0].out ()), new Fibonacci (a[1].out ()), new Squares (a[2].out ()), new Sign ("Numbers ", a[0].in (), b[0].out ()), new Sign (" Fibonacci ", a[1].in (), b[1].out ()), new Sign (" Squares ", a[2].in (), b[2].out ()), new Plex (b.in (), c.out ()), new Printer (c.in (), "", "\n") } ).run (); } }
public void run () { Alternative alt = new Alternative (in); // in is the input channel array while (true) { out.write (in[alt.fairSelect ()].read ()); // out is the output channel } }
Plex2
,
Multiplex
Constructor Summary | |
---|---|
Plex(AltingChannelInput[] in,
ChannelOutput out)
Construct a new Plex process with input channels in and output channel 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 Plex(AltingChannelInput[] in, ChannelOutput out)
in
- the input channelsout
- the output channelMethod Detail |
---|
public void run()
run
in interface CSProcess
|
CSP for Java (JCSP) 1.1-rc1 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |