harpoon.Analysis
Class ClassHierarchy

java.lang.Object
  |
  +--harpoon.Analysis.ClassHierarchy
Direct Known Subclasses:
QuadClassHierarchy

public abstract class ClassHierarchy
extends Object

A ClassHierarchy enumerates reachable/usable classes and methods.

Version:
$Id: ClassHierarchy.java,v 1.3 2002/02/26 22:39:08 cananian Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>

Constructor Summary
ClassHierarchy()
           
 
Method Summary
abstract  Set callableMethods()
          Returns set of all callable methods.
abstract  Set children(HClass c)
          Returns all usable/reachable children of an HClass.
abstract  Set classes()
          Returns the set of all reachable/usable classes.
abstract  Set instantiatedClasses()
          Returns the set of all *instantiated* classes.
 Set overrides(HClass hc, HMethod hm, boolean all)
          Returns the set of methods, excluding hm, declared in classes which are instances of hc, which override hm.
 Set overrides(HMethod hm)
          Returns a set of methods in the hierarchy (not necessary reachable methods) which override the given method.
 Set parents(HClass c)
          Return the parents of an HClass.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassHierarchy

public ClassHierarchy()
Method Detail

children

public abstract Set children(HClass c)
Returns all usable/reachable children of an HClass. For an interface class c, the children include all reachable classes which implement it as well as any reachable interfaces which extend it. For a non-interface class, children are all reachable subclasses.

Returns:
Set of HClasses.

parents

public final Set parents(HClass c)
Return the parents of an HClass. The parents of a class c are its superclass and interfaces. The results should be complementary to the children() method: parent(c) of any class c returned by children(cc) should include cc.


overrides

public final Set overrides(HMethod hm)
Returns a set of methods in the hierarchy (not necessary reachable methods) which override the given method. The set is only one level deep; invoke children() again on each member of the returned set to find the rest of the possible overriding methods. Note however that interface methods may introduce some imprecision: in particular, for some hm2 in children(hm1) (where hm1 is an interface method), hm2.getDeclaringClass() may not implement hm1.getDeclaringClass(). For example, ListIterator.next() may be implemented by A, but B (a subclass of A which doesn't override A.next()) may be the class which implements ListIterator.


overrides

public Set overrides(HClass hc,
                     HMethod hm,
                     boolean all)
Returns the set of methods, excluding hm, declared in classes which are instances of hc, which override hm. If all is true, returns all such methods in the class hierarchy; otherwise returns only the methods which *immediately* override hm.


callableMethods

public abstract Set callableMethods()
Returns set of all callable methods.

Returns:
Set of HMethods.

classes

public abstract Set classes()
Returns the set of all reachable/usable classes. If any method in a class is callable (including static methods), then the class will be a member of the returned set.

Returns:
Set of HClasses.

instantiatedClasses

public abstract Set instantiatedClasses()
Returns the set of all *instantiated* classes. This is a subset of the set returned by the classes() method. A class is included in the return set only if an object of that type is at some point created.