Top Description Fields Constructors Methods
com.sun.org.apache.bcel.internal.generic

public abstract Class Select

extends BranchInstruction
implements VariableLengthInstruction, StackConsumer, StackProducer
Class Inheritance
All Implemented Interfaces
com.sun.org.apache.bcel.internal.generic.StackProducer, com.sun.org.apache.bcel.internal.generic.StackConsumer, com.sun.org.apache.bcel.internal.generic.VariableLengthInstruction
Known Direct Subclasses
com.sun.org.apache.bcel.internal.generic.TABLESWITCH, com.sun.org.apache.bcel.internal.generic.LOOKUPSWITCH
Imports
java.io.DataOutputStream, .IOException, com.sun.org.apache.bcel.internal.util.ByteSequence

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

Modifier and TypeField and Description
protected int
fixed_length

Deprecated (since 6.0) will be made private; do not access directly, use getter/setter
protected int[]
indices

Deprecated (since 6.0) will be made private; do not access directly, use getter/setter
protected int[]
match

Deprecated (since 6.0) will be made private; do not access directly, use getter/setter
protected int
match_length

Deprecated (since 6.0) will be made private; do not access directly, use getter/setter
protected int
padding

Deprecated (since 6.0) will be made private; do not access directly, use getter/setter
protected InstructionHandle[]
targets

Deprecated (since 6.0) will be made private; do not access directly, use getter/setter
Inherited from com.sun.org.apache.bcel.internal.generic.BranchInstruction:
indexpositiontarget

Constructor Summary

AccessConstructor and Description
pack-priv
Select()

Empty constructor needed for Instruction.readInstruction.

pack-priv
Select(final short opcode, final int[]
array of matching values
match
,
final InstructionHandle[]
instruction targets
targets
,
final InstructionHandle
default instruction target
defaultTarget
)

(Match, target) pairs for switch.

Method Summary

Modifier and TypeMethod and Description
protected Object
clone()

Overrides java.lang.Object.clone.

Creates and returns a copy of this object.
public boolean

Returns:

true, if ih is target of this instruction
containsTarget
(final InstructionHandle ih)

Overrides com.sun.org.apache.bcel.internal.generic.BranchInstruction.containsTarget.

Implements com.sun.org.apache.bcel.internal.generic.InstructionTargeter.containsTarget.

Checks whether this targeter targets the specified instruction handle.
pack-priv void
dispose()

Overrides com.sun.org.apache.bcel.internal.generic.BranchInstruction.dispose.

Inform targets that they're not targeted anymore.
public void
dump(final DataOutputStream
Output stream
out
)

Overrides com.sun.org.apache.bcel.internal.generic.BranchInstruction.dump.

Dump instruction as byte code to stream out.
pack-priv final int

Returns:

the fixed_length
getFixedLength
()

public int[]

Returns:

array of match target offsets
getIndices
()

pack-priv final int

Returns:

index entry from indices
getIndices
(final int index)

pack-priv final int

Returns:

match entry
getMatch
(final int index)

pack-priv final int

Returns:

the match_length
getMatchLength
()

public int[]

Returns:

array of match indices
getMatchs
()

pack-priv final int

Returns:

the padding
getPadding
()

pack-priv final InstructionHandle

Returns:

target entry
getTarget
(final int index)

public InstructionHandle[]

Returns:

array of match targets
getTargets
()

protected void
initFromFile(final ByteSequence
input stream
bytes
,
final boolean
wide prefix?
wide
)

Overrides com.sun.org.apache.bcel.internal.generic.BranchInstruction.initFromFile.

Read needed data (e.g. index) from file.
pack-priv final void
setFixedLength(final int
the fixed_length to set
fixedLength
)

pack-priv final int
setIndices(final int i, final int value)

pack-priv final void
setIndices(final int[] array)

pack-priv final void
setMatch(final int index, final int value)

pack-priv final void
setMatches(final int[] array)

pack-priv final int
setMatchLength(final int
the match_length to set
matchLength
)

public void
setTarget(final int i, final InstructionHandle target)

Set branch target for 'i'th case

pack-priv final void
public String

Returns:

mnemonic for instruction
toString
(final boolean
long/short format switch
verbose
)

