public class PDOM extends PlatformObject implements IPDOM
| Modifier and Type | Class and Description |
|---|---|
static class |
PDOM.ChangeEvent |
static interface |
PDOM.IListener |
| Modifier and Type | Field and Description |
|---|---|
protected Database |
db |
static int |
END |
protected PDOM.ChangeEvent |
fEvent |
static int |
FILE_INDEX |
static java.lang.String |
FRAGMENT_PROPERTY_VALUE_FORMAT_ID
Identifier for PDOM format
|
static int |
INDEX_OF_DEFECTIVE_FILES |
static int |
INDEX_OF_FILES_WITH_UNRESOLVED_INCLUDES |
static int |
LINKAGES |
static int |
PROPERTIES |
static int |
TAG_INDEX |
FIND_ALL_OCCURRENCES, FIND_DECLARATIONS, FIND_DECLARATIONS_DEFINITIONS, FIND_DEFINITIONS, FIND_NON_LOCAL_ONLY, FIND_REFERENCES, PROPERTY_FRAGMENT_FORMAT_ID, PROPERTY_FRAGMENT_FORMAT_VERSION, PROPERTY_FRAGMENT_ID, PROPERTY_RESUME_INDEXER, SEARCH_ACROSS_LANGUAGE_BOUNDARIES| Constructor and Description |
|---|
PDOM(java.io.File dbPath,
IIndexLocationConverter locationConverter,
ChunkCache cache,
java.util.Map<java.lang.String,IPDOMLinkageFactory> linkageFactoryMappings) |
PDOM(java.io.File dbPath,
IIndexLocationConverter locationConverter,
java.util.Map<java.lang.String,IPDOMLinkageFactory> linkageFactoryMappings) |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(IPDOMVisitor visitor) |
void |
acquireReadLock()
Acquires a read lock.
|
void |
acquireWriteLock(int giveupReadLocks,
IProgressMonitor monitor)
Acquire a write lock on this PDOM, giving up the specified number of read locks first.
|
void |
acquireWriteLock(IProgressMonitor monitor)
Acquire a write lock on this PDOM.
|
IIndexFragmentBinding |
adaptBinding(IBinding binding)
Looks for a binding matching the given one.
|
protected PDOMLinkage |
adaptLinkage(ILinkage linkage) |
protected IIndexFragmentFile |
addFile(int linkageID,
IIndexFileLocation location,
ISignificantMacros sigMacros) |
void |
addListener(PDOM.IListener listener) |
void |
adjustThreadForReadLock(java.util.Map<java.lang.Thread,org.eclipse.cdt.internal.core.pdom.PDOM.DebugLockInfo> lockDebugging) |
protected void |
clear() |
protected void |
clearFileIndex() |
void |
clearResultCache()
Clears the result cache.
|
void |
close() |
IIndexFragmentFileSet |
createFileSet()
Creates an empty file set for this fragment
|
java.lang.String |
createKeyForCache(long record,
char[] name) |
protected PDOMLinkage |
createLinkage(int linkageID) |
IIndexFragmentBinding |
findBinding(IASTName name)
Looks for a binding of the given name from the AST.
|
IIndexFragmentBinding |
findBinding(IIndexFragmentName indexName) |
IIndexFragmentBinding[] |
findBindings(char[][] names,
boolean caseSensitive,
IndexFilter filter,
IProgressMonitor monitor) |
IIndexFragmentBinding[] |
findBindings(char[][] names,
IndexFilter filter,
IProgressMonitor monitor)
Searches for all bindings with qualified names that seen as an array of simple names equals
the given array of names.
|
IIndexFragmentBinding[] |
findBindings(char[] name,
boolean filescope,
boolean isCaseSensitive,
IndexFilter filter,
IProgressMonitor monitor) |
IIndexFragmentBinding[] |
findBindings(char[] name,
boolean filescope,
IndexFilter filter,
IProgressMonitor monitor)
Returns all bindings with the given name, accepted by the given filter
|
IIndexFragmentBinding[] |
findBindings(java.util.regex.Pattern[] patterns,
boolean isFullyQualified,
IndexFilter filter,
IProgressMonitor monitor)
Searches for all bindings with qualified names that seen as an array of simple names match
the given array of patterns.
|
IIndexBinding[] |
findBindings(java.util.regex.Pattern pattern,
boolean isFullyQualified,
IndexFilter filter,
IProgressMonitor monitor) |
IIndexFragmentBinding[] |
findBindingsForContentAssist(char[] prefix,
boolean filescope,
IndexFilter filter,
IProgressMonitor monitor)
Returns all bindings that would be a valid completion for the given text.
|
IIndexFragmentBinding[] |
findBindingsForPrefix(char[] prefix,
boolean filescope,
boolean caseSensitive,
IndexFilter filter,
IProgressMonitor monitor) |
IIndexFragmentBinding[] |
findBindingsForPrefix(char[] prefix,
boolean filescope,
IndexFilter filter,
IProgressMonitor monitor)
Returns all bindings with the given prefix, accepted by the given filter
|
IIndexFragmentInclude[] |
findIncludedBy(IIndexFragmentFile file)
Returns all include directives that point to the given file.
|
IIndexFragmentBinding[] |
findMacroContainers(char[] prefix,
boolean isPrefix,
boolean isCaseSensitive,
IndexFilter filter,
IProgressMonitor monitor) |
IIndexFragmentBinding[] |
findMacroContainers(java.util.regex.Pattern pattern,
IndexFilter filter,
IProgressMonitor monitor)
Searches for all macro containers (one for macros with the same name) with names that
match the given pattern.
|
IIndexMacro[] |
findMacros(char[] prefix,
boolean isPrefix,
boolean isCaseSensitive,
IndexFilter filter,
IProgressMonitor monitor)
Returns all macros with the given prefix or name, accepted by the given filter
|
IIndexFragmentName[] |
findNames(IBinding binding,
int options)
Searches for all names that resolve to the given binding.
|
protected void |
flush() |
IIndexFragmentFile[] |
getAllFiles() |
java.lang.Object |
getCachedResult(java.lang.Object key)
Returns a previously cached object, the cache is cleared at latest when the fragment no
longer holds a locks.
|
long |
getCacheHits()
Returns cache hits since last reset of counters.
|
long |
getCacheMisses()
Returns cache misses since last reset of counters.
|
Database |
getDB() |
IRecordIterator |
getDeclarationsDefintitionsRecordIterator(IIndexBinding binding) |
static int |
getDefaultVersion()
Returns the version that shall be used when creating new databases.
|
IIndexFragmentFile[] |
getDefectiveFiles() |
PDOMFile |
getFile(int linkageID,
IIndexFileLocation location)
Deprecated.
|
PDOMFile |
getFile(int linkageID,
IIndexFileLocation location,
ISignificantMacros macroDictionary)
Returns the file for the given location, linkage, and a set of macro definitions.
|
PDOMFile |
getFile(PDOMLinkage linkage,
IIndexFileLocation location,
ISignificantMacros macroDictionary) |
BTree |
getFileIndex() |
IIndexFragmentFile[] |
getFiles(IIndexFileLocation location)
Returns the files in all linkages for the given location.
|
IIndexFragmentFile[] |
getFiles(int linkageID,
IIndexFileLocation location)
Returns the files for the given location and linkage.
|
IIndexFragmentFile[] |
getFilesWithUnresolvedIncludes() |
BTree |
getIndexOfDefectiveFiles()
Returns the index of files that were read with I/O errors.
|
BTree |
getIndexOfFilesWithUnresolvedIncludes()
Returns the index of files containing unresolved includes.
|
IIndexScope[] |
getInlineNamespaces()
Returns the global inline namespaces.
|
long |
getLastReadAccess() |
long |
getLastWriteAccess()
Returns the timestamp of the last modification to the index.
|
PDOMLinkage |
getLinkage(int linkageID) |
PDOMLinkage[] |
getLinkageImpls() |
IIndexLinkage[] |
getLinkages()
Returns the linkages that are contained in this fragment
|
IIndexLocationConverter |
getLocationConverter() |
static int |
getMaxSupportedVersion() |
static int |
getMinSupportedVersion() |
java.io.File |
getPath() |
java.lang.String |
getProperty(java.lang.String propertyName)
Read the named property in this fragment.
|
PDOMTagIndex |
getTagIndex() |
boolean |
hasLastingDefinition(PDOMBinding binding) |
boolean |
hasWaitingReaders() |
void |
insertLinkage(PDOMLinkage linkage) |
protected boolean |
isCommitted(PDOMMacro name) |
protected boolean |
isCommitted(PDOMMacroReferenceName name) |
protected boolean |
isCommitted(PDOMName name) |
boolean |
isEmpty() |
boolean |
isFullyInitialized()
Returns
true if the index fragment is fully initialized. |
protected boolean |
isPermanentlyReadOnly()
Returns whether this PDOM can never be written to.
|
boolean |
isSupportedVersion() |
static boolean |
isSupportedVersion(int vers) |
void |
putCachedResult(java.lang.Object key,
java.lang.Object result) |
java.lang.Object |
putCachedResult(java.lang.Object key,
java.lang.Object result,
boolean replace)
Caches an object with the key, the cache must be cleared at latest when the fragment no
longer holds a locks.
|
void |
releaseReadLock()
Releases a read lock.
|
void |
releaseWriteLock() |
void |
releaseWriteLock(int establishReadLocks,
boolean flush) |
void |
removeCachedResult(java.lang.Object key) |
void |
removeListener(PDOM.IListener listener) |
void |
resetCacheCounters()
Resets the counters for cache-hits and cache-misses.
|
static java.lang.String |
versionString(int version) |
public static final java.lang.String FRAGMENT_PROPERTY_VALUE_FORMAT_ID
public static final int LINKAGES
public static final int FILE_INDEX
public static final int INDEX_OF_DEFECTIVE_FILES
public static final int INDEX_OF_FILES_WITH_UNRESOLVED_INCLUDES
public static final int PROPERTIES
public static final int TAG_INDEX
public static final int END
protected Database db
protected PDOM.ChangeEvent fEvent
public PDOM(java.io.File dbPath,
IIndexLocationConverter locationConverter,
java.util.Map<java.lang.String,IPDOMLinkageFactory> linkageFactoryMappings)
throws CoreException
CoreExceptionpublic PDOM(java.io.File dbPath,
IIndexLocationConverter locationConverter,
ChunkCache cache,
java.util.Map<java.lang.String,IPDOMLinkageFactory> linkageFactoryMappings)
throws CoreException
CoreExceptionpublic static int getDefaultVersion()
public static boolean isSupportedVersion(int vers)
public static int getMinSupportedVersion()
public static int getMaxSupportedVersion()
public static java.lang.String versionString(int version)
protected boolean isPermanentlyReadOnly()
public IIndexLocationConverter getLocationConverter()
public boolean isSupportedVersion()
throws CoreException
CoreExceptionprotected PDOMLinkage createLinkage(int linkageID) throws CoreException
CoreExceptionpublic PDOMLinkage getLinkage(int linkageID) throws CoreException
CoreExceptionpublic void accept(IPDOMVisitor visitor) throws CoreException
CoreExceptionpublic void addListener(PDOM.IListener listener)
addListener in interface IPDOMpublic void removeListener(PDOM.IListener listener)
removeListener in interface IPDOMpublic Database getDB()
public BTree getFileIndex() throws CoreException
CoreExceptionpublic PDOMTagIndex getTagIndex() throws CoreException
CoreExceptionpublic BTree getIndexOfDefectiveFiles() throws CoreException
CoreExceptionpublic BTree getIndexOfFilesWithUnresolvedIncludes() throws CoreException
CoreException@Deprecated public PDOMFile getFile(int linkageID, IIndexFileLocation location) throws CoreException
getFile in interface IIndexFragmentCoreExceptionpublic PDOMFile getFile(int linkageID, IIndexFileLocation location, ISignificantMacros macroDictionary) throws CoreException
IIndexFragmentnull, if no such file exists.
This method may only return files that are actually managed by this fragment.
This method returns files without content, also.getFile in interface IIndexFragmentlinkageID - the id of the linkage in which the file has been parsed.location - the IIndexFileLocation representing the location of the filenull if the file is not present in
the indexCoreExceptionpublic PDOMFile getFile(PDOMLinkage linkage, IIndexFileLocation location, ISignificantMacros macroDictionary) throws CoreException
CoreExceptionpublic IIndexFragmentFile[] getFiles(int linkageID, IIndexFileLocation location) throws CoreException
IIndexFragmentgetFiles in interface IIndexFragmentlinkageID - the id of the linkage in which the file has been parsed.location - the IIndexFileLocation representing the location of the fileCoreExceptionpublic IIndexFragmentFile[] getFiles(IIndexFileLocation location) throws CoreException
IIndexFragmentgetFiles in interface IIndexFragmentlocation - the IIndexFileLocation representing the location of the filenull if the file is not present in
the indexCoreExceptionpublic IIndexFragmentFile[] getAllFiles() throws CoreException
getAllFiles in interface IIndexFragmentCoreExceptionpublic IIndexFragmentFile[] getDefectiveFiles() throws CoreException
getDefectiveFiles in interface IIndexFragmentCoreExceptionpublic IIndexFragmentFile[] getFilesWithUnresolvedIncludes() throws CoreException
getFilesWithUnresolvedIncludes in interface IIndexFragmentCoreExceptionprotected IIndexFragmentFile addFile(int linkageID, IIndexFileLocation location, ISignificantMacros sigMacros) throws CoreException
CoreExceptionprotected void clearFileIndex()
throws CoreException
CoreExceptionprotected void clear()
throws CoreException
CoreExceptionpublic boolean isEmpty()
throws CoreException
CoreExceptionpublic IIndexFragmentBinding findBinding(IASTName name) throws CoreException
IIndexFragmentnull, if no
such binding exists.findBinding in interface IIndexFragmentname - the name for looking up the bindingnullCoreExceptionpublic IIndexBinding[] findBindings(java.util.regex.Pattern pattern, boolean isFullyQualified, IndexFilter filter, IProgressMonitor monitor) throws CoreException
CoreExceptionpublic IIndexFragmentBinding[] findBindings(java.util.regex.Pattern[] patterns, boolean isFullyQualified, IndexFilter filter, IProgressMonitor monitor) throws CoreException
IIndexFragmentfindBindings in interface IIndexFragmentpatterns - an array of patterns the names of the qualified name of the bindings have
to match.isFullyQualified - if true, the array of pattern specifies the fully
qualified namefilter - a filter that allows for skipping parts of the indexmonitor - a monitor to report progress, may be nullCoreExceptionpublic IIndexFragmentBinding[] findMacroContainers(java.util.regex.Pattern pattern, IndexFilter filter, IProgressMonitor monitor) throws CoreException
IIndexFragmentfindMacroContainers in interface IIndexFragmentpattern - a pattern the name of the bindings have to match.filter - a filter that allows for skipping parts of the indexmonitor - a monitor to report progress, may be nullCoreExceptionpublic IIndexFragmentBinding[] findBindings(char[][] names, IndexFilter filter, IProgressMonitor monitor) throws CoreException
IIndexFragmentfindBindings in interface IIndexFragmentnames - an array of names the qualified name of the bindings have to match.filter - a filter that allows for skipping parts of the indexmonitor - a monitor to report progress, may be nullCoreExceptionpublic IIndexFragmentBinding[] findBindings(char[][] names, boolean caseSensitive, IndexFilter filter, IProgressMonitor monitor) throws CoreException
CoreExceptionpublic IIndexLinkage[] getLinkages()
IIndexFragmentgetLinkages in interface IIndexFragmentpublic PDOMLinkage[] getLinkageImpls()
getLinkageImpls in interface IPDOMpublic void insertLinkage(PDOMLinkage linkage) throws CoreException
CoreExceptionpublic void acquireReadLock()
throws java.lang.InterruptedException
IIndexFragmentacquireReadLock in interface IIndexFragmentjava.lang.InterruptedExceptionpublic void releaseReadLock()
IIndexFragmentreleaseReadLock in interface IIndexFragmentpublic void acquireWriteLock(IProgressMonitor monitor)
throws java.lang.InterruptedException
java.lang.InterruptedExceptionjava.lang.IllegalStateException - if this PDOM is not writablepublic void acquireWriteLock(int giveupReadLocks,
IProgressMonitor monitor)
throws java.lang.InterruptedException
java.lang.InterruptedExceptionjava.lang.IllegalStateException - if this PDOM is not writablepublic final void releaseWriteLock()
public void releaseWriteLock(int establishReadLocks,
boolean flush)
public boolean hasWaitingReaders()
hasWaitingReaders in interface IIndexFragmenttrue if there are threads waiting for read locks.public long getLastWriteAccess()
IIndexFragmentgetLastWriteAccess in interface IIndexFragmentpublic long getLastReadAccess()
protected PDOMLinkage adaptLinkage(ILinkage linkage) throws CoreException
CoreExceptionpublic IIndexFragmentBinding adaptBinding(IBinding binding) throws CoreException
IIndexFragmentnull, if no
such binding exists. The binding may belong to an AST or another index fragment.adaptBinding in interface IIndexFragmentbinding - the binding to look for.nullCoreExceptionpublic IIndexFragmentBinding findBinding(IIndexFragmentName indexName) throws CoreException
CoreExceptionpublic IIndexFragmentName[] findNames(IBinding binding, int options) throws CoreException
IIndexFragmentfindNames in interface IIndexFragmentbinding - a binding for which names are searched foroptions - a combination of IIndexFragment.FIND_DECLARATIONS, IIndexFragment.FIND_DEFINITIONS,
IIndexFragment.FIND_REFERENCES and IIndexFragment.FIND_NON_LOCAL_ONLYCoreExceptionpublic IRecordIterator getDeclarationsDefintitionsRecordIterator(IIndexBinding binding) throws CoreException
CoreExceptionprotected boolean isCommitted(PDOMName name) throws CoreException
CoreExceptionprotected boolean isCommitted(PDOMMacro name) throws CoreException
CoreExceptionprotected boolean isCommitted(PDOMMacroReferenceName name) throws CoreException
CoreExceptionpublic IIndexFragmentInclude[] findIncludedBy(IIndexFragmentFile file) throws CoreException
IIndexFragmentfindIncludedBy in interface IIndexFragmentfile - a file to search for includes pointing to itCoreExceptionpublic java.io.File getPath()
public IIndexFragmentBinding[] findBindingsForPrefix(char[] prefix, boolean filescope, IndexFilter filter, IProgressMonitor monitor) throws CoreException
IIndexFragmentfindBindingsForPrefix in interface IIndexFragmentmonitor - to report progress, may be nullCoreExceptionpublic IIndexFragmentBinding[] findBindingsForPrefix(char[] prefix, boolean filescope, boolean caseSensitive, IndexFilter filter, IProgressMonitor monitor) throws CoreException
CoreExceptionpublic IIndexFragmentBinding[] findBindingsForContentAssist(char[] prefix, boolean filescope, IndexFilter filter, IProgressMonitor monitor) throws CoreException
IIndexFragmentfindBindingsForContentAssist in interface IIndexFragmentmonitor - to report progress, may be nullCoreExceptionpublic IIndexFragmentBinding[] findBindings(char[] name, boolean filescope, IndexFilter filter, IProgressMonitor monitor) throws CoreException
IIndexFragmentfindBindings in interface IIndexFragmentmonitor - to report progress, may be nullCoreExceptionpublic IIndexFragmentBinding[] findBindings(char[] name, boolean filescope, boolean isCaseSensitive, IndexFilter filter, IProgressMonitor monitor) throws CoreException
CoreExceptionpublic IIndexFragmentBinding[] findMacroContainers(char[] prefix, boolean isPrefix, boolean isCaseSensitive, IndexFilter filter, IProgressMonitor monitor) throws CoreException
CoreExceptionpublic IIndexMacro[] findMacros(char[] prefix, boolean isPrefix, boolean isCaseSensitive, IndexFilter filter, IProgressMonitor monitor) throws CoreException
IIndexFragmentfindMacros in interface IIndexFragmentmonitor - to report progress, may be nullCoreExceptionpublic java.lang.String getProperty(java.lang.String propertyName)
throws CoreException
IIndexFragmentgetProperty in interface IIndexFragmentpropertyName - a case-sensitive identifier for a property, or nullCoreExceptionIIndexFragment.PROPERTY_FRAGMENT_ID,
IIndexFragment.PROPERTY_FRAGMENT_FORMAT_ID,
IIndexFragment.PROPERTY_FRAGMENT_FORMAT_VERSIONpublic void close()
throws CoreException
CoreExceptionpublic void clearResultCache()
IIndexFragmentclearResultCache in interface IIndexFragmentpublic long getCacheHits()
IIndexFragmentgetCacheHits in interface IIndexFragmentpublic long getCacheMisses()
IIndexFragmentgetCacheMisses in interface IIndexFragmentpublic void resetCacheCounters()
IIndexFragmentresetCacheCounters in interface IIndexFragmentprotected void flush()
throws CoreException
CoreExceptionpublic java.lang.Object getCachedResult(java.lang.Object key)
IIndexFragmentgetCachedResult in interface IIndexFragmentpublic void putCachedResult(java.lang.Object key,
java.lang.Object result)
public java.lang.Object putCachedResult(java.lang.Object key,
java.lang.Object result,
boolean replace)
IIndexFragmentputCachedResult in interface IIndexFragmentreplace - if false an existing entry will not be replaced.public void removeCachedResult(java.lang.Object key)
public java.lang.String createKeyForCache(long record,
char[] name)
public boolean hasLastingDefinition(PDOMBinding binding) throws CoreException
CoreExceptionpublic IIndexFragmentFileSet createFileSet()
IIndexFragmentcreateFileSet in interface IIndexFragmentpublic void adjustThreadForReadLock(java.util.Map<java.lang.Thread,org.eclipse.cdt.internal.core.pdom.PDOM.DebugLockInfo> lockDebugging)
public IIndexScope[] getInlineNamespaces() throws CoreException
IIndexFragmentgetInlineNamespaces in interface IIndexFragmentCoreExceptionpublic boolean isFullyInitialized()
IIndexFragmenttrue if the index fragment is fully initialized. An fragment may not be fully
initialized during Eclipse startup, or soon after adding a new project to the workspace.isFullyInitialized in interface IIndexFragment