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

java.lang.Object
  |
  +--uk.ac.man.cs.rainbow.simulator.Instruction
        |
        +--uk.ac.man.cs.rainbow.simulator.RASM.Comparison
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Geq, Gt, Leq, Lt
Enclosing class:
RASM

public abstract static class RASM.Comparison
extends Instruction

Comparison operation between comparable data values. Note that this does not perform equality testing, since that is done through a separate interface (and it is far more widely defined anyway.) All are of the form:

x y cmp(x,y)

See Also:
Data.Comparable, Data.Comparable.compare(Data.Comparable), Serialized Form

Inner classes inherited from class uk.ac.man.cs.rainbow.simulator.Instruction
Instruction.MACRO
 
Constructor Summary
RASM.Comparison()
           
RASM.Comparison(RASMCode code)
           
 
Method Summary
protected abstract  boolean compare(int executeResults)
          Determine the meaning of the result of a comparison between values.
protected  boolean execute(RASMThread thread)
          Make this instruction execute in the given context.
 
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.Comparison

public RASM.Comparison()

RASM.Comparison

public RASM.Comparison(RASMCode code)
Method Detail

compare

protected abstract boolean compare(int executeResults)
Determine the meaning of the result of a comparison between values.
Parameters:
executeResults - Negative if the first argument is less than the second, positive if the first argument is greater than the second, and zero otherwise.
Returns:
The boolean to push onto the stack.

execute

protected boolean execute(RASMThread thread)
                   throws RainbowException
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...