Overrides com.sun.org.apache.bcel.internal.generic.BranchInstruction.toString.

Long output format: <position in byte code> <name of opcode> "["<opcode number>"]" "("<length of instruction>")" "<"<target instruction>">" "@"<branch target offset>
protected int

Returns:

additional offset caused by possible change of this instruction's length
updatePosition
(final int
additional offset caused by preceding (variable length) instructions
offset
,
final int
the maximum offset that may be caused by these instructions
maxOffset
)

Overrides com.sun.org.apache.bcel.internal.generic.BranchInstruction.updatePosition.

Since this is a variable length instruction, it may shift the following instructions which then need to update their position.
public void
updateTarget(final InstructionHandle
old target
oldIh
,
final InstructionHandle
new target
newIh
)

Overrides com.sun.org.apache.bcel.internal.generic.BranchInstruction.updateTarget.

Implements com.sun.org.apache.bcel.internal.generic.InstructionTargeter.updateTarget.

Replaces the target of this targeter from this old handle to the new handle.
Inherited from com.sun.org.apache.bcel.internal.generic.BranchInstruction:
getIndexgetPositiongetTargetgetTargetOffsetgetTargetOffsetnotifyTargetsetIndexsetOpcodesetPositionsetTarget

Field Detail

fixed_lengthback to summary
protected int fixed_length

Deprecated

(since 6.0) will be made private; do not access directly, use getter/setter

Annotations
@Deprecated
indicesback to summary
protected int[] indices

Deprecated

(since 6.0) will be made private; do not access directly, use getter/setter

Annotations
@Deprecated
matchback to summary
protected int[] match

Deprecated

(since 6.0) will be made private; do not access directly, use getter/setter

Annotations
@Deprecated
match_lengthback to summary
protected int match_length

Deprecated

(since 6.0) will be made private; do not access directly, use getter/setter

Annotations
@Deprecated
paddingback to summary
protected int padding

Deprecated

(since 6.0) will be made private; do not access directly, use getter/setter

Annotations
@Deprecated
targetsback to summary
protected InstructionHandle[] targets

Deprecated

(since 6.0) will be made private; do not access directly, use getter/setter

Annotations
@Deprecated

Constructor Detail

Selectback to summary
pack-priv Select()

Empty constructor needed for Instruction.readInstruction. Not to be used otherwise.

Selectback to summary
pack-priv Select(final short opcode, final int[] match, final InstructionHandle[] targets, final InstructionHandle defaultTarget)

(Match, target) pairs for switch. 'Match' and 'targets' must have the same length of course.

Parameters
match:int[]

array of matching values

targets:InstructionHandle[]

instruction targets

defaultTarget:InstructionHandle

default instruction target

Method Detail

cloneback to summary
protected Object clone() throws CloneNotSupportedException

Overrides java.lang.Object.clone.

Doc from java.lang.Object.clone.

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:

x.clone() != x
will be true, and that the expression:
x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
x.clone().equals(x)
will be true, this is not an absolute requirement.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

Returns:Object

a clone of this instance.

Annotations
@Override
Exceptions
CloneNotSupportedException:
if the object's class does not support the Cloneable interface. Subclasses that override the clone method can also throw this exception to indicate that an instance cannot be cloned.
containsTargetback to summary
public boolean containsTarget(final InstructionHandle ih)

Overrides com.sun.org.apache.bcel.internal.generic.BranchInstruction.containsTarget.

Implements com.sun.org.apache.bcel.internal.generic.InstructionTargeter.containsTarget.

Doc from com.sun.org.apache.bcel.internal.generic.InstructionTargeter.containsTarget.

Checks whether this targeter targets the specified instruction handle.

Returns:boolean

true, if ih is target of this instruction

Annotations
@Override
disposeback to summary
pack-priv void dispose()

Overrides com.sun.org.apache.bcel.internal.generic.BranchInstruction.dispose.

Inform targets that they're not targeted anymore.

Annotations
@Override
dumpback to summary
public void dump(final DataOutputStream out) throws IOException

Overrides com.sun.org.apache.bcel.internal.generic.BranchInstruction.dump.

Dump instruction as byte code to stream out.

Parameters
out:DataOutputStream

Output stream

