public final class CompilerReferenceServiceImpl extends CompilerReferenceServiceBase<JavaBackwardReferenceIndexReaderFactory.BackwardReferenceReader> implements CompilerReferenceServiceEx
CompilerReferenceServiceBase.CompilerElementInfo, CompilerReferenceServiceBase.ElementPlace, CompilerReferenceServiceBase.HierarchySearchKey, CompilerReferenceServiceBase.IndexCloseReason, CompilerReferenceServiceBase.IndexOpenReason, CompilerReferenceServiceBase.ReferentFileSearcher, CompilerReferenceServiceBase.ScopeWithoutReferencesOnCompilation
myActiveBuilds, myCompilationCount, myDirtyScopeHolder, myFileTypes, myLock, myOpenCloseLock, myProject, myProjectFileIndex, myReadDataLock, myReader, myReaderFactory
IS_ENABLED_KEY
EVER_CHANGED, NEVER_CHANGED
Constructor and Description |
---|
CompilerReferenceServiceImpl(Project project) |
Modifier and Type | Method and Description |
---|---|
java.util.SortedSet<ChainOpAndOccurrences<MethodCall>> |
findMethodReferenceOccurrences(java.lang.String rawReturnType,
byte iteratorKind,
ChainCompletionContext context) |
CompilerRef.CompilerClassHierarchyElementDef [] |
getDirectInheritors(CompilerRef.CompilerClassHierarchyElementDef baseClass) |
int |
getInheritorCount(CompilerRef.CompilerClassHierarchyElementDef baseClass) |
ChainOpAndOccurrences<TypeCast> |
getMostUsedTypeCast(java.lang.String operandQName) |
java.lang.String |
getName(int idx) |
int |
getNameId(java.lang.String name) |
CompilerRef.CompilerClassHierarchyElementDef |
mayCallOfTypeCast(CompilerRef.JavaCompilerMethodRef method,
int probabilityThreshold)
finds one best candidate to do a cast type before given method call (eg.:
((B) a).someMethod() ). |
boolean |
mayHappen(CompilerRef qualifier,
CompilerRef base,
int probabilityThreshold)
conditional probability P(ref1 | ref2) = P(ref1 * ref2) / P(ref2) > 1 - 1 / threshold
where P(ref) is a probability that ref is occurred in a file.
|
void |
projectOpened()
Invoked when the project corresponding to this component instance is opened.
|
asCompilerElements, buildScopeWithoutReferences, calculateDirectInheritors, calculateOccurrenceCount, closeReaderIfNeeded, executeOnBuildThread, getAllDirtyModulesForTest, getCompileTimeOccurrenceCount, getDirectInheritors, getFileIndex, getFileTypes, getFunExpressions, getHierarchyInfo, getModificationCount, getProject, getReferentFileIds, getReferentFileIds, getReferentFileIdsViaImplicitToString, getReferentFiles, getScopeWithoutCodeReferences, getScopeWithoutImplicitToStringCodeReferences, getTestFindUsages, getTestFunExpressions, getTestHierarchy, intersection, isActive, isServiceEnabledFor, markAsOutdated, onException, openReaderIfNeeded, requireIndexRebuild
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCompileTimeOccurrenceCount, getDirectInheritors, getFunExpressions, getInstance, getScopeWithoutCodeReferences, getScopeWithoutImplicitToStringCodeReferences, isActive, isEnabled
projectClosed
disposeComponent, initComponent
getComponentName
public CompilerReferenceServiceImpl(Project project)
public void projectOpened()
ProjectComponent
Note that components may be created for even unopened projects and this method can be never invoked for a particular component instance (for example for default project).
projectOpened
in interface ProjectComponent
projectOpened
in class CompilerReferenceServiceBase<JavaBackwardReferenceIndexReaderFactory.BackwardReferenceReader>
public java.util.SortedSet<ChainOpAndOccurrences<MethodCall>> findMethodReferenceOccurrences(java.lang.String rawReturnType, byte iteratorKind, ChainCompletionContext context)
findMethodReferenceOccurrences
in interface CompilerReferenceServiceEx
public ChainOpAndOccurrences<TypeCast> getMostUsedTypeCast(java.lang.String operandQName) throws ReferenceIndexUnavailableException
getMostUsedTypeCast
in interface CompilerReferenceServiceEx
ReferenceIndexUnavailableException
public CompilerRef.CompilerClassHierarchyElementDef mayCallOfTypeCast(CompilerRef.JavaCompilerMethodRef method, int probabilityThreshold) throws ReferenceIndexUnavailableException
((B) a).someMethod()
). Follows given formula:
#(files where method & type cast is occurred) / #(files where method is occurred) > 1 - 1 / probabilityThresholdmayCallOfTypeCast
in interface CompilerReferenceServiceEx
ReferenceIndexUnavailableException
public boolean mayHappen(CompilerRef qualifier, CompilerRef base, int probabilityThreshold)
mayHappen
in interface CompilerReferenceServiceEx
public java.lang.String getName(int idx) throws ReferenceIndexUnavailableException
getName
in interface CompilerReferenceServiceEx
ReferenceIndexUnavailableException
public int getNameId(java.lang.String name) throws ReferenceIndexUnavailableException
getNameId
in interface CompilerReferenceServiceEx
ReferenceIndexUnavailableException
public CompilerRef.CompilerClassHierarchyElementDef [] getDirectInheritors(CompilerRef.CompilerClassHierarchyElementDef baseClass) throws ReferenceIndexUnavailableException
getDirectInheritors
in interface CompilerReferenceServiceEx
ReferenceIndexUnavailableException
public int getInheritorCount(CompilerRef.CompilerClassHierarchyElementDef baseClass) throws ReferenceIndexUnavailableException
getInheritorCount
in interface CompilerReferenceServiceEx
ReferenceIndexUnavailableException