org.eclipse.mat.snapshot
Class MultiplePathsFromGCRootsRecord

java.lang.Object
  extended by org.eclipse.mat.snapshot.MultiplePathsFromGCRootsRecord

public class MultiplePathsFromGCRootsRecord
extends java.lang.Object

This class represents a set of paths from the GC roots to different objects, which go through one and the same object.


Constructor Summary
MultiplePathsFromGCRootsRecord(int objectId, int level, ISnapshot snapshot)
          A constructor to create the record
 
Method Summary
 void addPath(int[] path)
          This method is used only when the record is built.
static java.util.Comparator<MultiplePathsFromGCRootsRecord> getComparatorByNumberOfReferencedObjects()
          Returns a Comparator ordering the records descending by the number of referenced objects.
static java.util.Comparator<MultiplePathsFromGCRootsRecord> getComparatorByReferencedHeapSize()
          Returns a Comparator ordering the records descending by the total size of referenced objects.
static java.util.Comparator<MultiplePathsFromGCRootsRecord> getComparatorByReferencedRetainedSize()
          Returns a Comparator ordering the records descending by the total size of referenced objects.
 int getCount()
          Get the number of paths going through this object
 int getLevel()
          Get the level of this record
 int getObjectId()
          Get the id of the object which is common for all the paths
 java.util.List<int[]> getPaths()
          Get all the paths going through the object (getObjectId())
 long getReferencedHeapSize()
          Get the total net heap size of all referenced objects (see getReferencedObjects())
 int[] getReferencedObjects()
          Get the "end" objects for each path.
 long getReferencedRetainedSize()
          Get the total retained heap size of the referenced objects
 MultiplePathsFromGCRootsRecord[] nextLevel()
          Returns the next level of the paths.
 void setReferencedRetainedSize(long referencedRetainedSize)
          Set the retained heap size of the referenced objects
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiplePathsFromGCRootsRecord

public MultiplePathsFromGCRootsRecord(int objectId,
                                      int level,
                                      ISnapshot snapshot)
A constructor to create the record

Parameters:
objectId - - the ID of the object which is common for all the paths
level - - the level (depth) in the paths where this objects appears
snapshot - - an ISnapshot object used for further calculation
Method Detail

getReferencedRetainedSize

public long getReferencedRetainedSize()
Get the total retained heap size of the referenced objects


setReferencedRetainedSize

public void setReferencedRetainedSize(long referencedRetainedSize)
Set the retained heap size of the referenced objects


nextLevel

public MultiplePathsFromGCRootsRecord[] nextLevel()
Returns the next level of the paths. For all paths going through this object the next objects in the paths are taken and grouped again (i.e. the lenght of the returned array will be equal to the number of different objects at the next depth level of the paths). The direction is from the GC roots to the objects

Returns:
MultiplePathsFromGCRootsRecord[] Each record in the result represents again paths going through one and the same object

addPath

public void addPath(int[] path)
This method is used only when the record is built. Adds one path to the set of paths

Parameters:
path -

getPaths

public java.util.List<int[]> getPaths()
Get all the paths going through the object (getObjectId())

Returns:
List<int[]> each element in the list is an int[] representing a path

getObjectId

public int getObjectId()
Get the id of the object which is common for all the paths


getCount

public int getCount()
Get the number of paths going through this object


getLevel

public int getLevel()
Get the level of this record


getReferencedObjects

public int[] getReferencedObjects()
Get the "end" objects for each path. This is equal to getting all the paths and looking at their element [0]

Returns:
- an array with all the objects at the end of the paths

getReferencedHeapSize

public long getReferencedHeapSize()
                           throws SnapshotException
Get the total net heap size of all referenced objects (see getReferencedObjects())

Returns:
- the total heap size of all referenced objects
Throws:
SnapshotException

getComparatorByNumberOfReferencedObjects

public static java.util.Comparator<MultiplePathsFromGCRootsRecord> getComparatorByNumberOfReferencedObjects()
Returns a Comparator ordering the records descending by the number of referenced objects.


getComparatorByReferencedHeapSize

public static java.util.Comparator<MultiplePathsFromGCRootsRecord> getComparatorByReferencedHeapSize()
Returns a Comparator ordering the records descending by the total size of referenced objects.


getComparatorByReferencedRetainedSize

public static java.util.Comparator<MultiplePathsFromGCRootsRecord> getComparatorByReferencedRetainedSize()
Returns a Comparator ordering the records descending by the total size of referenced objects.