edu.wisc.cs.stego.heap
Class HVertex

java.lang.Object
  |
  +--edu.wisc.cs.stego.heap.HVertex
Direct Known Subclasses:
HArray, HObject

public abstract class HVertex
extends java.lang.Object

This is the superclass of all types which represent various objects in a reconstructed heap. Each object read from a profile will be represented by exactly one instance of a subclass of HVertex. Thus, it may be assumed that comparing references is sufficient for determining equality of two objects.


Field Summary
protected  long address
          The numerical address of this object in the heap.
protected  java.util.Vector in_pointers
          A vector containing references to object which have the current one as a member.
protected  java.lang.String key
          A string containing the address in hexidecimal notation.
protected  boolean resolved
          True if this object's members have been resolved, false otherwise.
protected  java.lang.String type
          The name of the type of this object.
 
Constructor Summary
protected HVertex()
          Constructor used by subclasses.
 
Method Summary
 void addInPointer(HVertex vert)
          Adds an in-pointer from a specified vertex.
abstract  void addMember(java.lang.String line)
          Adds a new member to this object.
protected  void finalize()
          Removes the in-pointer from all objects which referenced by this one.
 long getAddress()
          Returns the address of this object;
 HVertex getInPointer(int i)
          Returns an object which contains a reference to this one.
 java.lang.String getKey()
          Returns the key for this object as it is used in the maps before resolution.
abstract  java.util.Iterator getMembers()
          Returns the set of vertices which are succesors of this one.
 int getNInPointers()
          Returns the number of in pointers for this object.
 java.lang.String getType()
          Returns the name of the type of this object.
 void removeInPointer(HVertex vert)
          Removes an in pointer from this vertex.
abstract  void resolve(java.util.HashMap heap)
          Given a map of all of the objects read in from the profile, resolve the members to references to HVertex objects.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resolved

protected boolean resolved
True if this object's members have been resolved, false otherwise.

type

protected java.lang.String type
The name of the type of this object.

address

protected long address
The numerical address of this object in the heap.

key

protected java.lang.String key
A string containing the address in hexidecimal notation. This is used as the key into the various HashMaps before resolution.

in_pointers

protected java.util.Vector in_pointers
A vector containing references to object which have the current one as a member. HObjects and HMembers are responsible for adding themselves to this vector with the addInPointer method.
See Also:
addInPointer(edu.wisc.cs.stego.heap.HVertex)
Constructor Detail

HVertex

protected HVertex()
Constructor used by subclasses. Initizlizes the resolved and in_pointers members. The others are left to subclasses.
Method Detail

addMember

public abstract void addMember(java.lang.String line)
Adds a new member to this object. This line is expected to be in the format required by the type of the object (HArray or HObject).
Parameters:
line - an object member line from a heap profile.

resolve

public abstract void resolve(java.util.HashMap heap)
Given a map of all of the objects read in from the profile, resolve the members to references to HVertex objects. This method is responsible for setting the resolved flag to true.
Parameters:
heap - a HashMap containing all of the objects from the heap profile.

getMembers

public abstract java.util.Iterator getMembers()
Returns the set of vertices which are succesors of this one. This is abstract to account for the differences in the method of member storage between arrays and objects.
Returns:
the set of vertices which are succesors of this one.

addInPointer

public void addInPointer(HVertex vert)
Adds an in-pointer from a specified vertex.
Parameters:
vert - a vertex which contains a reference to this one.

removeInPointer

public void removeInPointer(HVertex vert)
Removes an in pointer from this vertex. This is used when pruning the graph to remove unreachable nodes.
Parameters:
vert - a vertex which contains a reference to this one.

getNInPointers

public int getNInPointers()
Returns the number of in pointers for this object.
Returns:
the number of in pointers for this object.

getInPointer

public HVertex getInPointer(int i)
Returns an object which contains a reference to this one.
Parameters:
i - the index of the in pointer resquested.
Returns:
an object which contains a reference to this one.

getKey

public java.lang.String getKey()
Returns the key for this object as it is used in the maps before resolution.
Returns:
the key for this object.

getType

public java.lang.String getType()
Returns the name of the type of this object.
Returns:
the name of the type of this object.

getAddress

public long getAddress()
Returns the address of this object;
Returns:
the address of this object;

finalize

protected void finalize()
Removes the in-pointer from all objects which referenced by this one. This method is called automatically by the Virtual Machine's garbage collector.
Overrides:
finalize in class java.lang.Object