Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
289,300
boolean (T element) { myFoundElement = element; return false; }
setFound
289,301
boolean (@NotNull T element) { return setFound(element); }
execute
289,302
boolean (final T t) { return myProcessor.execute(t); }
processInReadAction
289,303
boolean (@NotNull SearchScope scope, @NotNull PsiElement element) { if (scope instanceof LocalSearchScope) { LocalSearchScope local = (LocalSearchScope)scope; return isInScope(local, element); } else { GlobalSearchScope globalScope = (GlobalSearchScope)scope; return isInScope(globalScope, element); } }
isInScope
289,304
boolean (@NotNull GlobalSearchScope globalScope, @NotNull PsiElement element) { PsiFile file = element.getContainingFile(); if (file == null) { return true; } while (file != null) { if (globalScope.contains(BackedVirtualFile.getOriginFileIfBacked(file.getOriginalFile().getViewProvider().getVirtualFile()))) { return true; } PsiElement context = file.getContext(); file = context == null ? null : context.getContainingFile(); } return false; }
isInScope
289,305
boolean (@NotNull LocalSearchScope local, @NotNull PsiElement element) { PsiElement[] scopeElements = local.getScope(); for (final PsiElement scopeElement : scopeElements) { if (PsiTreeUtil.isAncestor(scopeElement, element, false)) return true; } return false; }
isInScope
289,306
SearchScope (@NotNull SearchScope originalScope, FileType @NotNull ... fileTypes) { if (originalScope instanceof GlobalSearchScope) { return GlobalSearchScope.getScopeRestrictedByFileTypes( (GlobalSearchScope)originalScope, fileTypes ); } return LocalSearchScope.getScopeRestrictedByFileTypes( (LocalSearchScope)originalScope, fileTypes ); }
restrictScopeTo
289,307
SearchScope (@NotNull Project project, @NotNull SearchScope originalScope, @NotNull LanguageMatcher matcher) { if (originalScope instanceof GlobalSearchScope) { return new FileLanguageGlobalScope(project, (GlobalSearchScope)originalScope, matcher); } else { return LocalSearchScope.getScopeRestrictedByFileLanguage((LocalSearchScope)originalScope, matcher); } }
restrictScopeToFileLanguage
289,308
void (@NotNull ExtensionsArea oldArea) { dropCache(); }
areaReplaced
289,309
void (@NotNull T extension, @NotNull PluginDescriptor pluginDescriptor) { dropCache(); }
extensionAdded
289,310
void (@NotNull T extension, @NotNull PluginDescriptor pluginDescriptor) { dropCache(); }
extensionRemoved
289,311
void () { if (cache == null) { return; } synchronized (lock) { if (cache != null) { cache = null; ExtensionPoint<@NotNull T> extensionPoint = SmartExtensionPoint.this.extensionPoint; if (extensionPoint != null) { extensionPoint.removeExtensionPointListener(this); SmartExtensionPoint.this.extensionPoint = null; } } } }
dropCache
289,312
void (@NotNull T extension) { synchronized (lock) { explicitExtensions = explicitExtensions.add(extension); cache = null; } }
addExplicitExtension
289,313
void (@NotNull T extension) { synchronized (lock) { explicitExtensions = explicitExtensions.remove(extension); cache = null; } }
removeExplicitExtension
289,314
List<T> () { PersistentList<T> result = cache; if (result != null) { return result; } // it is ok to call getExtensionPoint several times - call is cheap, and implementation is thread-safe ExtensionPoint<T> extensionPoint = this.extensionPoint; if (extensionPoint == null) { extensionPoint = extensionPointSupplier.get(); this.extensionPoint = extensionPoint; } PersistentList<T> extensions = toPersistentList(extensionPoint.getExtensionList()); synchronized (lock) { result = cache; if (result != null) { return result; } // EP will not add duplicated listener, so, it is safe to not care about is already added extensionPoint.addExtensionPointListener(extensionPointAndAreaListener, false, null); result = explicitExtensions.isEmpty() ? extensions : explicitExtensions.addAll(extensions); cache = result; return result; } }
getExtensions
289,315
void (QueryExecutor<Result, Parameters> queryExecutor, Disposable parentDisposable) { registerExecutor(queryExecutor); Disposer.register(parentDisposable, new Disposable() { @Override public void dispose() { unregisterExecutor(queryExecutor); } }); }
registerExecutor
289,316
void () { unregisterExecutor(queryExecutor); }
dispose
289,317
void (@NotNull QueryExecutor<Result, Parameters> queryExecutor) { point.addExplicitExtension(queryExecutor); }
registerExecutor
289,318
void (@NotNull QueryExecutor<Result, Parameters> queryExecutor) { point.removeExplicitExtension(queryExecutor); }
unregisterExecutor
289,319
boolean (int fileId) { for (VirtualFileEnumeration scope : myHints) { if (scope.contains(fileId)) { return true; } } return false; }
contains
289,320
boolean (int fileId) { if (myHints.isEmpty()) return false; for (VirtualFileEnumeration scope : myHints) { if (!scope.contains(fileId)) { return false; } } return true; }
contains
289,321
String () { return myField.toString(); }
toString
289,322
String () { return getLanguage().getID() + this; }
getExternalId
289,323
void (@NotNull EmptyStub stub, @NotNull StubOutputStream dataStream) { }
serialize
289,324
void (@NotNull EmptyStub stub, @NotNull IndexSink sink) { }
indexStub
289,325
T () { return myParent; }
getParentStub
289,326
boolean () { return Boolean.TRUE.equals(getUserData(DANGLING_STUB)); }
isDangling
289,327
void () { putUserData(DANGLING_STUB, true); }
markDangling
289,328
int () { return id; }
getStubId
289,329
int (final int expected, final float f) { final long s = Math.max(2, nextPowerOfTwo((long)Math.ceil(expected / f))); if (s > (1 << 30)) throw new IllegalArgumentException("Too large (" + expected + " expected elements with load factor " + f + ")"); return (int)s; }
arraySize
289,330
long (long x) { if (x == 0) return 1; x--; x |= x >> 1; x |= x >> 2; x |= x >> 4; x |= x >> 8; x |= x >> 16; return (x | x >> 32) + 1; }
nextPowerOfTwo
289,331
int (final int n, final float f) { /* We must guarantee that there is always at least * one free entry (even with pathological load factors). */ return Math.min((int)Math.ceil(n * f), n - 1); }
maxFill
289,332
int (final int x) { final int h = x * INT_PHI; return h ^ (h >>> 16); }
mix
289,333
String () { return holderClass; }
toString
289,334
void (@NotNull Class<?> aClass) { if (isInitialized()) { Logger.getInstance(IStubElementType.class) .error("All stub element types should be created before index initialization is complete.\n" + "Please add the " + aClass + " containing stub element type constants to \"stubElementTypeHolder\" extension.\n" + "Registered extensions: " + StubElementTypeHolderEP.EP_NAME.getExtensionList()); } }
checkNotInstantiatedTooLate
289,335
void (@NotNull Class<?> aClass) { if (isInitialized()) { Logger.getInstance(IStubElementType.class) .error("All stub element types should be created before index initialization is complete.\n" + "Please add the " + aClass + " with external ID " + getExternalId() + " containing stub element type constants to \"stubElementTypeHolder\" extension.\n" + "Registered extensions: " + StubElementTypeHolderEP.EP_NAME.getExtensionList() + "\n" + "Registered lazy ids: " + lazyExternalIds); } }
checkNotInstantiatedTooLateWithId
289,336
boolean () { return lazyExternalIds != NOT_INITIALIZED_SET; }
isInitialized
289,337
boolean () { try { return lazyExternalIds.contains(getExternalId()); } catch (Throwable e) { // "getExternalId" might throw when called from constructor, if it accesses subclass fields. // Lazily-registered types have a contract that their "getExternalId" doesn't throw like this, // so getting an exception here is a sign that someone indeed creates their stub type after StubElementTypeHolderEP initialization. return false; } }
isLazilyRegistered
289,338
void () { lazyExternalIds = NOT_INITIALIZED_SET; }
dropRegisteredTypes
289,339
List<StubFieldAccessor> () { List<StubFieldAccessor> result = new ArrayList<>(); List<String> debugStr = new ArrayList<>(); StubElementTypeHolderEP.EP_NAME.processWithPluginDescriptor((bean, pluginDescriptor) -> { int accessorCount = bean.initializeOptimized(pluginDescriptor, result); debugStr.add(accessorCount + " in " + bean.holderClass); return Unit.INSTANCE; }); Logger.getInstance(IStubElementType.class).debug("Lazy stub element types loaded: " + StringUtil.join(debugStr, ", ")); Set<String> lazyIds = new HashSet<>(result.size()); for (StubFieldAccessor accessor : result) { lazyIds.add(accessor.externalId); } lazyExternalIds = Collections.unmodifiableSet(lazyIds); return result; }
loadRegisteredStubElementTypes
289,340
boolean (ASTNode node) { return true; }
shouldCreateStub
289,341
boolean (@NotNull LighterAST tree, @NotNull LighterASTNode node, @NotNull StubElement<?> parentStub) { return true; }
shouldCreateStub
289,342
StrippedIntOpenHashMap () { if (myMap == null) { myMap = new StrippedIntOpenHashMap(); } return myMap; }
initMap
289,343
int (int index) { return get(index); }
applyAsInt
289,344
int (int index) { int value = myList.getQuick(index); return value == IN_MAP ? myMap.get(index, 0) : value; }
get
289,345
StubElement () { return myParent; }
getParentStub
289,346
List<StubElement> () { return (List)myStubList.getChildrenStubs(id); }
getChildrenStubs
289,347
void (@NotNull T psi) { assert myPsi == null || myPsi == psi; myPsi = psi; }
setPsi
289,348
T () { T psi = myPsi; if (psi != null) return psi; //noinspection unchecked psi = (T)getStubType().createPsi(this); return myPsiUpdater.compareAndSet(this, null, psi) ? psi : Objects.requireNonNull(myPsi); }
getPsi
289,349
int (IElementType elementType, List<? extends StubElement> childrenStubs) { int count = 0; for (int i = 0, childrenStubsSize = childrenStubs.size(); i < childrenStubsSize; i++) { StubElement<?> childStub = childrenStubs.get(i); if (childStub.getStubType() == elementType) count++; } return count; }
countChildren
289,350
int (TokenSet types, List<? extends StubElement> childrenStubs) { int count = 0; for (int i = 0, childrenStubsSize = childrenStubs.size(); i < childrenStubsSize; i++) { StubElement<?> childStub = childrenStubs.get(i); if (types.contains(childStub.getStubType())) count++; } return count; }
countChildren
289,351
IStubElementType () { return myStubList.getStubType(id); }
getStubType
289,352
Project () { return getPsi().getProject(); }
getProject
289,353
String () { StringBuilder builder = new StringBuilder(); printTree(builder, 0); return builder.toString(); }
printTree
289,354
void (StringBuilder builder, int nestingLevel) { for (int i = 0; i < nestingLevel; i++) builder.append(" "); builder.append(this).append('\n'); for (StubElement<?> child : getChildrenStubs()) { ((StubBase<?>)child).printTree(builder, nestingLevel + 1); } }
printTree
289,355
String () { return getClass().getSimpleName(); }
toString
289,356
int (ObjectStubBase<?> another) { return Integer.compare(getStubId(), another.getStubId()); }
compareByOrderWith
289,357
int (int id) { return id * 3 + 1; }
childrenStartIndex
289,358
int (int id) { return id * 3 + 2; }
childrenCountIndex
289,359
int (int id) { return myStubData.get(childrenStartIndex(id)); }
getChildrenStart
289,360
boolean (int parentId, int childId) { return parentId >= 0 && childId != parentId + 1 && getChildrenCount(parentId) == 0; }
nonDfsOrderDetected
289,361
int (int childIndex) { return ((StubBase<?>)get(childIndex).getParentStub()).id; }
getParentIndex
289,362
ChildrenStorage (int childrenStart) { return childrenStart == 0 ? ChildrenStorage.inPlainList : childrenStart == IN_TEMP_MAP ? ChildrenStorage.inTempMap : ChildrenStorage.inJoinedList; }
getChildrenStorage
289,363
boolean (int index) { return myJoinedChildrenList.size() == index || myJoinedChildrenList.get(index) == 0; }
canAddToJoinedList
289,364
void (int index, int childId) { if (myJoinedChildrenList.size() == index) { myJoinedChildrenList.add(childId); } else { assert myJoinedChildrenList.get(index) == 0; myJoinedChildrenList.set(index, childId); } }
addToJoinedChildren
289,365
int () { return count; }
size
289,366
IntObjectMap<MostlyUShortIntList> () { assert myTempState != null; return Objects.requireNonNull(myTempState.myTempJoinedChildrenMap); }
tempMap
289,367
int (int parentId, int childrenCount, int slotsToReserve) { int start = myJoinedChildrenList.size(); assert start > 0; for (int i = 0; i < childrenCount; i++) { myJoinedChildrenList.add(parentId + i + 1); } for (int i = 0; i < slotsToReserve; i++) { myJoinedChildrenList.add(0); } myStubData.set(childrenStartIndex(parentId), start); return start; }
switchChildrenToJoinedList
289,368
void (int parentId) { if (myTempJoinedChildrenMap == null) { myTempJoinedChildrenMap = ContainerUtil.createConcurrentIntObjectMap(); } int start = getChildrenStart(parentId); int count = getChildrenCount(parentId); MostlyUShortIntList ids = new MostlyUShortIntList(count + 1); switch (getChildrenStorage(start)) { case inPlainList: for (int i = 0; i < count; i++) ids.add(parentId + i + 1); break; case inJoinedList: for (int i = start; i < start + count; i++) ids.add(myJoinedChildrenList.get(i)); break; default: throw new IllegalStateException(); } MostlyUShortIntList prev = myTempJoinedChildrenMap.put(parentId, ids); assert prev == null: parentId; myStubData.set(childrenStartIndex(parentId), IN_TEMP_MAP); }
switchChildrenToTempMap
289,369
StubList () { MaterialStubList copy = new MaterialStubList(size()); new Object() { void visitStub(StubBase<?> stub, int parentId) { int idInCopy = copy.size(); copy.addStub(idInCopy, parentId, getStubTypeIndex(stub.id)); copy.myPlainList.add(stub); List<StubBase<?>> children = getChildrenStubs(stub.id); copy.prepareForChildren(idInCopy, children.size()); for (StubBase<?> child : children) { visitStub(child, idInCopy); } } }.visitStub(get(0), -1); assert copy.isChildrenLayoutOptimal(); for (int i = 0; i < copy.size(); i++) { StubBase<?> stub = copy.get(i); stub.myStubList = copy; stub.id = i; } return copy.finalizeLoadingStage(); }
createOptimizedCopy
289,370
int () { return myPlainList.size(); }
size
289,371
int () { return containsNull ? size - 1 : size; }
realSize
289,372
void (int k, int v) { assert v != 0; int pos; int curr; int[] key = this.key; if (k == 0) { nullValue = v; containsNull = true; } else { // The starting point. if (!((curr = key[pos = Hash.mix(k) & mask]) == 0)) { if (curr == k) { value[pos] = v; return; } while (!((curr = key[pos = pos + 1 & mask]) == 0)) { if (curr == k) { value[pos] = v; return; } } } key[pos] = k; value[pos] = v; } if (size++ >= maxFill) { rehash(Hash.arraySize(size + 1, f)); } assert get(k, -1) == v && get(k, 0) == v; }
put
289,373
int () { return size; }
size
289,374
boolean () { return size == 0; }
isEmpty
289,375
void (int newN) { int[] key = this.key; int[] value = this.value; int mask = newN - 1; // Note that this is used by the hashing macro int[] newKey = new int[newN + 1]; int[] newValue = new int[newN + 1]; int i = n, pos; for (int j = realSize(); j-- != 0; ) { while (key[--i] == 0) ; if (!(newKey[pos = Hash.mix(key[i]) & mask] == 0)) { while (!(newKey[pos = pos + 1 & mask] == 0)) ; } newKey[pos] = key[i]; newValue[pos] = value[i]; } n = newN; this.mask = mask; maxFill = Hash.maxFill(n, f); this.key = newKey; this.value = newValue; for (i = 0; i < key.length; i++) { int k = key[i]; int v = value[i]; assert k==0 || get(k,-1)==v; } }
rehash
289,376
int (int k, int absentValue) { if (k == 0) { return containsNull ? nullValue : absentValue; } int curr; final int[] key = this.key; int pos; // The starting point. if ((curr = value[pos = Hash.mix(k) & mask]) == 0) { return absentValue; } if (k == key[pos]) { return curr; } while (true) { if ((curr = value[pos = pos + 1 & mask]) == 0) { return absentValue; } if (k == key[pos]) { return curr; } } }
get
289,377
boolean (Object element, PsiElement context) { return isClassAcceptable(element.getClass()) && isElementAcceptable((T)element, context); }
isAcceptable
289,378
boolean (Class hintClass) { return myClass.isAssignableFrom(hintClass); }
isClassAcceptable
289,379
boolean (Object element, PsiElement context) { return myPattern.accepts(element); }
isAcceptable
289,380
boolean (Class hintClass) { return true; //throw new UnsupportedOperationException("Method isClassAcceptable is not yet implemented in " + getClass().getName()); }
isClassAcceptable
289,381
String () { return myPattern.toString(); }
toString
289,382
boolean (final @Nullable Object o, final ProcessingContext context) { return filter == null || o != null && filter.isClassAcceptable(o.getClass()) && filter.isAcceptable(o, o instanceof PsiElement ? (PsiElement)o : null); }
accepts
289,383
boolean (final Object o) { if (this == o) return true; if (!(o instanceof FilterPattern)) return false; final FilterPattern that = (FilterPattern)o; if (myFilter != null ? !myFilter.equals(that.myFilter) : that.myFilter != null) return false; return true; }
equals
289,384
int () { return myFilter != null ? myFilter.hashCode() : 0; }
hashCode
289,385
String () { return super.toString() + " & " + myFilter; }
toString
289,386
String (@NotNull String psiTargetName) { return StringUtil.decapitalize(psiTargetName); }
getNameAlias
289,387
String (@NotNull String aliasName) { return StringUtil.capitalize(aliasName); }
getTargetName
289,388
boolean () { return getNavigationElement().isWritable(); }
isWritable
289,389
AliasingPsiTarget (@NotNull String newName) { return setAliasName(newName); }
setName
289,390
String () { return StringUtil.notNullize(getNameAlias(StringUtil.notNullize(((PsiNamedElement)getNavigationElement()).getName()))); }
getName
289,391
AliasingPsiTarget (@NotNull String newAliasName) { return this; }
setAliasName
289,392
String (@NotNull String aliasName) { return aliasName; }
getTargetName
289,393
PsiFile (@NotNull PsiFile file) { FileViewProvider viewProvider = file.getViewProvider(); return viewProvider.getPsi(viewProvider.getBaseLanguage()); }
getBaseFile
289,394
boolean (@NotNull PsiElement element) { return element.getContainingFile().getViewProvider() instanceof TemplateLanguageFileViewProvider; }
isInsideTemplateFile
289,395
boolean (@NotNull PsiFile file) { FileViewProvider viewProvider = file.getViewProvider(); return viewProvider instanceof TemplateLanguageFileViewProvider && file == viewProvider.getPsi(((TemplateLanguageFileViewProvider)viewProvider).getTemplateDataLanguage()); }
isTemplateDataFile
289,396
PsiElement (@NotNull PsiElement element) { PsiElement current = element.getNextSibling(); while (current instanceof OuterLanguageElement) { current = current.getPrevSibling(); } return current; }
getSameLanguageTreePrev
289,397
PsiElement (@NotNull PsiElement element) { PsiElement current = element.getNextSibling(); while (current instanceof OuterLanguageElement) { current = current.getNextSibling(); } return current; }
getSameLanguageTreeNext
289,398
MetaDataRegistrar () { return ApplicationManager.getApplication().getService(MetaDataRegistrar.class); }
getInstance
289,399
ReferenceProvidersRegistry () { return ApplicationManager.getApplication().getService(ReferenceProvidersRegistry.class); }
getInstance