Class ArithmeticInstruction


  • public class ArithmeticInstruction
    extends Instruction
    Represents arithmetic instructions.
    • Constructor Detail

      • ArithmeticInstruction

        public ArithmeticInstruction​(int opcode,
                                     int offset)
        Constructs an ArithmeticInstruction.
        Parameters:
        opcode - The opcode of the instruction.
        offset - The bytecode offset of the instruction.
        Throws:
        IllegalArgumentException - if the opcode is not an arithmetic opcode
    • Method Detail

      • getStackChange

        public int getStackChange()
        Returns the change in stack size caused by this instruction.
        Specified by:
        getStackChange in class Instruction
        Returns:
        The stack size change based on the arithmetic operation type.
      • getLocalChange

        public int getLocalChange()
        Returns the change in local variables caused by this instruction.
        Specified by:
        getLocalChange in class Instruction
        Returns:
        The local variables size change (none).
      • toString

        public String toString()
        Returns a string representation of the instruction.
        Overrides:
        toString in class Instruction
        Returns:
        The mnemonic of the arithmetic instruction.