|
||||||||||
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.Instruction
Superclass of all RASM instructions.
All constructors for any subclass of this class come in pairs: with and without a terminating RASMCode argument. Where the argument is supplied, the instruction will be automatically appended to the given code block during construction. This makes it easier to generate a sequence of instructions.
RASMCode
,
RASMThread
,
RASM
, Serialized FormInner Class Summary | |
static class |
Instruction.MACRO
Instructions implemented in terms of other instructions must be subclasses of this class. |
Constructor Summary | |
Instruction()
Create a new instruction. |
|
Instruction(RASMCode code)
Automatically append this instruction to the given code block. |
Method Summary | |
protected static void |
addClass(String name,
Class clazz)
Define an instruction so it can be looked up by name. |
protected abstract boolean |
execute(RASMThread t)
Make this instruction execute in the given context. |
static Instruction |
getInstruction(String name)
Get a no-arg instruction instance. |
static Instruction |
getInstruction(String name,
Object arg)
Get a one-arg instruction instance. |
static Instruction |
getInstruction(String name,
Object arg,
RASMCode code)
Get a two-arg instruction instance. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Instruction()
public Instruction(RASMCode code)
Method Detail |
protected abstract boolean execute(RASMThread t) throws RainbowException
RainbowException
- All sorts of things can go wrong during execution...protected static void addClass(String name, Class clazz)
public static Instruction getInstruction(String name) throws RASMCode.Exception
name
- The name of instruction to get an instance of. The
instruction will not need any arguments passing to its
constructor.RASMCode.Exception
- If the instruction cannot be instantiated for some reason (e.g.
if it requires an argument, or if it doesn't exist.)public static Instruction getInstruction(String name, Object arg) throws RASMCode.Exception
name
- The name of instruction to get an instance of. The
instruction will need one argument of the right type in its
constructor.arg
- The argument to pass to the constructor.RASMCode.Exception
- If the instruction cannot be instantiated for some reason (e.g.
if there is an argument mismatch, or if it doesn't exist.)public static Instruction getInstruction(String name, Object arg, RASMCode code) throws RASMCode.Exception
name
- The name of instruction to get an instance of. The
instruction will need two arguments of the right types in
its constructor.arg
- The first argument to pass to the constructor.code
- The second argument to pass to the constructor. Will always
be a code block where this method is legal at all.)RASMCode.Exception
- If the instruction cannot be instantiated for some reason (e.g.
if there is an argument mismatch, or if it doesn't exist.)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |