All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface jcsp.lang.ints.ChannelOutputInt

public interface ChannelOutputInt

Description

ChannelOutputInt defines the interface for writing to the Java version of occam ChannelInts. The interface contains only one method write(int i), which writes to the ChannelInt. Upon invoking the write() method the int will be stored in the ChannelInt, if the ChannelInt is not full the method will return immediately, otherwise the method will block until data has been read from the ChannelInt, the method will then return.

The ChannelOutputInt interface should be used to hold references to ChannelInts when they are only going to be used for writing data to. By using the ChannelOutputInt interface any attempt to read from the ChannelInt using the reference to a ChannelOutputInt type will generate a compile time error. The following code fragment would not compile.

   int doRead(ChannelOutputInt c) {
   return c.read(); // illegal
 
This interface should be used to pass ChannelInts around where processes only require read access to the ChannelInt.

Example

 void doWrite(ChannelOutputInt c, int i) {
   c.write(i);
 }
 

Author:
P.D.Austin

Method Index

 o write(int)
Writes an int to the ChannelInt.

Methods

 o write
 public abstract void write(int i)
Writes an int to the ChannelInt.

Parameters:
i - The int to write to the ChannelInt.

All Packages  Class Hierarchy  This Package  Previous  Next  Index