|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--de.fub.bytecode.generic.InstructionHandle
Instances of this class give users a handle to the instructions contained in an InstructionList. Instruction objects may be used more than once within a list, this is useful because it saves memory and may be much faster. Within an InstructionList an InstructionHandle object is wrapped around all instructions, i.e., it implements a cell in a doubly-linked list. From the outside only the next and the previous instruction (handle) are accessible. One can traverse the list via an Enumeration returned by InstructionList.elements().
Instruction
,
BranchHandle
,
InstructionList
, Serialized FormField Summary | |
protected int |
i_position
|
Constructor Summary | |
protected |
InstructionHandle(Instruction i)
|
Method Summary | |
void |
accept(Visitor v)
Convenience method, simply calls accept() on the contained instruction. |
void |
addAttribute(java.lang.Object key,
java.lang.Object attr)
Add an attribute to an instruction handle. |
protected void |
addHandle()
Overridden in BranchHandle |
void |
addTargeter(InstructionTargeter t)
Denote this handle is being referenced by t. |
java.lang.Object |
getAttribute(java.lang.Object key)
Get attribute of an instruction handle. |
Instruction |
getInstruction()
|
InstructionHandle |
getNext()
|
int |
getPosition()
|
InstructionHandle |
getPrev()
|
InstructionTargeter[] |
getTargeters()
|
boolean |
hasTargeters()
|
void |
removeAllTargeters()
Remove all targeters, if any. |
void |
removeAttribute(java.lang.Object key)
Delete an attribute of an instruction handle. |
void |
removeTargeter(InstructionTargeter t)
Denote this handle isn't referenced anymore by t. |
void |
setInstruction(Instruction i)
Replace current instruction contained in this handle. |
Instruction |
swapInstruction(Instruction i)
Temporarily swap the current instruction, without disturbing anything. |
java.lang.String |
toString()
|
java.lang.String |
toString(boolean verbose)
|
protected int |
updatePosition(int offset,
int max_offset)
Called by InstructionList.setPositions when setting the position for every instruction. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected int i_position
Constructor Detail |
protected InstructionHandle(Instruction i)
Method Detail |
public final InstructionHandle getNext()
public final InstructionHandle getPrev()
public final Instruction getInstruction()
public void setInstruction(Instruction i)
public Instruction swapInstruction(Instruction i)
protected int updatePosition(int offset, int max_offset)
offset
- additional offset caused by preceding (variable length) instructionsmax_offset
- the maximum offset that may be caused by these instructionspublic int getPosition()
protected void addHandle()
public void removeAllTargeters()
public void removeTargeter(InstructionTargeter t)
public void addTargeter(InstructionTargeter t)
public boolean hasTargeters()
public InstructionTargeter[] getTargeters()
public java.lang.String toString(boolean verbose)
public java.lang.String toString()
toString
in class java.lang.Object
public void addAttribute(java.lang.Object key, java.lang.Object attr)
key
- the key object to store/retrieve the attributeattr
- the attribute to associate with this handlepublic void removeAttribute(java.lang.Object key)
key
- the key object to retrieve the attributepublic java.lang.Object getAttribute(java.lang.Object key)
key
- the key object to store/retrieve the attributepublic void accept(Visitor v)
v
- Visitor object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |