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

public final Class BranchHandle

extends InstructionHandle
Class Inheritance

BranchHandle is returned by specialized InstructionList.append() whenever a BranchInstruction is appended. This is useful when the target of this instruction is not known at time of creation and must be set later via setTarget().
See Also
InstructionHandle, Instruction, InstructionList

Field Summary

Modifier and TypeField and Description
private BranchInstruction
Inherited from org.apache.bcel.generic.InstructionHandle:
EMPTY_ARRAYEMPTY_INSTRUCTION_TARGETER_ARRAYi_position

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv static BranchHandle
getBranchHandle(final BranchInstruction i)

Factory method.

public int
public InstructionHandle

Returns:

target of instruction.
getTarget
()

public void
pack-priv void
setPosition(final int pos)

Overrides org.apache.bcel.generic.InstructionHandle.setPosition.

Sets the position, i.e., the byte code offset of the contained instruction.
public void
setTarget(final InstructionHandle ih)

Pass new target to instruction.

protected int
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 org.apache.bcel.generic.InstructionHandle.updatePosition.

Called by InstructionList.setPositions when setting the position for every instruction.
public void
updateTarget(final InstructionHandle oldIh, final InstructionHandle newIh)

Update target of instruction.

Inherited from org.apache.bcel.generic.InstructionHandle:
acceptaddAttributeaddHandleaddTargeterdisposegetAttributegetAttributesgetInstructiongetInstructionHandlegetNextgetPrevgetTargetershasTargetersremoveAllTargetersremoveAttributeremoveTargetersetNextsetPrevswapInstructiontoStringtoString

Field Detail

biback to summary
private BranchInstruction bi

Constructor Detail

BranchHandleback to summary
private BranchHandle(final BranchInstruction i)

Method Detail

getBranchHandleback to summary
pack-priv static BranchHandle getBranchHandle(final BranchInstruction i)

Factory method.

getPositionback to summary
public int getPosition()

Overrides org.apache.bcel.generic.InstructionHandle.getPosition.

Returns:int

Doc from org.apache.bcel.generic.InstructionHandle.getPosition.

the position, i.e., the byte code offset of the contained instruction. This is accurate only after InstructionList.setPositions() has been called.

Annotations
@Override
getTargetback to summary
public InstructionHandle getTarget()
Returns:InstructionHandle

target of instruction.

setInstructionback to summary
public void setInstruction(final Instruction i)

Overrides org.apache.bcel.generic.InstructionHandle.setInstruction.

Sets new contents. Old instruction is disposed and may not be used anymore.

Annotations
@Override
setPositionback to summary
pack-priv void setPosition(final int pos)

Overrides org.apache.bcel.generic.InstructionHandle.setPosition.

Doc from org.apache.bcel.generic.InstructionHandle.setPosition.

Sets the position, i.e., the byte code offset of the contained instruction.

Annotations
@Override
setTargetback to summary
public void setTarget(final InstructionHandle ih)

Pass new target to instruction.

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

Overrides org.apache.bcel.generic.InstructionHandle.updatePosition.

Doc from org.apache.bcel.generic.InstructionHandle.updatePosition.

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)

Update target of instruction.