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

public Class InstructionHandle

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Known Direct Subclasses
org.aspectj.apache.bcel.generic.BranchHandle
Imports
java.util.Collections, .HashSet, .Set, org.aspectj.apache.bcel.classfile.Utility

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().
Author
M. Dahm
Version
$Id: InstructionHandle.java,v 1.9 2009/10/05 17:35:36 aclement Exp $
See Also
Instruction, BranchHandle, InstructionList

Field Summary

Modifier and TypeField and Description
pack-priv Instruction
pack-priv InstructionHandle
protected int
pack-priv InstructionHandle
private Set<InstructionTargeter>

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public void
addTargeter(InstructionTargeter t)

Denote this handle is being referenced by t.

pack-priv void
dispose()

Delete contents, i.e., remove user access and make handle reusable.

public final Instruction
pack-priv static final InstructionHandle
public final InstructionHandle
public int

Returns:

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

public final InstructionHandle
public Set<InstructionTargeter>
public Set<InstructionTargeter>
public boolean
public void
removeAllTargeters()

Remove all targeters, if any.

public void
removeTargeter(InstructionTargeter t)

Denote this handle isn't referenced anymore by t.

public void
setInstruction(Instruction i)

Replace current instruction contained in this handle.

pack-priv void
setPosition(int pos)

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

public String

Returns:

a (verbose) string representation of the contained instruction.
toString
(boolean verbose)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

instructionback to summary
pack-priv Instruction instruction
nextback to summary
pack-priv InstructionHandle next
posback to summary
protected int pos
prevback to summary
pack-priv InstructionHandle prev
targetersback to summary
private Set<InstructionTargeter> targeters

Constructor Detail

InstructionHandleback to summary
protected InstructionHandle(Instruction i)

Method Detail

addTargeterback to summary
public void addTargeter(InstructionTargeter t)

Denote this handle is being referenced by t.

disposeback to summary
pack-priv void dispose()

Delete contents, i.e., remove user access and make handle reusable.

getInstructionback to summary
public final Instruction getInstruction()
getInstructionHandleback to summary
pack-priv static final InstructionHandle getInstructionHandle(Instruction i)
getNextback to summary
public final InstructionHandle getNext()
getPositionback to summary
public int getPosition()
Returns:int

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

getPrevback to summary
public final InstructionHandle getPrev()
getTargetersback to summary
public Set<InstructionTargeter> getTargeters()
getTargetersCopyback to summary
public Set<InstructionTargeter> getTargetersCopy()
hasTargetersback to summary
public boolean hasTargeters()
removeAllTargetersback to summary
public void removeAllTargeters()

Remove all targeters, if any.

removeTargeterback to summary
public void removeTargeter(InstructionTargeter t)

Denote this handle isn't referenced anymore by t.

setInstructionback to summary
public void setInstruction(Instruction i)

Replace current instruction contained in this handle. Old instruction is disposed using Instruction.dispose().

setPositionback to summary
pack-priv void setPosition(int pos)

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

toStringback to summary
public String toString(boolean verbose)
Returns:String

a (verbose) string representation of the contained instruction.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.