harpoon.Backend.Maps
Class DefaultClassDepthMap

java.lang.Object
  extended by harpoon.Backend.Maps.ClassDepthMap
      extended by harpoon.Backend.Maps.DefaultClassDepthMap

public class DefaultClassDepthMap
extends ClassDepthMap

A DefaultClassDepthMap computes class depth simply and efficiently. It uses a ClassHierarchy object to enable it to implement the maxDepth() method. It also caches the depths it computes to avoid having to traverse the entire class inheritance tree repeatedly.

Version:
$Id: DefaultClassDepthMap.java,v 1.2 2002/02/25 21:01:55 cananian Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>

Constructor Summary
DefaultClassDepthMap(ClassHierarchy ch)
          Creates a DefaultClassDepthMap using the given ClassHierarchy to compute the maximum class depth.
 
Method Summary
 int classDepth(HClass hc)
          Return the nesting depth of the given class.
 int maxDepth()
          Returns the maximum nesting depth of any class (dependent on a given context).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultClassDepthMap

public DefaultClassDepthMap(ClassHierarchy ch)
Creates a DefaultClassDepthMap using the given ClassHierarchy to compute the maximum class depth.

Method Detail

classDepth

public int classDepth(HClass hc)
Description copied from class: ClassDepthMap
Return the nesting depth of the given class. Not valid for interface classes.

Specified by:
classDepth in class ClassDepthMap

maxDepth

public int maxDepth()
Description copied from class: ClassDepthMap
Returns the maximum nesting depth of any class (dependent on a given context).

Specified by:
maxDepth in class ClassDepthMap