org.apache.bcel.generic

Class BranchHandle

Implemented Interfaces:
java.io.Serializable

public final class BranchHandle
extends InstructionHandle

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().
Version:
$Id: BranchHandle.java 386056 2006-03-15 11:31:56Z tcurdt $
Author:
M. Dahm
See Also:
InstructionHandle, Instruction, InstructionList, Serialized Form

Field Summary

private static BranchHandle
bh_list
Factory methods.
private BranchInstruction
bi

Fields inherited from class org.apache.bcel.generic.InstructionHandle

attributes, i_position, ih_list, instruction, next, prev, targeters

Constructor Summary

BranchHandle(BranchInstruction i)

Method Summary

protected void
addHandle()
Handle adds itself to the list of resuable handles.
(package private) static BranchHandle
getBranchHandle(BranchInstruction i)
int
getPosition()
InstructionHandle
getTarget()
void
setInstruction(Instruction i)
Set new contents.
(package private) void
setPosition(int pos)
void
setTarget(InstructionHandle ih)
Pass new target to instruction.
protected int
updatePosition(int offset, int max_offset)
void
updateTarget(InstructionHandle old_ih, InstructionHandle new_ih)
Update target of instruction.

Methods inherited from class org.apache.bcel.generic.InstructionHandle

accept, addAttribute, addHandle, addTargeter, dispose, getAttribute, getAttributes, getInstruction, getInstructionHandle, getNext, getPosition, getPrev, getTargeters, hasTargeters, removeAllTargeters, removeAttribute, removeTargeter, setInstruction, setPosition, swapInstruction, toString, toString, updatePosition

Field Details

bh_list

private static BranchHandle bh_list
Factory methods.

bi

private BranchInstruction bi

Constructor Details

BranchHandle

private BranchHandle(BranchInstruction i)

Method Details

addHandle

protected void addHandle()
Handle adds itself to the list of resuable handles.
Overrides:
addHandle in interface InstructionHandle

getBranchHandle

(package private) static final BranchHandle getBranchHandle(BranchInstruction i)

getPosition

public int getPosition()
Overrides:
getPosition in interface InstructionHandle

getTarget

public InstructionHandle getTarget()
Returns:
target of instruction.

setInstruction

public void setInstruction(Instruction i)
Set new contents. Old instruction is disposed and may not be used anymore.
Overrides:
setInstruction in interface InstructionHandle

setPosition

(package private)  void setPosition(int pos)
Overrides:
setPosition in interface InstructionHandle

setTarget

public void setTarget(InstructionHandle ih)
Pass new target to instruction.

updatePosition

protected int updatePosition(int offset,
                             int max_offset)
Overrides:
updatePosition in interface InstructionHandle

updateTarget

public void updateTarget(InstructionHandle old_ih,
                         InstructionHandle new_ih)
Update target of instruction.