harpoon.ClassFile
Class HData

java.lang.Object
  extended by harpoon.ClassFile.HData
Direct Known Subclasses:
Data

public abstract class HData
extends Object

HData is an interface that all views of a particular class's static data should extend. An HData encapsulates a data view of class data in roughly the same way that an HCode encapsulates a code view of method instructions. A particular implementation of HData correlates with "memory layout" for a particular runtime implementation.

It is possible (and rather recommended) for a class to have *several* HDatas associated with it, each of which encapsulates a certain set of class data.

Version:
$Id: HData.java,v 1.2 2002/02/25 21:03:03 cananian Exp $
Author:
Duncan Bryce <duncan@lcs.mit.edu>

Constructor Summary
HData()
           
 
Method Summary
 HData clone(HClass cls)
          Clone this HData, possibly moving it to a different HClass.
 Iterator getElementsI()
          Return an Iterator over the component objects making up this data view.
 List getElementsL()
          Return an ordered Collection (a List) of the component objects making up this data view.
abstract  HClass getHClass()
          Return the HClass to which this HData belongs.
abstract  HDataElement getRootElement()
          Return the 'root' element of this data view.
 void print(PrintWriter pw)
          Print a human-readable representation of this dataview using a null callback.
abstract  void print(PrintWriter pw, HCode.PrintCallback callback)
          Print a human-readable representation of this dataview using the specified callback.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HData

public HData()
Method Detail

clone

public HData clone(HClass cls)
            throws CloneNotSupportedException
Clone this HData, possibly moving it to a different HClass.

Throws:
CloneNotSupportedException - if it is not possible to clone this HData.

getHClass

public abstract HClass getHClass()
Return the HClass to which this HData belongs. Returns null if this HData has global, rather than class-local, data structures.


getRootElement

public abstract HDataElement getRootElement()
Return the 'root' element of this data view.

Returns:
root of the data view, or null if this notion is not applicable.

getElementsI

public Iterator getElementsI()
Return an Iterator over the component objects making up this data view. If there is a 'root' to the data view, it should be the first element enumerated.

AT LEAST ONE OF getElementsI() AND getElementsL() MUST BE IMPLEMENTED.


getElementsL

public List getElementsL()
Return an ordered Collection (a List) of the component objects making up this data view. If there is a 'root' to the data view, it should be the first element in the List.

AT LEAST ONE OF getElementsI() AND getElementsL() MUST BE IMPLEMENTED.


print

public final void print(PrintWriter pw)
Print a human-readable representation of this dataview using a null callback.


print

public abstract void print(PrintWriter pw,
                           HCode.PrintCallback callback)
Print a human-readable representation of this dataview using the specified callback.