Top Description Fields Constructors Methods
org.aspectj.apache.bcel.generic

public abstract Class InstructionSelect

extends InstructionBranch
Class Inheritance
Known Direct Subclasses
org.aspectj.apache.bcel.generic.LOOKUPSWITCH, org.aspectj.apache.bcel.generic.TABLESWITCH
Imports
java.io.DataOutputStream, .IOException, org.aspectj.apache.bcel.util.ByteSequence

Select - Abstract super class for LOOKUPSWITCH and TABLESWITCH instructions.
Author
M. Dahm
Version
$Id: InstructionSelect.java,v 1.4 2009/10/05 17:35:36 aclement Exp $
See Also
LOOKUPSWITCH, TABLESWITCH, InstructionList

Field Summary

Modifier and TypeField and Description
protected int
protected int[]
protected short
protected int[]
protected int
protected int
protected InstructionHandle[]
Inherited from org.aspectj.apache.bcel.generic.InstructionBranch:
positionOfThisInstructiontargetIndextargetInstruction

Constructor Summary

AccessConstructor and Description
pack-priv
InstructionSelect(short opcode, int[]
array of matching values
match
,
InstructionHandle[]
instruction targets
targets
,
InstructionHandle
default instruction target
target
)

(Match, target) pairs for switch.

public
InstructionSelect(short opcode, ByteSequence bytes)

Method Summary

Modifier and TypeMethod and Description
public boolean
pack-priv void
dispose()

Overrides org.aspectj.apache.bcel.generic.InstructionBranch.dispose.

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

Overrides org.aspectj.apache.bcel.generic.InstructionBranch.dump.

Dump instruction as byte code to stream out.
public boolean
equals(Object
the reference object with which to compare.
other
)

Overrides org.aspectj.apache.bcel.generic.InstructionBranch.equals.

Only equal if they are the same branch instruction - otherwise too risky as the targets may only temporarily be pointing at the same destination.
public int[]

Returns:

array of match target offsets
getIndices
()

public int
public int[]

Returns:

array of match indices
getMatchs
()

protected int
public InstructionHandle[]

Returns:

array of match targets
getTargets
()

public int
hashCode()

Overrides org.aspectj.apache.bcel.generic.InstructionBranch.hashCode.

Returns a hash code value for the object.
public void
setTarget(int i, InstructionHandle target)

Set branch target for `i'th case

public String

Returns:

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

Overrides org.aspectj.apache.bcel.generic.InstructionBranch.toString.

Long output format:
protected int

Returns:

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

Overrides org.aspectj.apache.bcel.generic.InstructionBranch.updatePosition.

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

Overrides org.aspectj.apache.bcel.generic.InstructionBranch.updateTarget.

Implements org.aspectj.apache.bcel.generic.InstructionTargeter.updateTarget.

Update the target destination for this instruction.
Inherited from org.aspectj.apache.bcel.generic.InstructionBranch:
getIndexgetTargetgetTargetOffsetgetTypeisIfInstructionnotifyTargetphysicalSuccessorsetTarget

Field Detail

fixedLengthback to summary
protected int fixedLength
indicesback to summary
protected int[] indices
lengthback to summary
protected short length
matchback to summary
protected int[] match
matchLengthback to summary
protected int matchLength
paddingback to summary
protected int padding
targetsback to summary
protected InstructionHandle[] targets

Constructor Detail

InstructionSelectback to summary
pack-priv InstructionSelect(short opcode, int[] match, InstructionHandle[] targets, InstructionHandle target)

(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

target:InstructionHandle

default instruction target

InstructionSelectback to summary
public InstructionSelect(short opcode, ByteSequence bytes) throws IOException

Method Detail

containsTargetback to summary
public boolean containsTarget(InstructionHandle ih)

Overrides org.aspectj.apache.bcel.generic.InstructionBranch.containsTarget.

Implements org.aspectj.apache.bcel.generic.InstructionTargeter.containsTarget.

Returns:boolean

true, if ih is target of this instruction

disposeback to summary
pack-priv void dispose()

Overrides org.aspectj.apache.bcel.generic.InstructionBranch.dispose.

Inform targets that they're not targeted anymore.

dumpback to summary
public void dump(DataOutputStream out) throws IOException

Overrides org.aspectj.apache.bcel.generic.InstructionBranch.dump.

Dump instruction as byte code to stream out.

Parameters
out:DataOutputStream

Output stream

equalsback to summary
public boolean equals(Object other)

Overrides org.aspectj.apache.bcel.generic.InstructionBranch.equals.

Doc from org.aspectj.apache.bcel.generic.InstructionBranch.equals.

Only equal if they are the same branch instruction - otherwise too risky as the targets may only temporarily be pointing at the same destination.

Parameters
other:Object

Doc from java.lang.Object.equals.

the reference object with which to compare.

Returns:boolean

Doc from java.lang.Object.equals.

true if this object is the same as the obj argument; false otherwise.

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

array of match target offsets

getLengthback to summary
public int getLength()

Overrides org.aspectj.apache.bcel.generic.Instruction.getLength.

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

array of match indices

getTargetOffsetback to summary
protected int getTargetOffset(InstructionHandle target)
getTargetsback to summary
public InstructionHandle[] getTargets()
Returns:InstructionHandle[]

array of match targets

hashCodeback to summary
public int hashCode()

Overrides org.aspectj.apache.bcel.generic.InstructionBranch.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

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

Set branch target for `i'th case

toStringback to summary
public String toString(boolean verbose)

Overrides org.aspectj.apache.bcel.generic.InstructionBranch.toString.

Doc from org.aspectj.apache.bcel.generic.InstructionBranch.toString.

Long output format:

Parameters
verbose:boolean

long/short format switch

Returns:String

mnemonic for instruction

updatePositionback to summary
protected int updatePosition(int offset, int max_offset)

Overrides org.aspectj.apache.bcel.generic.InstructionBranch.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

max_offset:int

the maximum offset that may be caused by these instructions

Returns:int

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

updateTargetback to summary
public void updateTarget(InstructionHandle old_ih, InstructionHandle new_ih)

Overrides org.aspectj.apache.bcel.generic.InstructionBranch.updateTarget.

Implements org.aspectj.apache.bcel.generic.InstructionTargeter.updateTarget.

Doc from org.aspectj.apache.bcel.generic.InstructionBranch.updateTarget.

Update the target destination for this instruction. If an oldHandle is provided it is checked to verify that is where the target currently points to before changing it.

Parameters
old_ih:InstructionHandle

old target

new_ih:InstructionHandle

new target