Annotations
@Override
Exceptions
IOException:

Doc from com.sun.org.apache.bcel.internal.generic.Instruction.dump.

Thrown when an I/O exception of some sort has occurred.

getFixedLengthback to summary
pack-priv final int getFixedLength()
Returns:int

the fixed_length

Since
6.0
getIndicesback to summary
public int[] getIndices()
Returns:int[]

array of match target offsets

getIndicesback to summary
pack-priv final int getIndices(final int index)
Returns:int

index entry from indices

Since
6.0
getMatchback to summary
pack-priv final int getMatch(final int index)
Returns:int

match entry

Since
6.0
getMatchLengthback to summary
pack-priv final int getMatchLength()
Returns:int

the match_length

Since
6.0
getMatchsback to summary
public int[] getMatchs()
Returns:int[]

array of match indices

getPaddingback to summary
pack-priv final int getPadding()
Returns:int

the padding

Since
6.0
getTargetback to summary
pack-priv final InstructionHandle getTarget(final int index)
Returns:InstructionHandle

target entry

Since
6.0
getTargetsback to summary
public InstructionHandle[] getTargets()
Returns:InstructionHandle[]

array of match targets

initFromFileback to summary
protected void initFromFile(final ByteSequence bytes, final boolean wide) throws IOException

Overrides com.sun.org.apache.bcel.internal.generic.BranchInstruction.initFromFile.

Read needed data (e.g. index) from file.

Parameters
bytes:ByteSequence

Doc from com.sun.org.apache.bcel.internal.generic.BranchInstruction.initFromFile.

input stream

wide:boolean

Doc from com.sun.org.apache.bcel.internal.generic.BranchInstruction.initFromFile.

wide prefix?

Annotations
@Override
Exceptions
IOException:

Doc from com.sun.org.apache.bcel.internal.generic.Instruction.initFromFile.

may be thrown if the implementation needs to read data from the file

setFixedLengthback to summary
pack-priv final void setFixedLength(final int fixedLength)
Parameters
fixedLength:int

the fixed_length to set

Since
6.0
setIndicesback to summary
pack-priv final int setIndices(final int i, final int value)
Since
6.0
setIndicesback to summary
pack-priv final void setIndices(final int[] array)
Since
6.0
setMatchback to summary
pack-priv final void setMatch(final int index, final int value)
Since
6.0
setMatchesback to summary
pack-priv final void setMatches(final int[] array)
Since
6.0
setMatchLengthback to summary
pack-priv final int setMatchLength(final int matchLength)
Parameters
matchLength:int

the match_length to set

Since
6.0
setTargetback to summary
public void setTarget(final int i, final InstructionHandle target)

Set branch target for 'i'th case

setTargetsback to summary
pack-priv final void setTargets(final InstructionHandle[] array)
Since
6.0
toStringback to summary
public String toString(final boolean verbose)

Overrides com.sun.org.apache.bcel.internal.generic.BranchInstruction.toString.

Doc from com.sun.org.apache.bcel.internal.generic.BranchInstruction.toString.

Long output format: <position in byte code> <name of opcode> "["<opcode number>"]" "("<length of instruction>")" "<"<target instruction>">" "@"<branch target offset>

Parameters
verbose:boolean

long/short format switch

Returns:String

mnemonic for instruction

Annotations
@Override
updatePositionback to summary
protected int updatePosition(final int offset, final int maxOffset)

Overrides com.sun.org.apache.bcel.internal.generic.BranchInstruction.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.

Parameters
offset:int

additional offset caused by preceding (variable length) instructions

maxOffset:int

the maximum offset that may be caused by these instructions

Returns:int

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

Annotations
@Override
updateTargetback to summary
public void updateTarget(final InstructionHandle oldIh, final InstructionHandle newIh)

Overrides com.sun.org.apache.bcel.internal.generic.BranchInstruction.updateTarget.

Implements com.sun.org.apache.bcel.internal.generic.InstructionTargeter.updateTarget.

Doc from com.sun.org.apache.bcel.internal.generic.InstructionTargeter.updateTarget.

Replaces the target of this targeter from this old handle to the new handle.

Parameters
oldIh:InstructionHandle

old target

newIh:InstructionHandle

new target

Annotations
@Override