|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uk.ac.man.cs.rainbow.simulator.Channel
Channels connect Rainbow threads.
RainbowThread
, Serialized FormInner Class Summary | |
class |
Channel.Adapter
Null implementation of a channel listener. |
static class |
Channel.Data
Channels can be turned into first-class data values. |
static interface |
Channel.Listener
Indicate that a class's objects might want to be told of events on channels. |
Constructor Summary | |
Channel(String name)
Create a new channel with the given name. |
Method Summary | |
void |
addListener(Channel.Listener l)
Register an object for receipt of channel event notifications. |
Data |
getContents()
Get the value currently on the channel. |
RainbowThread |
getReader()
What thread is interested in reading from the channel? |
RainbowThread |
getWriter()
What thread is trying to write to the channel? |
boolean |
isActivated()
Is a transation in the process of happening on the channel? |
void |
removeListener(Channel.Listener l)
Unregister an object from receipt of channel event notifications. |
void |
setActivated(boolean activated)
Activate or deactivate the channel. |
void |
setContents(Data contents)
Set the value that is being passed along the channel. |
void |
setReader(RainbowThread reader)
Indicate that the given thread is interested in reading from the channel. |
void |
setWriter(RainbowThread writer)
Indicate that the given thread has written to the channel. |
String |
toString()
Get the name of this channel. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Channel(String name)
name
- The name of the channel to create.UnknownData
,
RASM.MakeChannel
Method Detail |
public Data getContents()
public RainbowThread getReader()
public RainbowThread getWriter()
public boolean isActivated()
public void setActivated(boolean activated)
activated
- True to activate the channel (i.e. to send a request), and
false to deactivate the channel (i.e. to send an acknowledge.)public void setContents(Data contents)
contents
- The value to pass along the channel.public void setReader(RainbowThread reader)
reader
- The thread that wants to be woken up when a value is written
to the channel. Use null to mark the thread as having no
thread interested in write notifications.Scheduler
public void setWriter(RainbowThread writer)
writer
- The thread that wants to be woken up when the value has been
finished with by the channel's reader thread. If null, then
the data value being passed along the channel will be reset to
the unknown value.Scheduler
,
UnknownData
public String toString()
toString
in class Object
public final void addListener(Channel.Listener l)
l
- The listener object to register.public final void removeListener(Channel.Listener l)
l
- The listener object to unregister.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |