org.aspectj.asm.internal
Class AspectJElementHierarchy

java.lang.Object
  extended by org.aspectj.asm.internal.AspectJElementHierarchy
All Implemented Interfaces:
java.io.Serializable, IHierarchy

public class AspectJElementHierarchy
extends java.lang.Object
implements IHierarchy

See Also:
Serialized Form

Field Summary
protected  java.lang.String configFile
           
protected  IProgramElement root
           
 
Fields inherited from interface org.aspectj.asm.IHierarchy
NO_STRUCTURE
 
Constructor Summary
AspectJElementHierarchy(AsmManager asm)
           
 
Method Summary
 void addToFileMap(java.lang.String key, IProgramElement value)
           
protected  void cache(java.lang.String handle, IProgramElement pe)
           
 IProgramElement findCloserMatchForLineNumber(IProgramElement node, int lineno)
          For a specified node, check if any of the children more accurately represent the specified line.
 IProgramElement findElementForHandle(java.lang.String handle)
           
 IProgramElement findElementForHandleOrCreate(java.lang.String handle, boolean create)
           
 IProgramElement findElementForLabel(IProgramElement parent, IProgramElement.Kind kind, java.lang.String label)
          Returns the first match
 IProgramElement findElementForOffSet(java.lang.String sourceFilePath, int lineNumber, int offSet)
           
 IProgramElement findElementForSignature(IProgramElement parent, IProgramElement.Kind kind, java.lang.String signature)
          Returns the first match
 IProgramElement findElementForSourceFile(java.lang.String sourceFile)
           
 IProgramElement findElementForSourceLine(ISourceLocation location)
          TODO: discriminate columns
 IProgramElement findElementForSourceLine(java.lang.String sourceFilePath, int lineNumber)
          Never returns null
 IProgramElement findElementForType(java.lang.String packageName, java.lang.String typeName)
          Find the entry in the model that represents a particular type.
 java.lang.Object findInFileMap(java.lang.Object key)
           
 java.util.List<IProgramElement> findMatchingPackages(java.lang.String packagename)
          Look for any package nodes matching the specified package name.
 IProgramElement findNodeForSourceFile(IProgramElement node, java.lang.String sourcefilePath)
          Discover the node representing a particular source file.
 void flushFileMap()
           
 void flushHandleMap()
           
 void flushTypeMap()
           
 void forget(IProgramElement compilationUnitNode, IProgramElement typeNode)
           
 java.lang.String getConfigFile()
           
 IProgramElement getElement(java.lang.String handle)
           
 java.util.Set<java.util.Map.Entry<java.lang.String,IProgramElement>> getFileMapEntrySet()
           
 IProgramElement getRoot()
           
 boolean isValid()
           
 boolean removeFromFileMap(java.lang.String canonicalFilePath)
           
 void setAsmManager(AsmManager asm)
           
 void setConfigFile(java.lang.String configFile)
           
 void setFileMap(java.util.HashMap<java.lang.String,IProgramElement> fileMap)
           
 void setRoot(IProgramElement root)
           
 java.lang.String toSummaryString()
           
 void updateHandleMap(java.util.Set<java.lang.String> deletedFiles)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

root

protected IProgramElement root

configFile

protected java.lang.String configFile
Constructor Detail

AspectJElementHierarchy

public AspectJElementHierarchy(AsmManager asm)
Method Detail

getElement

public IProgramElement getElement(java.lang.String handle)
Specified by:
getElement in interface IHierarchy

setAsmManager

public void setAsmManager(AsmManager asm)

getRoot

public IProgramElement getRoot()
Specified by:
getRoot in interface IHierarchy

toSummaryString

public java.lang.String toSummaryString()

setRoot

public void setRoot(IProgramElement root)
Specified by:
setRoot in interface IHierarchy

addToFileMap

public void addToFileMap(java.lang.String key,
                         IProgramElement value)
Specified by:
addToFileMap in interface IHierarchy

removeFromFileMap

public boolean removeFromFileMap(java.lang.String canonicalFilePath)
Specified by:
removeFromFileMap in interface IHierarchy

setFileMap

public void setFileMap(java.util.HashMap<java.lang.String,IProgramElement> fileMap)
Specified by:
setFileMap in interface IHierarchy

findInFileMap

public java.lang.Object findInFileMap(java.lang.Object key)
Specified by:
findInFileMap in interface IHierarchy

getFileMapEntrySet

