Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
250,200
LongRangeSet (LongRangeSet other, LongRangeType lrType) { LongRangeSet set = super.plus(other, lrType); if (other instanceof Point || other instanceof ModRange && ((ModRange)other).myMod == myMod && Long.bitCount(((ModRange)other).myBits) == 1) { long[] ranges = set.asRangeArray(); LongRangeSet result = empty(); int bi...
plus
250,201
LongRangeSet (LongRangeSet divisor) { if (divisor instanceof Point) { if (((Point)divisor).myValue > 1 && ((Point)divisor).myValue <= Long.SIZE) { int divisorValue = (int)((Point)divisor).myValue; int lcm = lcm(divisorValue); if (lcm <= Long.SIZE) { long from = MathUtil.clamp(myFrom, -divisorValue + 1, 0); long to = Ma...
mod
250,202
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass() || !super.equals(o)) return false; return myMod == ((ModRange)o).myMod && myBits == ((ModRange)o).myBits; }
equals
250,203
int () { return Objects.hash(super.hashCode(), myMod, myBits); }
hashCode
250,204
String () { return super.toString() + ": " + getSuffix(); }
toString
250,205
LongStream () { return super.stream().filter(this::contains); }
stream
250,206
boolean (long from, long to) { if (from < myFrom || to > myTo) return false; if (to == from) return contains(from); if (to - from < 0 || to - from >= myMod) return false; int fromBit = remainder(from, myMod); int toBit = remainder(to, myMod); if (fromBit < toBit) { return Long.numberOfTrailingZeros(~(myBits >>> fromBit...
contains
250,207
long (int targetMod) { assert targetMod <= Long.SIZE && targetMod % myMod == 0; long result = myBits; for (int shift = targetMod - myMod; shift > 0; shift -= myMod) { result |= myBits << shift; } return result; }
widenBits
250,208
long () { return -1L >>> (Long.SIZE - myMod); }
getMask
250,209
int (int otherMod) { return myMod * otherMod / gcd(myMod, otherMod); }
lcm
250,210
LongRangeSet (@NotNull LongRangeSet other) { if (other.isEmpty()) return this; if (other == this) return Empty.EMPTY; long[] result = new long[myRanges.length + other.asRangeArray().length]; int index = 0; for (int i = 0; i < myRanges.length; i += 2) { LongRangeSet res = range(myRanges[i], myRanges[i + 1]).subtract(oth...
subtract
250,211
LongRangeSet (@NotNull LongRangeSet other) { if (other == this) return this; if (other.isEmpty()) return other; if (other instanceof Point || other instanceof Range) { return other.meet(this); } return subtract(all().subtract(other)); }
meet
250,212
LongRangeSet (@NotNull LongRangeSet other) { if (!(other instanceof RangeSet)) { return other.join(this); } if(other == this) return this; if(other.contains(this)) return other; if(this.contains(other)) return this; LongRangeSet result = other; for(int i=0; i<myRanges.length; i+=2) { result = range(myRanges[i], myRange...
join
250,213
long () { return myRanges[0]; }
min
250,214
long () { return myRanges[myRanges.length - 1]; }
max
250,215
boolean (LongRangeSet other) { if (other.isEmpty()) return false; if (other instanceof Point) { return contains(((Point)other).myValue); } long[] otherRanges = other.asRangeArray(); int a = 0, b = 0; while (true) { long aFrom = myRanges[a]; long aTo = myRanges[a + 1]; long bFrom = otherRanges[b]; long bTo = otherRanges...
intersects
250,216
boolean (long value) { for (int i = 0; i < myRanges.length; i += 2) { if (value >= myRanges[i] && value <= myRanges[i + 1]) { return true; } } return false; }
contains
250,217
boolean (@NotNull LongRangeSet other) { if (other.isEmpty() || other == this) return true; if (other instanceof Point) { return contains(((Point)other).myValue); } LongRangeSet result = other; for (int i = 0; i < myRanges.length; i += 2) { result = result.subtract(range(myRanges[i], myRanges[i + 1])); if (result.isEmpt...
contains
250,218
String (@NotNull LongRangeSet fullTypeRange) { LongRangeSet diff = fullTypeRange.subtract(this); if (diff instanceof Point) { return "!= " + diff.min(); } if (diff instanceof Range && !diff.intersects(this)) { String min = diff.min() == fullTypeRange.min() ? "" : diff.min() == fullTypeRange.min() + 1 ? formatNumber(ful...
getPresentationText
250,219
boolean (long cutoff) { long totalDiff = 0; for (int i = 0; i < myRanges.length; i += 2) { long diff = myRanges[i + 1] - myRanges[i]; if (diff < 0) return true; totalDiff += diff + 1; if (totalDiff < 0 || totalDiff > cutoff) return true; } return false; }
isCardinalityBigger
250,220
LongRangeSet (LongRangeType lrType) { LongRangeSet result = empty(); for (int i = 0; i < myRanges.length; i += 2) { result = result.join(range(myRanges[i], myRanges[i + 1]).abs(lrType)); } return result; }
abs
250,221
LongRangeSet (LongRangeType lrType) { LongRangeSet result = empty(); for (int i = 0; i < myRanges.length; i += 2) { result = result.join(range(myRanges[i], myRanges[i + 1]).negate(lrType)); } return result; }
negate
250,222
LongRangeSet (LongRangeSet other, LongRangeType lrType) { if (myRanges.length > 6) { return range(min(), max()).plus(other, lrType); } LongRangeSet result = empty(); for (int i = 0; i < myRanges.length; i += 2) { result = result.join(range(myRanges[i], myRanges[i + 1]).plus(other, lrType)); } return result; }
plus
250,223
LongRangeSet (LongRangeSet divisor) { if(divisor.isEmpty()) return empty(); LongRangeSet result = empty(); for (int i = 0; i < myRanges.length; i += 2) { result = result.join(range(myRanges[i], myRanges[i + 1]).mod(divisor)); } return result; }
mod
250,224
LongStream () { return IntStream.range(0, myRanges.length / 2) .mapToObj(idx -> LongStream.rangeClosed(myRanges[idx * 2], myRanges[idx * 2 + 1])) .reduce(LongStream::concat).orElseGet(LongStream::empty); }
stream
250,225
List<LongRangeSet> () { return IntStream.range(0, myRanges.length / 2) .mapToObj(idx -> range(myRanges[idx * 2], myRanges[idx * 2 + 1])) .collect(Collectors.toList()); }
asRanges
250,226
int () { return Arrays.hashCode(myRanges); }
hashCode
250,227
boolean (Object o) { if (o == this) return true; return o instanceof RangeSet && Arrays.equals(myRanges, ((RangeSet)o).myRanges); }
equals
250,228
String () { StringJoiner sb = new StringJoiner(", ", "{", "}"); for (int i = 0; i < myRanges.length; i += 2) { sb.add(LongRangeSet.toString(myRanges[i], myRanges[i + 1])); } return sb.toString(); }
toString
250,229
int (int x, int y) { while (x != 0) { int z = x; x = y % z; y = z; } return y; }
gcd
250,230
long (long value, int bitNumber) { return value & (~(1L << bitNumber)); }
clearBit
250,231
long (long value, int bitNumber) { return value | (1L << bitNumber); }
setBit
250,232
boolean (long value, int bitNumber) { return (value & (1L << bitNumber)) != 0; }
isSet
250,233
long (long value, int offset, int count) { long shifted = value >>> offset; return count == Long.SIZE ? shifted : shifted & ((1L << count) - 1); }
extractBits
250,234
int (long dividend, int divisor) { dividend = dividend % divisor; return (int)(dividend < 0 ? dividend + divisor : dividend); }
remainder
250,235
long (long bits, int mod, int amount) { return extractBits(bits, amount, Long.SIZE) | (extractBits(bits, 0, amount) << (mod - amount)); }
rotateRemainders
250,236
BitString (BitString other) { long diff = myBits ^ other.myBits; return new BitString(myBits, myMask & other.myMask & ~diff); }
unite
250,237
ThreeState (int bit) { return isSet(myMask, bit) ? ThreeState.fromBoolean(isSet(myBits, bit)) : ThreeState.UNSURE; }
get
250,238
BitString (BitString other) { long andBits = myBits & other.myBits; // 0 & ? = ? & 0 = 0; 1 & 1 = 1; ? & 1 = 1 & ? = ? & ? = ? long andMask = (myMask ^ myBits) | (other.myMask ^ other.myBits) | andBits; return new BitString(andBits, andMask); }
and
250,239
BitString (BitString other) { long orBits = myBits | other.myBits; // 1 | ? = ? | 1 = 1; 0 | 0 = 0; ? | 0 = 0 | ? = ? | ? = ? long orMask = ((myMask ^ myBits) & (other.myMask ^ other.myBits)) | orBits; return new BitString(orBits, orMask); }
or
250,240
BitString (BitString other) { long xorBits = myBits ^ other.myBits; // if bit is unknown in either operand, it's unknown in the result; otherwise we may xor normally long xorMask = myMask & other.myMask; return new BitString(xorBits, xorMask); }
xor
250,241
String () { StringBuilder sb = new StringBuilder("["); for(int i=Long.SIZE-1; i>=0; i--) { sb.append(isSet(myMask, i) ? isSet(myBits, i) ? '1' : '0' : '?'); if (i != 0 && i % 8 == 0) { sb.append("."); } } sb.append("]"); return sb.toString(); }
toString
250,242
BitString (long from, long to) { if (from == to) { return new BitString(from, -1L); } long bits = 0; long mask = -1; while (true) { int fromBit = Long.SIZE - 1 - Long.numberOfLeadingZeros(from); int toBit = Long.SIZE - 1 - Long.numberOfLeadingZeros(to); if (fromBit != toBit) { for (int i = 0; i <= Math.max(fromBit, toB...
fromRange
250,243
LongRangeSet (@NotNull LongRangeSet left, @NotNull LongRangeSet right, LongRangeType lrType) { return switch (this) { case PLUS -> left.plus(right, lrType); case MINUS -> left.minus(right, lrType); case AND -> left.bitwiseAnd(right); case OR -> left.bitwiseOr(right, lrType); case XOR -> left.bitwiseXor(right, lrType); ...
eval
250,244
LongRangeSet (@NotNull LongRangeSet left, @NotNull LongRangeSet right, LongRangeType lrType) { return switch (this) { case PLUS -> left.plusWiden(right, lrType); case MINUS -> { if (Long.valueOf(0).equals(left.getConstantValue())) { // Unary minus yield left.minus(right, lrType); } yield left.plusWiden(right.negate(lrT...
evalWide
250,245
String () { return mySymbol; }
toString
250,246
boolean () { return this == SHL || this == SHR || this == USHR; }
isShift
250,247
int () { return myBytes; }
bytes
250,248
int () { return myBytes * 8; }
bits
250,249
LongRangeSet () { return myRange; }
fullRange
250,250
long () { return mySigned ? -(1L << (bits() - 1)) : 0; }
min
250,251
long () { return (1L << (mySigned ? bits() - 1 : bits())) - 1; }
max
250,252
long (long value) { return switch (this) { case INT32 -> (int)value; case INT64 -> value; }; }
cast
250,253
boolean (long a, long b) { if (myBytes == 8) { long diff = a - b; // Hacker's Delight 2nd Edition, 2-13 Overflow Detection return ((a ^ b) & (a ^ diff)) < 0; } long diff = a - b; return diff < min() || diff > max(); }
subtractionMayOverflow
250,254
String () { return AnalysisBundle.message("cleanup.in.file"); }
getFamilyName
250,255
AnalysisScope (Project project, PsiFile file) { return new AnalysisScope(file); }
getScope
250,256
String () { return getFamilyName(); }
getText
250,257
String () { return AnalysisBundle.message("cleanup.in.scope"); }
getFamilyName
250,258
boolean (final @NotNull Project project, final Editor editor, final PsiFile file) { return true; }
isAvailable
250,259
boolean () { return false; }
startInWriteAction
250,260
GlobalInspectionContext () { return myContext; }
getContext
250,261
void (@NotNull RefVisitor visitor) { for (RefElement refElement : getSortedElements()) { refElement.accept(visitor); } List<RefModule> filteredModules = ContainerUtil.filter(myModules.values(), refModule -> ReadAction.compute(() -> myScope.containsModule(refModule.getModule()))); for (RefModule refModule : filteredModu...
iterate
250,262
void () { myScope = null; myRefProject = null; myRefTable.clear(); myCachedSortedRefs = null; myModules.clear(); myContext = null; myGraphAnnotators.clear(); for (RefManagerExtension<?> extension : myExtensions.values()) { extension.cleanup(); } myExtensions.clear(); myLanguageExtensions.clear(); }
cleanup
250,263
void (RefElement refWhat, RefElement refFrom, boolean referencedFromClassInitializer, final boolean forReading, final boolean forWriting) { for (RefGraphAnnotator annotator : myGraphAnnotators) { annotator.onMarkReferenced(refWhat, refFrom, referencedFromClassInitializer, forReading, forWriting); } }
fireNodeMarkedReferenced
250,264
void (RefElement refWhat, RefElement refFrom, boolean referencedFromClassInitializer, final boolean forReading, final boolean forWriting, PsiElement element) { for (RefGraphAnnotator annotator : myGraphAnnotators) { annotator.onMarkReferenced(refWhat, refFrom, referencedFromClassInitializer, forReading, forWriting, ele...
fireNodeMarkedReferenced
250,265
void (PsiElement what, PsiElement from) { for (RefGraphAnnotator annotator : myGraphAnnotators) { annotator.onMarkReferenced(what, from, false); } }
fireNodeMarkedReferenced
250,266
void (RefElement refElement) { for (RefGraphAnnotator annotator : myGraphAnnotators) { annotator.onReferencesBuild(refElement); } }
fireBuildReferences
250,267
void (@NotNull RefGraphAnnotator annotator) { if (!myGraphAnnotators.contains(annotator)) { myGraphAnnotators.add(annotator); if (annotator instanceof RefGraphAnnotatorEx) { ((RefGraphAnnotatorEx)annotator).initialize(this); } } }
registerGraphAnnotator
250,268
void (RefGraphAnnotator annotator) { myGraphAnnotators.remove(annotator); }
unregisterAnnotator
250,269
RefEntity (@NotNull RefEntity ref) { for (RefManagerExtension<?> extension : myExtensions.values()) { ref = extension.getRefinedElement(ref); } return ref; }
getRefinedElement
250,270
void (final Element problem, final RefModule refModule) { if (refModule != null) { Element moduleElement = new Element("module"); moduleElement.addContent(refModule.getName()); problem.addContent(moduleElement); } }
appendModule
250,271
void () { final AnalysisScope scope = getScope(); if (scope == null) { return; } if (!myDeclarationsFound.getAndSet(true)) { long before = System.currentTimeMillis(); startTaskWorkers(); try { if (!Registry.is("batch.inspections.visit.psi.in.parallel")) { scope.accept(myProjectIterator); } else { final PsiManager psiMa...
findAllDeclarations
250,272
void () { final List<Future<?>> futures = myFutures; if (futures == null) return; myFutures = null; try { for (Future<?> future : futures) { future.get(); } myTasks = null; } catch (ExecutionException | InterruptedException e) { throw new RuntimeException(e); } }
waitForWorkersToFinish
250,273
void (RefElement element) { if (element.areReferencesBuilt()) return; ((RefElementImpl)element).setReferencesBuilt(true); executeTask(() -> { element.initializeIfNeeded(); element.buildReferences(); fireBuildReferences(element); }); }
buildReferences
250,274
void (@Async.Schedule @NotNull Runnable runnable) { if (myTasks != null) { try { myTasks.put(runnable); } catch (InterruptedException ignore) {} } else { runnable.run(); } }
executeTask
250,275
void () { if (!Registry.is("batch.inspections.process.project.usages.in.parallel")) { return; } final int setting = Registry.get("batch.inspections.number.of.threads").asInteger(); final int threadsCount = (setting > 0) ? setting : Runtime.getRuntime().availableProcessors() - 1; if (threadsCount == 0) { // need more th...
startTaskWorkers
250,276
void (ProgressIndicator progressIndicator, @Async.Execute Runnable task) { DumbService.getInstance(myProject).runReadActionInSmartMode( () -> ProgressManager.getInstance().executeProcessUnderProgress(task, progressIndicator) ); }
runTask
250,277
boolean () { return myDeclarationsFound.get(); }
isDeclarationsFound
250,278
void (@NotNull Runnable runnable) { myIsInProcess = true; try { runnable.run(); } finally { myIsInProcess = false; if (myScope != null) { myScope.invalidate(); } myCachedSortedRefs = null; } }
runInsideInspectionReadAction
250,279
void () { myOfflineView = true; }
startOfflineView
250,280
boolean () { return myOfflineView; }
isOfflineView
250,281
Project () { return myProject; }
getProject
250,282
RefProject () { return myRefProject; }
getRefProject
250,283
List<RefElement> () { List<RefElement> answer = myCachedSortedRefs; if (answer != null) return answer; answer = getElements(); List<RefElement> list = answer; ReadAction.run(() -> ContainerUtil.quickSort(list, (o1, o2) -> { VirtualFile v1 = ((RefElementImpl)o1).getVirtualFile(); VirtualFile v2 = ((RefElementImpl)o2).ge...
getSortedElements
250,284
List<RefElement> () { return new ArrayList<>(myRefTable.values()); }
getElements
250,285
PsiManager () { return myPsiManager; }
getPsiManager
250,286
void (@NotNull RefElement refElem) { final PsiElement element = refElem.getPsiElement(); final RefManagerExtension<?> extension = element != null ? getExtension(element.getLanguage()) : null; if (extension != null) { extension.removeReference(refElem); } if (element != null && myRefTable.remove(createAnchor(element)) !...
removeReference
250,287
PsiAnchor (final @NotNull PsiElement element) { return ReadAction.compute(() -> PsiAnchor.create(element)); }
createAnchor
250,288
void () { for (RefGraphAnnotator annotator : EP_NAME.getExtensionList()) { registerGraphAnnotator(annotator); } }
initializeAnnotators
250,289
void (@NotNull PsiElement element) { ProgressManager.checkCanceled(); final RefManagerExtension<?> extension = getExtension(element.getLanguage()); if (extension != null) { extension.visitElement(element); } else if (processExternalElements) { PsiFile file = element.getContainingFile(); if (file != null) { RefManagerEx...
visitElement
250,290
void (@NotNull PsiFile file) { final VirtualFile virtualFile = file.getVirtualFile(); if (virtualFile != null) { String relative = ProjectUtilCore.displayUrlRelativeToProject(virtualFile, virtualFile.getPresentableUrl(), myProject, true, false); myContext.incrementJobDoneAmount(myContext.getStdJobDescriptors().BUILD_GR...
visitFile
250,291
RefModule (@Nullable Module module) { if (module == null) { return null; } RefModule refModule = myModules.get(module); if (refModule == null) { refModule = ConcurrencyUtil.cacheOrGet(myModules, module, new RefModuleImpl(module, this)); } return refModule; }
getRefModule
250,292
boolean (final PsiElement psiElement) { return belongsToScope(psiElement, false); }
belongsToScope
250,293
boolean (final PsiElement psiElement, final boolean ignoreScope) { if (psiElement == null || !psiElement.isValid()) return false; if (psiElement instanceof PsiCompiledElement) return false; final PsiFile containingFile = ReadAction.compute(psiElement::getContainingFile); if (containingFile == null) { return false; } fo...
belongsToScope
250,294
String (RefEntity refEntity) { if (refEntity == null || refEntity instanceof RefElementImpl && !refEntity.isValid()) { return AnalysisBundle.message("inspection.reference.invalid"); } return refEntity.getQualifiedName(); }
getQualifiedName
250,295
void (@NotNull RefElement refElement, @NotNull List<? super RefElement> deletedRefs) { refElement.initializeIfNeeded(); List<RefEntity> children = refElement.getChildren(); RefElement[] refElements = children.toArray(new RefElement[0]); for (RefElement refChild : refElements) { removeRefElement(refChild, deletedRefs); ...
removeRefElement
250,296
boolean () { return myIsInProcess || myOfflineView || ApplicationManager.getApplication().isUnitTestMode(); }
isValidPointForReference
250,297
void (final @NotNull RefVisitor refVisitor) { ApplicationManager.getApplication().runReadAction(() -> refVisitor.visitModule(this)); }
accept
250,298
Module () { return myModule; }
getModule
250,299
boolean () { return !myModule.isDisposed(); }
isValid