All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface jcsp.lang.ints.ChannelInputInt

public interface ChannelInputInt

Description

ChannelInputInt defines the interface for reading from the Java version of occam ChannelInts. The interface contains only one method read(), which reads from the ChannelInt. Upon invoking the read() method the next int from the ChannelInt will be returned, if no data is currently in the ChannelInt the method will block until data becomes available, this data will then be returned.

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

 void doWrite(ChannelInputInt c, int i) {
   c.write(i); // illegal
 
This interface should be used to pass ChannelInts around where processes only require read access to the ChannelInt.

The int returned can be discarded or read into an int varaible..

Example

Discard data

 void doRead(ChannelInputInt c) {
   c.read();
 }
 

Read into an int

 void doRead(ChannelInputInt c) {
   int i = c.read();
 }
 

Author:
P.D.Austin

Method Index

 o read()
Reads an int from the ChannelInt.

Methods

 o read
 public abstract int read()
Reads an int from the ChannelInt.

Returns:
The int returned from the ChannelInt.

All Packages  Class Hierarchy  This Package  Previous  Next  Index