public java.util.Set<java.util.Map.Entry<java.lang.String,IProgramElement>> getFileMapEntrySet()
Specified by:
getFileMapEntrySet in interface IHierarchy

isValid

public boolean isValid()
Specified by:
isValid in interface IHierarchy

findElementForSignature

public IProgramElement findElementForSignature(IProgramElement parent,
                                               IProgramElement.Kind kind,
                                               java.lang.String signature)
Returns the first match

Specified by:
findElementForSignature in interface IHierarchy
Parameters:
parent -
kind - not null
Returns:
null if not found

findElementForLabel

public IProgramElement findElementForLabel(IProgramElement parent,
                                           IProgramElement.Kind kind,
                                           java.lang.String label)
Description copied from interface: IHierarchy
Returns the first match

Specified by:
findElementForLabel in interface IHierarchy
kind - not null
Returns:
null if not found

findElementForType

public IProgramElement findElementForType(java.lang.String packageName,
                                          java.lang.String typeName)
Find the entry in the model that represents a particular type.

Specified by:
findElementForType in interface IHierarchy
Parameters:
packageName - the package in which the type is declared or null for the default package
typeName - the name of the type
Returns:
the IProgramElement representing the type, or null if not found

findMatchingPackages

public java.util.List<IProgramElement> findMatchingPackages(java.lang.String packagename)
Look for any package nodes matching the specified package name. There may be multiple in the case where the types within a package are split across source folders.

Parameters:
packagename - the packagename being searched for
Returns:
a list of package nodes that match that name

findElementForSourceFile

public IProgramElement findElementForSourceFile(java.lang.String sourceFile)
Specified by:
findElementForSourceFile in interface IHierarchy
Parameters:
sourceFilePath - modified to '/' delimited path for consistency
Returns:
a new structure node for the file if it was not found in the model

findElementForSourceLine

public IProgramElement findElementForSourceLine(ISourceLocation location)
TODO: discriminate columns

Specified by:
findElementForSourceLine in interface IHierarchy

findElementForSourceLine

public IProgramElement findElementForSourceLine(java.lang.String sourceFilePath,
                                                int lineNumber)
Never returns null

Specified by:
findElementForSourceLine in interface IHierarchy
Parameters:
sourceFilePath - canonicalized path for consistency
lineNumber - if 0 or 1 the corresponding file node will be returned
Returns:
a new structure node for the file if it was not found in the model

findNodeForSourceFile

public IProgramElement findNodeForSourceFile(IProgramElement node,
                                             java.lang.String sourcefilePath)
Discover the node representing a particular source file.

Specified by:
findNodeForSourceFile in interface IHierarchy
Parameters:
node - where in the model to start looking (usually the root on the initial call)
sourcefilePath - the source file being searched for
Returns:
the node representing that source file or null if it cannot be found

findElementForOffSet

public IProgramElement findElementForOffSet(java.lang.String sourceFilePath,
                                            int lineNumber,
                                            int offSet)
Specified by:
findElementForOffSet in interface IHierarchy

findCloserMatchForLineNumber

public IProgramElement findCloserMatchForLineNumber(IProgramElement node,
                                                    int lineno)
For a specified node, check if any of the children more accurately represent the specified line.

Specified by:
findCloserMatchForLineNumber in interface IHierarchy
Parameters:
node - where to start looking
lineno - the line number
Returns:
any closer match below 'node' or null if nothing is a more accurate match

getConfigFile

public java.lang.String getConfigFile()
Specified by:
getConfigFile in interface IHierarchy

setConfigFile

public void setConfigFile(java.lang.String configFile)
Specified by:
setConfigFile in interface IHierarchy

findElementForHandle

public IProgramElement findElementForHandle(java.lang.String handle)
Specified by:
findElementForHandle in interface IHierarchy

findElementForHandleOrCreate

public IProgramElement findElementForHandleOrCreate(java.lang.String handle,
                                                    boolean create)
Specified by:
findElementForHandleOrCreate in interface IHierarchy

cache

protected void cache(java.lang.String handle,
                     IProgramElement pe)

flushTypeMap

public void flushTypeMap()
Specified by:
flushTypeMap in interface IHierarchy

flushHandleMap

public void flushHandleMap()
Specified by:
flushHandleMap in interface IHierarchy

flushFileMap

public void flushFileMap()

forget

public void forget(IProgramElement compilationUnitNode,
                   IProgramElement typeNode)

updateHandleMap

public void updateHandleMap(java.util.Set<java.lang.String> deletedFiles)
Specified by:
updateHandleMap in interface IHierarchy