|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.aspectj.org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy
public class TypeHierarchy
ITypeHierarchy| Field Summary | |
|---|---|
protected ChangeCollector |
changeCollector
|
protected java.util.ArrayList |
changeListeners
Change listeners - null if no one is listening. |
protected java.util.Map |
classToSuperclass
|
protected boolean |
computeSubtypes
Whether this hierarchy should contains subtypes. |
static boolean |
DEBUG
|
java.util.Map |
files
|
protected IType |
focusType
The type the hierarchy was specifically computed for, possibly null. |
protected java.util.ArrayList |
interfaces
|
java.util.ArrayList |
missingTypes
|
boolean |
needsRefresh
|
protected static IType[] |
NO_TYPE
|
protected Region |
packageRegion
A region describing the packages considered by this hierarchy. |
protected IProgressMonitor |
progressMonitor
The progress monitor to report work completed too. |
protected IJavaProject |
project
The Java Project in which the hierarchy is being built - this provides the context for determining a classpath and namelookup rules. |
protected Region |
projectRegion
A region describing the projects considered by this hierarchy. |
protected TypeVector |
rootClasses
|
protected java.util.Map |
typeFlags
|
protected java.util.Map |
typeToSubtypes
|
protected java.util.Map |
typeToSuperInterfaces
|
protected ICompilationUnit[] |
workingCopies
|
| Constructor Summary | |
|---|---|
TypeHierarchy()
Creates an empty TypeHierarchy |
|
TypeHierarchy(IType type,
ICompilationUnit[] workingCopies,
IJavaProject project,
boolean computeSubtypes)
Creates a TypeHierarchy on the given type. |
|
TypeHierarchy(IType type,
ICompilationUnit[] workingCopies,
IJavaSearchScope scope,
boolean computeSubtypes)
Creates a TypeHierarchy on the given type. |
|
| Method Summary | |
|---|---|
protected void |
addInterface(IType type)
Adds the type to the collection of interfaces. |
protected void |
addRootClass(IType type)
Adds the type to the collection of root classes if the classes is not already present in the collection. |
protected void |
addSubtype(IType type,
IType subtype)
Adds the given subtype to the type. |
void |
addTypeHierarchyChangedListener(ITypeHierarchyChangedListener listener)
Adds the given listener for changes to this type hierarchy. |
void |
cacheFlags(IType type,
int flags)
cacheFlags. |
protected void |
cacheSuperclass(IType type,
IType superclass)
Caches the handle of the superclass for the specified type. |
protected void |
cacheSuperInterfaces(IType type,
IType[] superinterfaces)
Caches all of the superinterfaces that are specified for the type. |
protected void |
checkCanceled()
Checks with the progress monitor to see whether the creation of the type hierarchy should be canceled. |
protected void |
compute()
Compute this type hierarchy. |
boolean |
contains(IType type)
Returns whether the given type is part of this hierarchy. |
void |
elementChanged(ElementChangedEvent event)
Determines if the change affects this hierarchy, and fires change notification if required. |
boolean |
exists()
Returns whether the type and project this hierarchy was created on exist. |
void |
fireChange()
Notifies listeners that this hierarchy has changed and needs refreshing. |
IType[] |
getAllClasses()
Returns all classes in this type hierarchy's graph, in no particular order. |
IType[] |
getAllInterfaces()
Returns all interfaces in this type hierarchy's graph, in no particular order. |
IType[] |
getAllSubtypes(IType type)
Returns all resolved subtypes (direct and indirect) of the given type, in no particular order, limited to the types in this type hierarchy's graph. |
IType[] |
getAllSuperclasses(IType type)
Returns all resolved superclasses of the given class, in bottom-up order. |
IType[] |
getAllSuperInterfaces(IType type)
Returns all resolved superinterfaces (direct and indirect) of the given type. |
IType[] |
getAllSupertypes(IType type)
Returns all resolved supertypes of the given type, in bottom-up order. |
IType[] |
getAllTypes()
Returns all types in this type hierarchy's graph, in no particular order. |
int |
getCachedFlags(IType type)
Return the flags associated with the given type (would be equivalent to IMember.getFlags()),
or -1 if this information wasn't cached on the hierarchy during its computation. |
IType[] |
getExtendingInterfaces(IType type)
Returns all interfaces resolved to extend the given interface, in no particular order, limited to the interfaces in this hierarchy's graph. |
IType[] |
getImplementingClasses(IType type)
Returns all classes resolved to implement the given interface, in no particular order, limited to the classes in this type hierarchy's graph. |
IType[] |
getRootClasses()
Returns all classes in the graph which have no resolved superclass, in no particular order. |
IType[] |
getRootInterfaces()
Returns all interfaces in the graph which have no resolved superinterfaces, in no particular order. |
IType[] |
getSubclasses(IType type)
Returns the direct resolved subclasses of the given class, in no particular order, limited to the classes in this type hierarchy's graph. |
IType[] |
getSubtypes(IType type)
Returns the direct resolved subtypes of the given type, in no particular order, limited to the types in this type hierarchy's graph. |
IType |
getSuperclass(IType type)
Returns the resolved superclass of the given class, or null if the given class has no superclass,
the superclass could not be resolved, or if the given
type is an interface. |
IType[] |
getSuperInterfaces(IType type)
Returns the direct resolved interfaces that the given type implements or extends, in no particular order, limited to the interfaces in this type hierarchy's graph. |
IType[] |
getSupertypes(IType type)
Returns the resolved supertypes of the given type, in no particular order, limited to the types in this type hierarchy's graph. |
IType |
getType()
Returns the type this hierarchy was computed for. |
protected IType[] |
growAndAddToArray(IType[] array,
IType addition)
Adds the new element to a new array that contains all of the elements of the old array. |
protected IType[] |
growAndAddToArray(IType[] array,
IType[] additions)
Adds the new elements to a new array that contains all of the elements of the old array. |
boolean |
hasFineGrainChanges()
|
protected void |
initialize(int size)
Initializes this hierarchy's internal tables with the given size. |
protected void |
initializeRegions()
Initializes the file, package and project regions |
boolean |
isAffected(IJavaElementDelta delta,
int eventType)
Returns true if the given delta could change this type hierarchy |
protected boolean |
isAffectedByOpenable(IJavaElementDelta delta,
IJavaElement element,
int eventType)
Returns true if the given type delta (a compilation unit delta or a class file delta) could affect this type hierarchy. |
IJavaProject |
javaProject()
Returns the java project this hierarchy was created in. |
static ITypeHierarchy |
load(IType type,
java.io.InputStream input,
WorkingCopyOwner owner)
|
protected boolean |
packageRegionContainsSamePackageFragment(PackageFragment element)
Returns true if an equivalent package fragment is included in the package
region. |
protected static byte[] |
readUntil(java.io.InputStream input,
byte separator)
|
protected static byte[] |
readUntil(java.io.InputStream input,
byte separator,
int offset)
|
void |
refresh(IProgressMonitor monitor)
Re-computes the type hierarchy reporting progress. |
void |
removeTypeHierarchyChangedListener(ITypeHierarchyChangedListener listener)
Removes the given listener from this type hierarchy. |
void |
store(java.io.OutputStream output,
IProgressMonitor monitor)
Stores the type hierarchy in an output stream. |
java.lang.String |
toString()
|
protected void |
worked(int work)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static boolean DEBUG
protected IJavaProject project
protected IType focusType
protected ICompilationUnit[] workingCopies
protected java.util.Map classToSuperclass
protected java.util.Map typeToSuperInterfaces
protected java.util.Map typeToSubtypes
protected java.util.Map typeFlags
protected TypeVector rootClasses
protected java.util.ArrayList interfaces
public java.util.ArrayList missingTypes
protected static final IType[] NO_TYPE
protected IProgressMonitor progressMonitor
protected java.util.ArrayList changeListeners
public java.util.Map files
protected Region packageRegion
protected Region projectRegion
protected boolean computeSubtypes
public boolean needsRefresh
protected ChangeCollector changeCollector
| Constructor Detail |
|---|
public TypeHierarchy()
public TypeHierarchy(IType type,
ICompilationUnit[] workingCopies,
IJavaProject project,
boolean computeSubtypes)
public TypeHierarchy(IType type,
ICompilationUnit[] workingCopies,
IJavaSearchScope scope,
boolean computeSubtypes)
| Method Detail |
|---|
protected void initializeRegions()
protected void addInterface(IType type)
protected void addRootClass(IType type)
protected void addSubtype(IType type,
IType subtype)
public void addTypeHierarchyChangedListener(ITypeHierarchyChangedListener listener)
ITypeHierarchy
addTypeHierarchyChangedListener in interface ITypeHierarchylistener - the listenerITypeHierarchy
public void cacheFlags(IType type,
int flags)
protected void cacheSuperclass(IType type,
IType superclass)
protected void cacheSuperInterfaces(IType type,
IType[] superinterfaces)
protected void checkCanceled()
OperationCanceledException - if cancelling the operation has been requestedIProgressMonitor#isCanceled
protected void compute()
throws JavaModelException,
CoreException
JavaModelException
CoreExceptionpublic boolean contains(IType type)
ITypeHierarchy
contains in interface ITypeHierarchytype - the given type
ITypeHierarchypublic void elementChanged(ElementChangedEvent event)
elementChanged in interface IElementChangedListenerevent - the change eventpublic boolean exists()
ITypeHierarchy
exists in interface ITypeHierarchyITypeHierarchypublic void fireChange()
public IType[] getAllClasses()
ITypeHierarchy
getAllClasses in interface ITypeHierarchyITypeHierarchypublic IType[] getAllInterfaces()
ITypeHierarchy
getAllInterfaces in interface ITypeHierarchyITypeHierarchypublic IType[] getAllSubtypes(IType type)
ITypeHierarchy
getAllSubtypes in interface ITypeHierarchytype - the given type
ITypeHierarchypublic IType[] getAllSuperclasses(IType type)
ITypeHierarchyNOTE: once a type hierarchy has been created, it is more efficient to query the hierarchy for superclasses than to query a class recursively up the superclass chain. Querying an element performs a dynamic resolution, whereas the hierarchy returns a pre-computed result.
getAllSuperclasses in interface ITypeHierarchytype - the given type
ITypeHierarchypublic IType[] getAllSuperInterfaces(IType type)
ITypeHierarchyNOTE: once a type hierarchy has been created, it is more efficient to query the hierarchy for superinterfaces than to query a type recursively. Querying an element performs a dynamic resolution, whereas the hierarchy returns a pre-computed result.
getAllSuperInterfaces in interface ITypeHierarchytype - the given type
ITypeHierarchypublic IType[] getAllSupertypes(IType type)
ITypeHierarchy
Note that java.lang.Object is NOT considered to be a supertype
of any interface type.
NOTE: once a type hierarchy has been created, it is more efficient to query the hierarchy for supertypes than to query a type recursively up the supertype chain. Querying an element performs a dynamic resolution, whereas the hierarchy returns a pre-computed result.
getAllSupertypes in interface ITypeHierarchytype - the given type
ITypeHierarchypublic IType[] getAllTypes()
ITypeHierarchy
getAllTypes in interface ITypeHierarchyITypeHierarchypublic int getCachedFlags(IType type)
ITypeHierarchyIMember.getFlags()),
or -1 if this information wasn't cached on the hierarchy during its computation.
getCachedFlags in interface ITypeHierarchytype - the given type
ITypeHierarchy.getCachedFlags(IType)public IType[] getExtendingInterfaces(IType type)
ITypeHierarchy
getExtendingInterfaces in interface ITypeHierarchytype - the given type
ITypeHierarchypublic IType[] getImplementingClasses(IType type)
ITypeHierarchy
getImplementingClasses in interface ITypeHierarchytype - the given type
ITypeHierarchypublic IType[] getRootClasses()
ITypeHierarchy
getRootClasses in interface ITypeHierarchyITypeHierarchypublic IType[] getRootInterfaces()
ITypeHierarchy
getRootInterfaces in interface ITypeHierarchyITypeHierarchypublic IType[] getSubclasses(IType type)
ITypeHierarchy
getSubclasses in interface ITypeHierarchytype - the given type
ITypeHierarchypublic IType[] getSubtypes(IType type)
ITypeHierarchy
getSubtypes in interface ITypeHierarchytype - the given type
ITypeHierarchypublic IType getSuperclass(IType type)
ITypeHierarchynull if the given class has no superclass,
the superclass could not be resolved, or if the given
type is an interface.
getSuperclass in interface ITypeHierarchytype - the given type
null if the given class has no superclass,
the superclass could not be resolved, or if the given
type is an interfaceITypeHierarchypublic IType[] getSuperInterfaces(IType type)
ITypeHierarchy
getSuperInterfaces in interface ITypeHierarchytype - the given type
ITypeHierarchypublic IType[] getSupertypes(IType type)
ITypeHierarchyjava.lang.Object is NOT considered to be a supertype of any interface
type.
getSupertypes in interface ITypeHierarchytype - the given type
ITypeHierarchypublic IType getType()
ITypeHierarchynull if this hierarchy was computed for a region.
getType in interface ITypeHierarchyITypeHierarchy
protected IType[] growAndAddToArray(IType[] array,
IType[] additions)
protected IType[] growAndAddToArray(IType[] array,
IType addition)
public boolean hasFineGrainChanges()
protected void initialize(int size)
public boolean isAffected(IJavaElementDelta delta,
int eventType)
eventType - TODO
protected boolean isAffectedByOpenable(IJavaElementDelta delta,
IJavaElement element,
int eventType)
eventType - TODOpublic IJavaProject javaProject()
protected static byte[] readUntil(java.io.InputStream input,
byte separator)
throws JavaModelException,
java.io.IOException
JavaModelException
java.io.IOException
protected static byte[] readUntil(java.io.InputStream input,
byte separator,
int offset)
throws java.io.IOException,
JavaModelException
java.io.IOException
JavaModelException
public static ITypeHierarchy load(IType type,
java.io.InputStream input,
WorkingCopyOwner owner)
throws JavaModelException
JavaModelExceptionprotected boolean packageRegionContainsSamePackageFragment(PackageFragment element)
true if an equivalent package fragment is included in the package
region. Package fragments are equivalent if they both have the same name.
public void refresh(IProgressMonitor monitor)
throws JavaModelException
ITypeHierarchy
refresh in interface ITypeHierarchymonitor - the given progress monitor
JavaModelException - if unable to refresh the hierarchyTODO (jerome) should use a PerThreadObject to build the hierarchy instead of synchronizing
(see also isAffected(IJavaElementDelta))public void removeTypeHierarchyChangedListener(ITypeHierarchyChangedListener listener)
ITypeHierarchy
removeTypeHierarchyChangedListener in interface ITypeHierarchylistener - the listenerITypeHierarchy
public void store(java.io.OutputStream output,
IProgressMonitor monitor)
throws JavaModelException
ITypeHierarchy
store in interface ITypeHierarchyoutput - output stream where the hierarchy will be storedmonitor - the given progress monitor
JavaModelException - if unable to store the hierarchy in the ouput streamITypeHierarchypublic java.lang.String toString()
toString in class java.lang.ObjectITypeHierarchyprotected void worked(int work)
IProgressMonitor
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||