FileDocCategorySizeDatePackage
BranchHandle.javaAPI DocJava SE 6 API5157Tue Jun 10 00:22:18 BST 2008com.sun.org.apache.bcel.internal.generic

BranchHandle

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().
see
InstructionHandle
see
Instruction
see
InstructionList
version
$Id: BranchHandle.java,v 1.1.2.1 2005/07/31 23:44:58 jeffsuttor Exp $
author
M. Dahm

Fields Summary
private BranchInstruction
bi
private static BranchHandle
bh_list
Factory methods.
Constructors Summary
private BranchHandle(BranchInstruction i)

    super(i);
    bi = i;
  
Methods Summary
protected voidaddHandle()
Handle adds itself to the list of resuable handles.

    next    = bh_list;
    bh_list = this;
  
static final com.sun.org.apache.bcel.internal.generic.BranchHandlegetBranchHandle(com.sun.org.apache.bcel.internal.generic.BranchInstruction i)

 // List of reusable handles

       
    if(bh_list == null)
      return new BranchHandle(i);
    else {
      BranchHandle bh = bh_list;
      bh_list = (BranchHandle)bh.next;

      bh.setInstruction(i);

      return bh;
    }
  
public intgetPosition()

 return bi.position; 
public com.sun.org.apache.bcel.internal.generic.InstructionHandlegetTarget()

return
target of instruction.

    return bi.getTarget();
  
public voidsetInstruction(com.sun.org.apache.bcel.internal.generic.Instruction i)
Set new contents. Old instruction is disposed and may not be used anymore.

    super.setInstruction(i);

    if(!(i instanceof BranchInstruction))
      throw new ClassGenException("Assigning " + i +
				  " to branch handle which is not a branch instruction");

    bi = (BranchInstruction)i;
  
voidsetPosition(int pos)

    i_position = bi.position = pos;
  
public voidsetTarget(com.sun.org.apache.bcel.internal.generic.InstructionHandle ih)
Pass new target to instruction.

    bi.setTarget(ih);
  
protected intupdatePosition(int offset, int max_offset)

    int x = bi.updatePosition(offset, max_offset);
    i_position = bi.position;
    return x;
  
public voidupdateTarget(com.sun.org.apache.bcel.internal.generic.InstructionHandle old_ih, com.sun.org.apache.bcel.internal.generic.InstructionHandle new_ih)
Update target of instruction.

    bi.updateTarget(old_ih, new_ih);