Package org.jcsp.lang
Class BlackHoleChannelInt
- java.lang.Object
-
- org.jcsp.lang.BlackHoleChannelInt
-
- All Implemented Interfaces:
ChannelOutputInt
,Poisonable
public class BlackHoleChannelInt extends Object implements ChannelOutputInt
This implementsChannelOutputInt
with black hole semantics.Description
BlackHoleChannelInt is an implementation ofChannelOutputInt
that yields black hole semantics for a channel. Writers may always write but there can be no readers. Any number of writers may share the same black hole.Note: BlackHoleChannelInts are used for masking off unwanted outputs from processes. They are useful when we want to reuse an existing process component intact, but don't need some of its output channels (i.e. we don't want to redesign and reimplement the component to remove the redundant channels). Normal channels cannot be plugged in and left dangling as this may deadlock (parts of) the component being reused.
- Author:
- P.H. Welch
- See Also:
ChannelOutputInt
,One2OneChannelInt
,Any2OneChannelInt
,One2AnyChannelInt
,Any2AnyChannelInt
-
-
Constructor Summary
Constructors Constructor Description BlackHoleChannelInt()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
poison(int strength)
This injects poison into the channel.void
write(int n)
Write an integer to the channel and loose it.
-
-
-
Method Detail
-
write
public void write(int n)
Write an integer to the channel and loose it.- Specified by:
write
in interfaceChannelOutputInt
- Parameters:
n
- the integer to write to 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).
-
-