Package org.jcsp.lang
Class AltingChannelOutputSymmetricImpl<T>
java.lang.Object
org.jcsp.lang.Guard
org.jcsp.lang.AltingChannelOutput<T>
org.jcsp.lang.AltingChannelOutputSymmetricImpl<T>
- All Implemented Interfaces:
ChannelOutput<T>
,MultiwaySynchronisation
,Poisonable
class AltingChannelOutputSymmetricImpl<T>
extends AltingChannelOutput<T>
implements MultiwaySynchronisation
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AltingBarrier
private final ChannelOutput
<T> private boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) boolean
disable()
Disables the guard for selection.(package private) boolean
enable
(Alternative alt) Returns true if the event is ready.boolean
pending()
Returns whether the receiver is committed to read from this channel.void
poison
(int strength) This injects poison into the channel.void
Write an Object to the channel.
-
Field Details
-
ab
-
out
-
syncDone
private boolean syncDone
-
-
Constructor Details
-
AltingChannelOutputSymmetricImpl
-
-
Method Details
-
enable
Description copied from class:Guard
Returns true if the event is ready. Otherwise, this enables the guard for selection and returns false.Note: this method should only be called by the Alternative class
-
disable
boolean disable()Description copied from class:Guard
Disables the guard for selection. Returns true if the event was ready.Note: this method should only be called by the Alternative class
-
write
Description copied from interface:ChannelOutput
Write an Object to the channel.- Specified by:
write
in interfaceChannelOutput<T>
- Parameters:
o
- the object to write to the channel
-
pending
public boolean pending()Description copied from class:AltingChannelOutput
Returns whether the receiver is committed to read from this channel.Note: if this returns true, you must commit to write down this channel.
- Specified by:
pending
in classAltingChannelOutput<T>
- Returns:
- state of the channel.
-
poison
public void poison(int strength) Description copied from interface:Poisonable
This injects poison into the channel. If the channel was not explicitly constructed to be poisonable or if the strength of poison is not greater than the channel immunity level, the poison will have no effect.- Specified by:
poison
in interfacePoisonable
- Parameters:
strength
- the strength of the poison (must be >= 0).
-