CSP for Java
(JCSP) 1.0-rc4

jcsp.lang
Interface ChannelInputInt

All Known Subinterfaces:
ChannelInt
All Known Implementing Classes:
AltingChannelInputInt

public interface ChannelInputInt

This defines the interface for reading from integer channels.

Description

ChannelInputInt defines the interface for reading from integer channels. The interface contains only one method - read(). This method will block the calling process until an int has been written to the channel by a process at the other end. If an int has already been written when this method is called, the method will return without blocking. Either way, the method returns the int sent down the channel.

ChannelInputInt variables are used to hold integer channels that are going to be used only for input by the declaring process. This is a security matter -- by declaring a ChannelInputInt interface, any attempt to output to the channel will generate a compile-time error. For example, the following code fragment will not compile:

 void doWrite (ChannelInputInt c, int i) {
   c.write (i);   // illegal
 }
 
When configuring a CSProcess with input integer channels, they should be declared as ChannelInputInt (or, if we wish to be able to make choices between events, as AltingChannelInputInt) variables. The actual channel passed, of course, may belong to any channel class that implements ChannelInputInt (or AltingChannelInputInt).

Example

Discard data

 void doRead (ChannelInputInt c) {
   c.read ();                       // clear the channel
 }
 

Author:
P.D.Austin
See Also:
AltingChannelInputInt, ChannelOutputInt

Method Summary
 int read()
          Read an int from the channel.
 

Method Detail

read

public int read()
Read an int from the channel.
Returns:
the integer read from the channel

CSP for Java
(JCSP) 1.0-rc4

Submit a bug or feature to jcsp-team@ukc.ac.uk
Version 1.0-rc4 of the JCSP API Specification (Copyright 1997-2000 P.D.Austin and P.H.Welch - All Rights Reserved)
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.