Class LookupSwitchInstruction


  • public class LookupSwitchInstruction
    extends Instruction
    Represents the LOOKUPSWITCH instruction (0xAB).
    • Constructor Detail

      • LookupSwitchInstruction

        public LookupSwitchInstruction​(int opcode,
                                       int offset,
                                       int padding,
                                       int defaultOffset,
                                       int npairs,
                                       Map<Integer,​Integer> matchOffsets)
        Constructs a LookupSwitchInstruction.
        Parameters:
        opcode - The opcode of the instruction.
        offset - The bytecode offset of the instruction.
        padding - The number of padding bytes.
        defaultOffset - The default branch target offset.
        npairs - The number of key-offset pairs.
        matchOffsets - The map of keys to branch target offsets.
    • Method Detail

      • getDefaultOffset

        public int getDefaultOffset()
        Returns:
        the default offset
      • getNpairs

        public int getNpairs()
        Returns:
        the npairs
      • getMatchOffsets

        public Map<Integer,​Integer> getMatchOffsets()
        Returns:
        the match offsets
      • write

        public void write​(DataOutputStream dos)
                   throws IOException
        Writes the LOOKUPSWITCH opcode and its operands to the DataOutputStream.
        Specified by:
        write in class Instruction
        Parameters:
        dos - The DataOutputStream to write to.
        Throws:
        IOException - If an I/O error occurs.
      • 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 (pops one int).
      • 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, default offset, number of pairs, and key-offset mappings.