Class SwitchInstruction

    • Constructor Detail

      • SwitchInstruction

        protected SwitchInstruction​(short opcode,
                                    int[] casesAndLabels,
                                    int defaultLabel)
    • Method Detail

      • getDefaultLabel

        public int getDefaultLabel()
        Returns:
        the label which is branched to if none of the cases match
      • getCasesAndLabels

        public int[] getCasesAndLabels()
        Returns:
        an array of flattened (case, label) pairs, sorted in increasing order by case
      • make

        public static SwitchInstruction make​(int[] casesAndLabels,
                                             int defaultLabel)
        Make a switch instruction.
        Parameters:
        casesAndLabels - an array of flattened (case, label) pairs, sorted in increasing order by case
        defaultLabel - the default label to branch to if no cases match
        Throws:
        IllegalArgumentException - if casesAndLabels is null
      • getBranchTargets

        public int[] getBranchTargets()
        Specified by:
        getBranchTargets in interface IInstruction
        Overrides:
        getBranchTargets in class Instruction
        Returns:
        an array containing the labels this instruction can branch to (not including the following instruction if this instruction 'falls through')
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • isPEI

        public boolean isPEI()
        Description copied from interface: IInstruction
        PEI == "Potentially excepting instruction"
        Returns:
        true iff this instruction might throw an exception