jellyj.classfile.classgen
Class SWITCH


public final class SWITCH
implements CompoundInstruction

SWITCH - Branch depending on int value, generates either LOOKUPSWITCH or TABLESWITCH instruction, depending on whether the match values (int[]) can be sorted with no gaps between the numbers.

Author:
JellyJ Design Group

Constructor Summary
SWITCH(int[] match, InstructionHandle[] targets, InstructionHandle target)
          Template for switch() constructs, if the match array can be sorted in ascending order with no gaps between the numbers a TABLESWITCH instruction is generated, a LOOKUPSWITCH otherwise.

Method Summary
 final InstructiongetInstruction()
           
 final InstructionListgetInstructionList()
           
 (package private) voidsort()
           

Constructor Detail

SWITCH

public SWITCH(int[] match, InstructionHandle[] targets, InstructionHandle target)
Template for switch() constructs, if the match array can be sorted in ascending order with no gaps between the numbers a TABLESWITCH instruction is generated, a LOOKUPSWITCH otherwise.
Parameters:
match - array of match values (case 2: ... case 7: ..., etc.)
targets - the instructions to be performed for each case
target - the default target
Method Detail

getInstruction

public final Instruction getInstruction()

getInstructionList

public final InstructionList getInstructionList()

sort

void sort()

Association Links

to Class jellyj.classfile.classgen.InstructionHandle

to Class jellyj.classfile.classgen.Select