Methods Summary |
---|
public void | accept(com.sun.org.apache.bcel.internal.generic.Visitor v)Convenience method, simply calls accept() on the contained instruction.
instruction.accept(v);
|
public void | addAttribute(java.lang.Object key, java.lang.Object attr)Add an attribute to an instruction handle.
if(attributes == null)
attributes = new HashMap(3);
attributes.put(key, attr);
|
protected void | addHandle()Overridden in BranchHandle
next = ih_list;
ih_list = this;
|
public void | addTargeter(com.sun.org.apache.bcel.internal.generic.InstructionTargeter t)Denote this handle is being referenced by t.
if(targeters == null)
targeters = new HashSet();
//if(!targeters.contains(t))
targeters.add(t);
|
void | dispose()Delete contents, i.e., remove user access and make handle reusable.
next = prev = null;
instruction.dispose();
instruction = null;
i_position = -1;
attributes = null;
removeAllTargeters();
addHandle();
|
public java.lang.Object | getAttribute(java.lang.Object key)Get attribute of an instruction handle.
if(attributes != null)
return attributes.get(key);
return null;
|
public java.util.Collection | getAttributes()
return attributes.values();
|
public final com.sun.org.apache.bcel.internal.generic.Instruction | getInstruction() return instruction;
|
static final com.sun.org.apache.bcel.internal.generic.InstructionHandle | getInstructionHandle(com.sun.org.apache.bcel.internal.generic.Instruction i)Factory method. // List of reusable handles
if(ih_list == null)
return new InstructionHandle(i);
else {
InstructionHandle ih = ih_list;
ih_list = ih.next;
ih.setInstruction(i);
return ih;
}
|
public final com.sun.org.apache.bcel.internal.generic.InstructionHandle | getNext()
return next;
|
public int | getPosition() return i_position;
|
public final com.sun.org.apache.bcel.internal.generic.InstructionHandle | getPrev() return prev;
|
public com.sun.org.apache.bcel.internal.generic.InstructionTargeter[] | getTargeters()
if(!hasTargeters())
return null;
InstructionTargeter[] t = new InstructionTargeter[targeters.size()];
targeters.toArray(t);
return t;
|
public boolean | hasTargeters()
return (targeters != null) && (targeters.size() > 0);
|
public void | removeAllTargeters()Remove all targeters, if any.
if(targeters != null)
targeters.clear();
|
public void | removeAttribute(java.lang.Object key)Delete an attribute of an instruction handle.
if(attributes != null)
attributes.remove(key);
|
public void | removeTargeter(com.sun.org.apache.bcel.internal.generic.InstructionTargeter t)Denote this handle isn't referenced anymore by t.
targeters.remove(t);
|
public void | setInstruction(com.sun.org.apache.bcel.internal.generic.Instruction i)Replace current instruction contained in this handle.
Old instruction is disposed using Instruction.dispose(). // Overridden in BranchHandle
if(i == null)
throw new ClassGenException("Assigning null to handle");
if((this.getClass() != BranchHandle.class) && (i instanceof BranchInstruction))
throw new ClassGenException("Assigning branch instruction " + i + " to plain handle");
if(instruction != null)
instruction.dispose();
instruction = i;
|
void | setPosition(int pos)Set the position, i.e., the byte code offset of the contained
instruction. i_position = pos;
|
public com.sun.org.apache.bcel.internal.generic.Instruction | swapInstruction(com.sun.org.apache.bcel.internal.generic.Instruction i)Temporarily swap the current instruction, without disturbing
anything. Meant to be used by a debugger, implementing
breakpoints. Current instruction is returned.
Instruction oldInstruction = instruction;
instruction = i;
return oldInstruction;
|
public java.lang.String | toString(boolean verbose)
return Utility.format(i_position, 4, false, ' ") + ": " + instruction.toString(verbose);
|
public java.lang.String | toString()
return toString(true);
|
protected int | updatePosition(int offset, int max_offset)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.
i_position += offset;
return 0;
|