Class ClassHierarchy
java.lang.Object
EDU.purdue.cs.bloat.editor.ClassHierarchy
ClassHierarchy maintains a graph of the subclass relationships of the classes
loaded by the ClassInfoLoader.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassRepresents a method and a set of Types. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionClassHierarchy(EditorContext context, Collection initial, boolean closure) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddClassNamed(String name) Adds a class of a given name to the ClassHierarchy.classes()Returns (the Types of) all of the classes and interfaces in the hierarchy.booleanclosure()Returns true if class closure has been computedimplementors(Type type) Returns the classes (Types) that implement a given interface as a Collection of Types.interfaces(Type type) Returns the interfaces that a given Type implements as a Collection of TypesintersectType(Type a, Type b) Returns the intersection of two types.methodInvoked(Type receiver, NameAndType method) Returns the MemberRef of the method that would be invoked if a given method of a given type was invoked.booleanmethodIsOverridden(Type classType, NameAndType nat) Determines whether or not a class's method is overriden by any of its subclasses.voidprintClasses(PrintWriter out, int indent) Prints the class hierarchy (i.e.voidprintImplements(PrintWriter out, int indent) Prints the implements hierarchy to a PrintWriter.resolvesToWith(MemberRef method) Returns a set of ResolvesToWith that represent all subclass methods that override a given method and the subclasses that when used as receivers resolve to that method.static TypeGiven a set of bits representing the range of values some type has, determines what that Type is.subclasses(Type type) Returns the immediate subclasses of a given Type as a Collection of Types.booleansubclassOf(Type a, Type b) Returns whether or not a is a subclass of b.superclass(Type type) Returns the superclass of a given Type.static BitSetReturns a BitSet representing the possible values of a given integral type.Returns the union of two types.unionTypes(Collection types) Returns the most refined common supertype for a bunch of Types.
-
Field Details
-
POS_SHORT
-
POS_BYTE
-
DEBUG
public static boolean DEBUG -
RELAX
public static boolean RELAX
-
-
Constructor Details
-
ClassHierarchy
Constructor.- Parameters:
context- The context in which to access an Editor and other such things.initial- The names of the classes that initially constitue the hierarchy.closure- Do we get the maximum amount of class information?
-
-
Method Details
-
addClassNamed
Adds a class of a given name to the ClassHierarchy. -
subclasses
Returns the immediate subclasses of a given Type as a Collection of Types.The subclass relationship at the classfile level is a little screwy with respect to interfaces. An interface that extends another interface is compiled into an interface that extends java.lang.Object and implements the superinterface. As a result, the interface-subinterface is not captured in subclasses as one may expect. Instead, you have to look at implementors and filter out the classes.
-
superclass
-
interfaces
Returns the interfaces that a given Type implements as a Collection of Types -
implementors
Returns the classes (Types) that implement a given interface as a Collection of Types.See note in subclasses for information about the interface hierarchy.
-
subclassOf
-
classes
Returns (the Types of) all of the classes and interfaces in the hierarchy. -
closure
public boolean closure()Returns true if class closure has been computed -
intersectType
-
unionTypes
Returns the most refined common supertype for a bunch of Types. -
unionType
-
printClasses
Prints the class hierarchy (i.e. the "extends" hierarchy, interfaces may extends other interfaces) to a PrintWriter. -
printImplements
Prints the implements hierarchy to a PrintWriter. -
methodIsOverridden
Determines whether or not a class's method is overriden by any of its subclasses. -
methodInvoked
Returns the MemberRef of the method that would be invoked if a given method of a given type was invoked. Basically, dynamic dispatch is simulated. -
setToType
-
typeToSet
-
resolvesToWith
-