This class wraps an ALTable channel so that only the reading part is available to the caller. Writes are impossible unless you subclass this (and use getChannel()) or keep a reference to the original channel.
Note that usually you do not need the absolute guarantee that this class provides - you can usually just cast the channel to an AltingChannelInput, which prevents you from accidentally writing to the channel. This class mainly exists for use by some of the jcsp.net classes, where the absolute guarantee that you cannot write to it is important.
Constructor and description |
---|
AltingChannelInputWrapper
(AltingChannelInput channel) Creates a new AltingChannelInputWrapper which wraps the specified channel. |
protected AltingChannelInputWrapper
() This constructor does not wrap a channel. |
Type | Name and description |
---|---|
void |
endRead() Ends an extended rendezvous |
protected AltingChannelInput |
getChannel() Get the real channel. |
boolean |
pending() Returns whether there is data pending on this channel. |
void |
poison(int strength) |
Object |
read() Read an Object from the channel. |
protected void |
setChannel(AltingChannelInput chan) Sets the real channel to be used. |
Object |
startRead() Begins an extended rendezvous |
Methods inherited from class | Name |
---|---|
class AltingChannelInput |
pending |
class Guard |
schedule |
Creates a new AltingChannelInputWrapper which wraps the specified channel.
This constructor does not wrap a channel.
The underlying channel can be set by calling
setChannel(AltingChannelInput)
.
Ends an extended rendezvous
Get the real channel.
Returns whether there is data pending on this channel.
Note: if there is, it won't go away until you read it. But if there isn't, there may be some by the time you check the result of this method.
Read an Object from the channel.
Sets the real channel to be used.
chan
- the real channel to be used.Begins an extended rendezvous
JCSP for Java 1.8 generated 14-10-2016 by Jon Kerridge, Edinburgh Napier University - j dot kerridge at napier dot ac dot uk