public final class Plex extends Object implements CSProcess

| 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 class PlexExample {
public static void main (String[] argv) {
final One2OneChannel[] a = Channel.one2oneArray (3);
final One2OneChannel[] b = Channel.one2oneArray (3);
final One2OneChannel c = Channel.one2one ();
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 (Channel.getInputArray (b), 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
}
}
| Constructor and Description |
|---|
Plex(AltingChannelInput[] in,
ChannelOutput out)
Construct a new Plex process with input channels
in and output channel out.
|
public Plex(AltingChannelInput[] in, ChannelOutput out)
in - the input channelsout - the output channelSubmit 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.