Package org.jcsp.lang
Class AltingChannelInputInt
- java.lang.Object
-
- org.jcsp.lang.Guard
-
- org.jcsp.lang.AltingChannelInputInt
-
- All Implemented Interfaces:
ChannelInputInt
,Poisonable
- Direct Known Subclasses:
AltingChannelInputIntImpl
,AltingChannelInputIntSymmetricImpl
public abstract class AltingChannelInputInt extends Guard implements ChannelInputInt
This extendsGuard
andChannelInputInt
to enable a process to choose between many integer input (and other) events.A reading-end, obtained from a one-one or any-one channel by invoking its in() method, will extend this abstract class.
Description
AltingChannelInputInt extendsGuard
andChannelInputInt
to enable a process to choose between many integer input (and other) events. The methods inherited from Guard are of no concern to users of this package.Example
import org.jcsp.lang.*; public class AltingIntExample implements CSProcess { private final AltingChannelInputInt in0, in1; public AltingIntExample (final AltingChannelInputInt in0, final AltingChannelInputInt in1) { this.in0 = in0; this.in1 = in1; } public void run () { final Guard[] altChans = {in0, in1}; final Alternative alt = new Alternative (altChans); while (true) { switch (alt.select ()) { case 0: System.out.println ("in0 read " + in0.read ()); break; case 1: System.out.println ("in1 read " + in1.read ()); break; } } } }
- See Also:
Guard
,Alternative
-
-
Constructor Summary
Constructors Constructor Description AltingChannelInputInt()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract boolean
pending()
Returns whether there is data pending on this channel.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jcsp.lang.ChannelInputInt
endRead, read, startRead
-
Methods inherited from interface org.jcsp.lang.Poisonable
poison
-
-