gnu.bytecode

Class SwitchState

public class SwitchState extends Object

Maintains the state for generating a switch statement.
Constructor Summary
SwitchState(CodeAttr code)
Method Summary
booleanaddCase(int value, CodeAttr code)
Emit a new case, for the given value, whose label is here.
booleanaddCase(int value, Label label, CodeAttr code)
Add a new case.
voidaddDefault(CodeAttr code)
voidaddDefault(Label label, CodeAttr code)
voidfinish(CodeAttr code)
Handle the end of the switch statement.
intgetMaxValue()

Constructor Detail

SwitchState

public SwitchState(CodeAttr code)

Method Detail

addCase

public boolean addCase(int value, CodeAttr code)
Emit a new case, for the given value, whose label is here.

addCase

public boolean addCase(int value, Label label, CodeAttr code)
Add a new case.

Parameters: value the case value to match against at run-time label the location to go to if the value matches code the CodeAttr of the Method we are generating code for

Returns: true on success; false if value duplicates an existing value

addDefault

public void addDefault(CodeAttr code)

addDefault

public void addDefault(Label label, CodeAttr code)

finish

public void finish(CodeAttr code)
Handle the end of the switch statement. Assume the case value is on the stack; go to the matching case label.

getMaxValue

public int getMaxValue()