All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jcsp.lang.AltingChannelInput

java.lang.Object
   |
   +----jcsp.lang.AltingChannelInput

public abstract class AltingChannelInput
extends Object
implements ChannelInput

Description

AltingChannelInput defines the interface for reading and alternative selection from the Java version of occam Channels. It extends the ChannelInput interface and adds two methods enable and disable which are used by the Alternative class to enable and disable Alternative selection from the Channel.

Example

 import jcsp.lang.*;
 public class AltingIntputExample implements CSProcess {
   private AltingChannelInput in1;
   private AltingChannelInput in2;
   public AltingInputExample(AltingChannelInput in1, AltingChannelInput in2) {
     this.in1 = in1;
     this.in2 = in2;
   }
   public void run() {
     Alternative alt = new Alternative();
     AltingChannelInput 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:
Alternative

Constructor Index

 o AltingChannelInput()

Method Index

 o read()
Reads an Object from the Channel.

Constructors

 o AltingChannelInput
 public AltingChannelInput()

All Packages  Class Hierarchy  This Package  Previous  Next  Index