|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectharpoon.ClassFile.HCode<HCE>
public abstract class HCode<HCE extends HCodeElement>
HCode
is an abstract class that all views of a particular
method's executable code should extend.
An HCode
corresponds roughly to a "list of instructions".
HMethod
,
HCodeElement
,
Code
,
Instr
Nested Class Summary | |
---|---|
static class |
HCode.PrintCallback<HCE extends HCodeElement>
Callback interface for annotating pretty-prints of HCode s. |
Constructor Summary | |
---|---|
HCode()
|
Method Summary | |
---|---|
HCode<HCE> |
clone()
Clone this HCode and all associated
HCodeElement s. |
HCodeAndMaps<HCE> |
clone(HMethod newMethod)
Clone this HCode , possibly moving it to a different method. |
abstract ArrayFactory<HCE> |
elementArrayFactory()
Return an ArrayFactory for the HCodeElement s
composing this HCode . |
Indexer |
elementIndexer()
Return an Indexer for the HCodeElement s
composing this HCode . |
HCE[] |
getElements()
Deprecated. use getElementsL() instead. |
Iterator<HCE> |
getElementsI()
Return an Iterator over the component objects making up this code view. |
List<HCE> |
getElementsL()
Return an ordered Collection (a List ) of
the component objects making up this code view. |
HCE[] |
getLeafElements()
Return the 'leaves' of this code view; that is, the elements with no successors. |
abstract HMethod |
getMethod()
Return the HMethod to which this HCode
belongs. |
abstract String |
getName()
Return the name of this code view. |
HCE |
getRootElement()
Return the 'root' element of this code view. |
void |
print(PrintWriter pw)
Pretty-print this code view using an empty callback. |
void |
print(PrintWriter pw,
HCode.PrintCallback<HCE> callback)
Pretty-print this code view using the specified callback. |
String |
toString()
Returns a human-readable representation of this HCode . |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public HCode()
Method Detail |
---|
public abstract HMethod getMethod()
HMethod
to which this HCode
belongs.
public abstract String getName()
"bytecode"
.
It is suggested that additional views be named in a similarly
human-friendly fashion.
public HCE[] getElements()
HCodeElement
array.
Instr
public List<HCE> getElementsL()
Collection
(a List
) of
the component objects making up this code view. If there is a
'root' to the code view, it should be the first element in the
List. Note that the object returned need not be static; i.e.
the contents of the List
may (or may not) change as
the underlying representation is modified. If you need a
static view, see SnapshotIterator
; if you need
a dynamic view, don't cache the returned List
.
The getElementsI()
method
must have been implemented for the default implementation to work
properly.
public Iterator<HCE> getElementsI()
Subclasses must override the default implementation of
at least one of
getElementsL()
or getElementsI()
in order to work properly.
public HCE getRootElement()
null
if this notion
is not applicable.public HCE[] getLeafElements()
null
if this notion
is not applicable.public abstract ArrayFactory<HCE> elementArrayFactory()
ArrayFactory
for the HCodeElement
s
composing this HCode
.
public Indexer elementIndexer()
Indexer
for the HCodeElement
s
composing this HCode
. The default Indexer
returned does not implement Indexer.getByID()
.
public HCodeAndMaps<HCE> clone(HMethod newMethod) throws CloneNotSupportedException
HCode
, possibly moving it to a different method.
Throws CloneNotSupportedException
if not overridden.
CloneNotSupportedException
- if it is not possible to clone
this HCode
.public HCode<HCE> clone() throws CloneNotSupportedException
HCode
and all associated
HCodeElement
s.
Calls clone(getMethod())
.
clone
in class Object
CloneNotSupportedException
public final void print(PrintWriter pw)
public void print(PrintWriter pw, HCode.PrintCallback<HCE> callback)
public String toString()
HCode
.
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |