org.apache.bcel.generic

Class Select

public abstract class Select extends BranchInstruction implements VariableLengthInstruction, StackProducer

Select - Abstract super class for LOOKUPSWITCH and TABLESWITCH instructions.

We use our super's target property as the default target.

See Also: LOOKUPSWITCH TABLESWITCH InstructionList

Field Summary
protected intfixed_length
protected int[]indices
protected int[]match
protected intmatch_length
protected intpadding
protected InstructionHandle[]targets
Method Summary
protected Objectclone()
booleancontainsTarget(InstructionHandle ih)
voiddump(DataOutputStream out)
Dump instruction as byte code to stream out.
int[]getIndices()
int[]getMatchs()
InstructionHandle[]getTargets()
protected voidinitFromFile(ByteSequence bytes, boolean wide)
Read needed data (e.g. index) from file.
voidsetTarget(int i, InstructionHandle target)
Set branch target for `i'th case
StringtoString(boolean verbose)
protected intupdatePosition(int offset, int max_offset)
Since this is a variable length instruction, it may shift the following instructions which then need to update their position.
voidupdateTarget(InstructionHandle old_ih, InstructionHandle new_ih)

Field Detail

fixed_length

protected int fixed_length

indices

protected int[] indices

match

protected int[] match

match_length

protected int match_length

padding

protected int padding

targets

protected InstructionHandle[] targets

Method Detail

clone

protected Object clone()

containsTarget

public boolean containsTarget(InstructionHandle ih)

Returns: true, if ih is target of this instruction

dump

public void dump(DataOutputStream out)
Dump instruction as byte code to stream out.

Parameters: out Output stream

getIndices

public int[] getIndices()

Returns: array of match target offsets

getMatchs

public int[] getMatchs()

Returns: array of match indices

getTargets

public InstructionHandle[] getTargets()

Returns: array of match targets

initFromFile

protected void initFromFile(ByteSequence bytes, boolean wide)
Read needed data (e.g. index) from file.

setTarget

public void setTarget(int i, InstructionHandle target)
Set branch target for `i'th case

toString

public String toString(boolean verbose)

Returns: mnemonic for instruction

updatePosition

protected int updatePosition(int offset, int max_offset)
Since this is a variable length instruction, it may shift the following instructions which then need to update their position. Called by InstructionList.setPositions when setting the position for every instruction. In the presence of variable length instructions `setPositions' performs multiple passes over the instruction list to calculate the correct (byte) positions and offsets by calling this function.

Parameters: offset additional offset caused by preceding (variable length) instructions max_offset the maximum offset that may be caused by these instructions

Returns: additional offset caused by possible change of this instruction's length

updateTarget

public void updateTarget(InstructionHandle old_ih, InstructionHandle new_ih)

Parameters: old_ih old target new_ih new target