uk.ac.man.cs.rainbow.simulator
Class RASM.ChannelBox

java.lang.Object
  |
  +--uk.ac.man.cs.rainbow.simulator.Instruction
        |
        +--uk.ac.man.cs.rainbow.simulator.RASM.ChannelBox
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Release, SignalForward, WaitRelease
Enclosing class:
RASM

public abstract static class RASM.ChannelBox
extends Instruction

Instructions that take a single channel argument and which may take more than a single step to execute. This class exists to group together a bit of awkward implementation into one easy lump, bearing in mind the different ways of exiting the call without an error.

See Also:
RASMThread.chanContext(), RASMThread.endContext(boolean), Serialized Form

Inner classes inherited from class uk.ac.man.cs.rainbow.simulator.Instruction
Instruction.MACRO
 
Constructor Summary
RASM.ChannelBox()
           
RASM.ChannelBox(RASMCode code)
           
 
Method Summary
protected  boolean execute(RASMThread thread)
          Make this instruction execute in the given context.
protected abstract  boolean execute(RASMThread thread, Channel chan)
          Perform an operation on the given thread and channel.
 
Methods inherited from class uk.ac.man.cs.rainbow.simulator.Instruction
addClass, getInstruction, getInstruction, getInstruction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RASM.ChannelBox

public RASM.ChannelBox()

RASM.ChannelBox

public RASM.ChannelBox(RASMCode code)
Method Detail

execute

protected abstract boolean execute(RASMThread thread,
                                   Channel chan)
                            throws RASMThread.Exception
Perform an operation on the given thread and channel. The instruction will be repeated (though with activity going on in other Rainbow threads) until this method returns false. Note that no values should be popped off the stack by this method, and values should only be pushed onto the stack if the method is about to return false.
Returns:
true if the instruction is to be repeated by this thread.

execute

protected final boolean execute(RASMThread thread)
                         throws RASMThread.Exception
Description copied from class: Instruction
Make this instruction execute in the given context.
Overrides:
execute in class Instruction
Following copied from class: uk.ac.man.cs.rainbow.simulator.Instruction
Throws:
RainbowException - All sorts of things can go wrong during execution...