Package org.apache.bcel.generic
Class Select
java.lang.Object
org.apache.bcel.generic.Instruction
org.apache.bcel.generic.BranchInstruction
org.apache.bcel.generic.Select
- All Implemented Interfaces:
Cloneable,InstructionTargeter,StackConsumer,StackProducer,VariableLengthInstruction
- Direct Known Subclasses:
LOOKUPSWITCH,TABLESWITCH
public abstract class Select
extends BranchInstruction
implements VariableLengthInstruction, StackConsumer, StackProducer
Select - Abstract super class for LOOKUPSWITCH and TABLESWITCH instructions.
We use our super's target property as the default target.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intDeprecated.(since 6.0) will be made private; do not access directly, use getter/setterprotected int[]Deprecated.(since 6.0) will be made private; do not access directly, use getter/setterprotected int[]Deprecated.(since 6.0) will be made private; do not access directly, use getter/setterprotected intDeprecated.(since 6.0) will be made private; do not access directly, use getter/setterprotected intDeprecated.(since 6.0) will be made private; do not access directly, use getter/setterprotected InstructionHandle[]Deprecated.(since 6.0) will be made private; do not access directly, use getter/setterFields inherited from class org.apache.bcel.generic.BranchInstruction
index, position, targetFields inherited from class org.apache.bcel.generic.Instruction
length, opcode -
Method Summary
Modifier and TypeMethodDescriptionprotected Objectclone()booleanTests whether this targeter targets the specified instruction handle.voiddump(DataOutputStream out) Dump instruction as byte code to stream out.int[]int[]protected voidinitFromFile(ByteSequence bytes, boolean wide) Read needed data (e.g.voidsetTarget(int i, InstructionHandle target) Sets branch target for 'i'th casetoString(boolean verbose) Long output format: <position in byte code> <name of opcode> "["<opcode number>"]" "("<length of instruction>")" "<"<target instruction>">" "@"<branch target offset>protected intupdatePosition(int offset, int maxOffset) Since this is a variable length instruction, it may shift the following instructions which then need to update their position.voidupdateTarget(InstructionHandle oldIh, InstructionHandle newIh) Replaces the target of this targeter from this old handle to the new handle.Methods inherited from class org.apache.bcel.generic.BranchInstruction
getIndex, getPosition, getTarget, getTargetOffset, getTargetOffset, setIndex, setPosition, setTargetMethods inherited from class org.apache.bcel.generic.Instruction
accept, consumeStack, copy, equals, getComparator, getLength, getName, getOpcode, hashCode, isValidByte, isValidShort, produceStack, readInstruction, setComparator, toString, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.bcel.generic.StackConsumer
consumeStackMethods inherited from interface org.apache.bcel.generic.StackProducer
produceStack
-
Field Details
-
match
Deprecated.(since 6.0) will be made private; do not access directly, use getter/setter -
indices
Deprecated.(since 6.0) will be made private; do not access directly, use getter/setter -
targets
Deprecated.(since 6.0) will be made private; do not access directly, use getter/setter -
fixed_length
Deprecated.(since 6.0) will be made private; do not access directly, use getter/setter -
match_length
Deprecated.(since 6.0) will be made private; do not access directly, use getter/setter -
padding
Deprecated.(since 6.0) will be made private; do not access directly, use getter/setter
-
-
Method Details
-
clone
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
containsTarget
Description copied from interface:InstructionTargeterTests whether this targeter targets the specified instruction handle.- Specified by:
containsTargetin interfaceInstructionTargeter- Overrides:
containsTargetin classBranchInstruction- Parameters:
ih- the instruction handle to test.- Returns:
- true, if ih is target of this instruction
-
dump
Dump instruction as byte code to stream out.- Overrides:
dumpin classBranchInstruction- Parameters:
out- Output stream- Throws:
IOException- Thrown when an I/O exception of some sort has occurred.
-
getIndices
- Returns:
- array of match target offsets
-
getMatchs
- Returns:
- array of match indices
-
getTargets
- Returns:
- array of match targets
-
initFromFile
Read needed data (e.g. index) from file.- Overrides:
initFromFilein classBranchInstruction- Parameters:
bytes- input streamwide- wide prefix?- Throws:
IOException- may be thrown if the implementation needs to read data from the file- See Also:
-
setTarget
Sets branch target for 'i'th case -
toString
Description copied from class:BranchInstructionLong output format: <position in byte code> <name of opcode> "["<opcode number>"]" "("<length of instruction>")" "<"<target instruction>">" "@"<branch target offset>- Overrides:
toStringin classBranchInstruction- Parameters:
verbose- long/short format switch- Returns:
- mnemonic for instruction
-
updatePosition
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.- Overrides:
updatePositionin classBranchInstruction- Parameters:
offset- additional offset caused by preceding (variable length) instructionsmaxOffset- the maximum offset that may be caused by these instructions- Returns:
- additional offset caused by possible change of this instruction's length
-
updateTarget
Description copied from interface:InstructionTargeterReplaces the target of this targeter from this old handle to the new handle.- Specified by:
updateTargetin interfaceInstructionTargeter- Overrides:
updateTargetin classBranchInstruction- Parameters:
oldIh- old targetnewIh- new target
-