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
Fields Modifier and Type Field Description private AltingBarrierabprivate ChannelOutput<T>outprivate booleansyncDone
-
Constructor Summary
Constructors Constructor Description AltingChannelOutputSymmetricImpl(AltingBarrier ab, ChannelOutput<T> out)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) booleandisable()Disables the guard for selection.(package private) booleanenable(Alternative alt)Returns true if the event is ready.booleanpending()Returns whether the receiver is committed to read from this channel.voidpoison(int strength)This injects poison into the channel.voidwrite(T o)Write an Object to the channel.
-
-
-
Field Detail
-
ab
private final AltingBarrier ab
-
out
private final ChannelOutput<T> out
-
syncDone
private boolean syncDone
-
-
Constructor Detail
-
AltingChannelOutputSymmetricImpl
public AltingChannelOutputSymmetricImpl(AltingBarrier ab, ChannelOutput<T> out)
-
-
Method Detail
-
enable
boolean enable(Alternative alt)
Description copied from class:GuardReturns 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:GuardDisables the guard for selection. Returns true if the event was ready.Note: this method should only be called by the Alternative class
-
write
public void write(T o)
Description copied from interface:ChannelOutputWrite an Object to the channel.- Specified by:
writein interfaceChannelOutput<T>- Parameters:
o- the object to write to the channel
-
pending
public boolean pending()
Description copied from class:AltingChannelOutputReturns 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:
pendingin classAltingChannelOutput<T>- Returns:
- state of the channel.
-
poison
public void poison(int strength)
Description copied from interface:PoisonableThis 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:
poisonin interfacePoisonable- Parameters:
strength- the strength of the poison (must be >= 0).
-
-