uk.ac.man.cs.rainbow.simulator
Class RASM.BinaryLogicFunction
java.lang.Object
|
+--uk.ac.man.cs.rainbow.simulator.Instruction
|
+--uk.ac.man.cs.rainbow.simulator.RASM.BinaryLogicFunction
- All Implemented Interfaces:
- Serializable
- Direct Known Subclasses:
- And, Or, Xor
- Enclosing class:
- RASM
- public abstract static class RASM.BinaryLogicFunction
- extends Instruction
Binary operations over logic values. May work with either a
pair of booleans or a pair of integers. The boolean-valued
function is used when both the values popped off the stack are
booleans, and the integer-valued function is used otherwise.
All are of the form:
x y
op(x,y)
- See Also:
Data.Word
,
Type.Boolean
,
RASMThread.popWord()
,
RASMThread.push(int)
,
RASMThread.push(boolean)
,
Data.Word.getValue()
, Serialized Form
Method Summary |
protected abstract boolean |
execute(boolean x,
boolean y)
Perform a logical binary operation over booleans. |
protected abstract int |
execute(int x,
int y)
Perform a logical binary operation over integers (bit-wise). |
protected boolean |
execute(RASMThread thread)
Make this instruction execute in the given context. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RASM.BinaryLogicFunction
public RASM.BinaryLogicFunction()
RASM.BinaryLogicFunction
public RASM.BinaryLogicFunction(RASMCode code)
execute
protected abstract int execute(int x,
int y)
- Perform a logical binary operation over integers (bit-wise).
- Parameters:
x
- The first (lower on the stack) value argument.y
- The second (higher on the stack) value argument.- Returns:
- The result of the operation.
execute
protected abstract boolean execute(boolean x,
boolean y)
- Perform a logical binary operation over booleans.
- Parameters:
x
- The first (lower on the stack) value argument.y
- The second (higher on the stack) value argument.- Returns:
- The result of the operation.
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...