uk.ac.man.cs.rainbow.simulator.rasm
Class Div

java.lang.Object
  |
  +--uk.ac.man.cs.rainbow.simulator.Instruction
        |
        +--uk.ac.man.cs.rainbow.simulator.RASM.BinaryIntFunction
              |
              +--uk.ac.man.cs.rainbow.simulator.rasm.Div
All Implemented Interfaces:
Serializable

public class Div
extends RASM.BinaryIntFunction

Division. Can take any enumerable values as input, and generates integer output. Attempts to divide by zero generate a checked error that terminates the thread.

x y x/y

See Also:
Serialized Form

Inner classes inherited from class uk.ac.man.cs.rainbow.simulator.Instruction
Instruction.MACRO
 
Constructor Summary
Div()
           
Div(RASMCode code)
           
 
Method Summary
protected  int execute(int x, int y)
          Perform an integer binary operation.
 String toString()
           
 
Methods inherited from class uk.ac.man.cs.rainbow.simulator.RASM.BinaryIntFunction
execute
 
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, wait, wait, wait
 

Constructor Detail

Div

public Div()

Div

public Div(RASMCode code)
Method Detail

toString

public String toString()
Overrides:
toString in class Object

execute

protected int execute(int x,
                      int y)
               throws RASMThread.Exception
Description copied from class: RASM.BinaryIntFunction
Perform an integer binary operation.
Overrides:
execute in class RASM.BinaryIntFunction
Following copied from class: uk.ac.man.cs.rainbow.simulator.RASM.BinaryIntFunction
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.