All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jcsp.lang.ints.AltingChannelInputInt

java.lang.Object
   |
   +----jcsp.lang.ints.AltingChannelInputInt

public abstract class AltingChannelInputInt
extends Object
implements ChannelInputInt

Description

AltingChannelInputInt defines the interface for reading and alternative selection from the Java version of occam ChannelInts. It extends the ChannelInputInt interface and adds two methods enable and disable which are used by the AlternativeInt class to enable and disable AlternativeInt selection from the ChannelInt.

Example

 import jcsp.lang.*;
 public class AltingIntputExample implements CSProcess {
   private AltingChannelInputInt in1;
   private AltingChannelInputInt in2;
   public AltingInputExample(AltingChannelInputInt in1, AltingChannelInputInt in2) {
     this.in1 = in1;
     this.in2 = in2;
   }
   public void run() {
     AlternativeInt alt = new AlternativeInt();
     AltingChannelInputInt altChans = {
       in1,
       in2,
     };
     while (true) {
       switch (alt.select(altChans)) {
         case 0:
           System.out.println("in1 read " + in1.read());
         break;
         case 1:
           System.out.println("in2 read " + in2.read());
         break;
     }
   }
 }
 

Author:
P.D.Austin
See Also:
AlternativeInt

Constructor Index

 o AltingChannelInputInt()

Method Index

 o read()
Reads an int from the ChannelInt.

Constructors

 o AltingChannelInputInt
 public AltingChannelInputInt()

All Packages  Class Hierarchy  This Package  Previous  Next  Index