Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
253,900
String (IElementType tokenType, CharSequence sequence, int start, int end) { return tokenType instanceof TokenWrapper ? ((TokenWrapper)tokenType).getValue() : StringUtil.replace(sequence.subSequence(start, end).toString(), "\n", "\\n"); }
getTokenText
253,901
AnActionEvent () { return createTestEvent(null, null, null); }
createTestEvent
253,902
AnActionEvent (@NotNull AnAction action) { return createTestEvent(action, null, null); }
createTestEvent
253,903
AnActionEvent (@NotNull DataContext context) { return createTestEvent(null, context, null); }
createTestEvent
253,904
AnActionEvent (@NotNull AnAction action, @NotNull DataContext context) { return createTestEvent(action, context, null); }
createTestEvent
253,905
AnActionEvent (@Nullable AnAction action, @Nullable DataContext context, @Nullable InputEvent inputEvent) { return AnActionEvent.createFromInputEvent( inputEvent, PLACE, action == null ? null : action.getTemplatePresentation().clone(), context != null ? context : DataManager.getInstance().getDataContext(), false, false...
createTestEvent
253,906
AnActionEvent (@Nullable Presentation presentation) { return AnActionEvent.createFromInputEvent( null, PLACE, presentation, DataManager.getInstance().getDataContext(), false, true); }
createTestToolbarEvent
253,907
long () { long start = System.currentTimeMillis(); long minTime = Integer.MAX_VALUE; long minIteration = -1; for (int i = 0;; i++) { long time = TimeoutUtil.measureExecutionTime(MANDELBROT::compute); if (time < minTime) { minTime = time; minIteration = i; } else if (i - minIteration > 100) { System.out.println("CPU tim...
calcStableCpuTiming
253,908
int (int y) { int count = 0; for (int x = 0; x < size; x++) { double Zr = 0.0; double Zi = 0.0; double Cr = (x * fac - 1.5); double Ci = (y * fac - 1.0); int i = ITERATIONS; double ZrN = 0; double ZiN = 0; do { Zi = 2.0 * Zr * Zi + Ci; Zr = ZrN - ZiN + Cr; ZiN = Zi * Zi; ZrN = Zr * Zr; } while (!(ZiN + ZrN > LIMIT_SQUA...
computeRow
253,909
void () { BigInteger k = new BigInteger("1"); for (int i = 0; i < 1000000; i++) { k = k.add(new BigInteger("1")); } }
addBigIntegers
253,910
void () { long k = 241; for (int i = 0; i < 22_222_222; i++) { k = i % 10 == 3 ? k * 239 : k % 12342; } ensureOdd(k); }
mulDiv
253,911
void (long k) { if (k % 2 == 0) { throw new AssertionError("Should be an odd value"); } }
ensureOdd
253,912
void () { int[] array = new int[240_000]; for (int i = 0; i < array.length; i++) { array[i] = i * 42 + 1; } int k = 241; for (int i = 0; i < 5_750_000; i++) { k *= array[MathUtil.nonNegativeAbs(k) % array.length]; } ensureOdd(k); }
mulDivMemAccess
253,913
double () { try { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); ObjectName name = ObjectName.getInstance("java.lang:type=OperatingSystem"); AttributeList list = mbs.getAttributes(name, new String[]{ "ProcessCpuLoad" }); if (list.isEmpty()) return Double.NaN; Attribute att = (Attribute)list.get(0); Doubl...
getProcessCpuLoad
253,914
double () { try { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); ObjectName name = ObjectName.getInstance("java.lang:type=OperatingSystem"); AttributeList list = mbs.getAttributes(name, new String[]{ "SystemCpuLoad" }); if (list.isEmpty()) return Double.NaN; Attribute att = (Attribute)list.get(0); Double...
getSystemCpuLoad
253,915
void (String[] args) { for (int i = 0; i < 20; i++) { // each line can be uncommented alone, to check the results of different benchmarks //System.out.println(calcCpuTiming(20, CpuTimings::addBigIntegers)); //System.out.println(calcCpuTiming(20, CpuTimings::mulDivMemAccess)); //System.out.println(calcCpuTiming(20, CpuT...
main
253,916
void (@NotNull Project project) { }
registerProjectFileSets
253,917
void (@NotNull ContentIterator processor, @NotNull Project project, @Nullable ProgressIndicator indicator) { }
iterateIndexableFiles
253,918
Logger () { return LOG; }
getLogger
253,919
VirtualFile (Project project, int id) { return null; }
findFileById
253,920
void (@NotNull ID<?, ?> indexId, @NotNull Throwable throwable) { }
requestRebuild
253,921
void (@NotNull VirtualFile file) { }
requestReindex
253,922
void () { }
invalidateCaches
253,923
IntPredicate (@Nullable Project project) { return value -> false; }
getAccessibleFileIdFilter
253,924
IdFilter (@Nullable Project project) { return null; }
projectIndexableFiles
253,925
void () { }
waitUntilIndicesAreInitialized
253,926
boolean (@NotNull Processor<? super Key> processor, @NotNull GlobalSearchScope scope, @Nullable IdFilter idFilter) { return true; }
processAllKeys
253,927
ReadWriteLock () { return myLock; }
getLock
253,928
Void (@NotNull IndexedFile file) { throw new UnsupportedOperationException(); }
getFileIndexMetaData
253,929
void (int fileId, @Nullable Void unused, boolean isProvidedByInfrastructureExtension) { throw new UnsupportedOperationException(); }
setIndexedStateForFileOnFileIndexMetaData
253,930
void (int fileId, @NotNull IndexedFile file, boolean isProvidedByInfrastructureExtension) { throw new UnsupportedOperationException(); }
setIndexedStateForFile
253,931
void (int fileId) { throw new UnsupportedOperationException(); }
invalidateIndexedStateForFile
253,932
void (int fileId) { throw new UnsupportedOperationException(); }
setUnindexedStateForFile
253,933
FileIndexingState (int fileId, @NotNull IndexedFile file) { throw new UnsupportedOperationException(); }
getIndexingStateForFile
253,934
long () { return 0; }
getModificationStamp
253,935
void (int inputId) { }
removeTransientDataForFile
253,936
void (int inputId, @NotNull InputDataDiffBuilder<Key, Value> diffBuilder) { }
removeTransientDataForKeys
253,937
void (@NotNull AbstractUpdateData<Key, Value> updateData) { throw new UnsupportedOperationException(); }
updateWithMap
253,938
void (boolean enabled) { }
setBufferingEnabled
253,939
void () { }
cleanupMemoryStorage
253,940
void () { }
cleanupForNextTest
253,941
boolean () { return false; }
isDirty
253,942
ValueContainer<Value> (@NotNull Key key) { return EmptyValueContainer.INSTANCE; }
getData
253,943
Computable<Boolean> (int inputId, @Nullable FileContent content) { throw new UnsupportedOperationException(); }
mapInputAndPrepareUpdate
253,944
Computable<Boolean> (int inputId, @NotNull InputData<Key, Value> data) { throw new UnsupportedOperationException(); }
prepareUpdate
253,945
void () { }
flush
253,946
void () { }
clear
253,947
void () { }
dispose
253,948
int () { return 0; }
keysCountApproximately
253,949
String (@NotNull String name, boolean lowercaseFirstLetter) { name = StringUtil.trimStart(name, "test"); return StringUtil.isEmpty(name) ? "" : lowercaseFirstLetter(name, lowercaseFirstLetter); }
getTestName
253,950
String (@NotNull String name, boolean lowercaseFirstLetter) { if (lowercaseFirstLetter && !isAllUppercaseName(name)) { name = Character.toLowerCase(name.charAt(0)) + name.substring(1); } return name; }
lowercaseFirstLetter
253,951
boolean (@NotNull String name) { int uppercaseChars = 0; for (int i = 0; i < name.length(); i++) { if (Character.isLowerCase(name.charAt(i))) { return false; } if (Character.isUpperCase(name.charAt(i))) { uppercaseChars++; } } return uppercaseChars >= 3; }
isAllUppercaseName
253,952
void (@NotNull Runnable setupEventQueue) { TestApplicationKt.loadApp(setupEventQueue); }
loadApp
253,953
String (@NotNull JTree tree, boolean withSelection) { return print(tree, new TreePath(tree.getModel().getRoot()), withSelection, null, null); }
print
253,954
String (@NotNull JTree tree, @NotNull TreePath path, @Nullable Queryable.PrintInfo printInfo, boolean withSelection) { return print(tree, path, withSelection, printInfo, null); }
print
253,955
String (@NotNull JTree tree, boolean withSelection, @Nullable Predicate<? super String> nodePrintCondition) { return print(tree, new TreePath(tree.getModel().getRoot()), withSelection, null, nodePrintCondition); }
print
253,956
String (JTree tree, TreePath path, boolean withSelection, @Nullable Queryable.PrintInfo printInfo, @Nullable Predicate<? super String> nodePrintCondition) { Collection<String> strings = new ArrayList<>(); printImpl(tree, path, strings, 0, withSelection, printInfo, nodePrintCondition); return String.join("\n", strings);...
print
253,957
void (JTree tree, TreePath path, Collection<? super String> strings, int level, boolean withSelection, @Nullable Queryable.PrintInfo printInfo, @Nullable Predicate<? super String> nodePrintCondition) { Object pathComponent = path.getLastPathComponent(); Object userObject = TreeUtil.getUserObject(pathComponent); String ...
printImpl
253,958
void (@NotNull JTree tree, @NonNls String expected) { assertTreeEqual(tree, expected, false); }
assertTreeEqual
253,959
void (@NotNull JTree tree, String expected, boolean checkSelected) { assertTreeEqual(tree, expected, checkSelected, false); }
assertTreeEqual
253,960
void (@NotNull JTree tree, @NotNull String expected, boolean checkSelected, boolean ignoreOrder) { String treeStringPresentation = print(tree, checkSelected); if (ignoreOrder) { List<String> actualLines = sorted(ContainerUtil.map(splitByLines(treeStringPresentation), String::trim)); List<String> expectedLines = sorted(...
assertTreeEqual
253,961
void (@NotNull JTree tree, int @NotNull ... rows) { for (int row : rows) { tree.expandRow(row); waitWhileBusy(tree); } }
expand
253,962
void (@NotNull JTree tree) { waitForPromise(TreeUtil.promiseExpandAll(tree)); }
expandAll
253,963
long (long startTimeMillis) { return System.currentTimeMillis() - startTimeMillis; }
getMillisSince
253,964
void (long startTimeMillis) { assertMaxWaitTimeSince(startTimeMillis, MAX_WAIT_TIME); }
assertMaxWaitTimeSince
253,965
void (long startTimeMillis, long timeout) { long took = getMillisSince(startTimeMillis); if (took > timeout) { assert false : String.format("the waiting takes too long. Expected to take no more than: %d ms but took: %d ms\nThread dump: %s", timeout, took, ThreadDumper.dumpThreadsToString()); } }
assertMaxWaitTimeSince
253,966
void () { Application application = ApplicationManager.getApplication(); if (application == null) { // skipping write access check in simple tests assertEventQueueDispatchThread(); } else { assert !application.isWriteAccessAllowed() : "do not wait under write action to avoid possible deadlock"; ThreadingAssertions.asse...
assertDispatchThreadWithoutWriteAccess
253,967
void () { if (!EventQueue.isDispatchThread()) { throw new IllegalStateException("Must be called from EDT but got: " + Thread.currentThread()); } }
assertEventQueueDispatchThread
253,968
boolean (@NotNull JTree tree, TreeModel model) { UIUtil.dispatchAllInvocationEvents(); if (model instanceof AsyncTreeModel async) { if (async.isProcessing()) return true; UIUtil.dispatchAllInvocationEvents(); return async.isProcessing(); } AbstractTreeBuilder builder = AbstractTreeBuilder.getBuilderFor(tree); if (build...
isBusy
253,969
void (@NotNull JTree tree) { waitWhileBusy(() -> isBusy(tree, tree.getModel())); }
waitWhileBusy
253,970
void (@NotNull Supplier<Boolean> busyCondition) { assertDispatchThreadWithoutWriteAccess(); long startTimeMillis = System.currentTimeMillis(); while (busyCondition.get()) { assertMaxWaitTimeSince(startTimeMillis); TimeoutUtil.sleep(5); UIUtil.dispatchAllInvocationEvents(); } }
waitWhileBusy
253,971
void (@NotNull ActionCallback callback) { AsyncPromise<?> promise = new AsyncPromise<>(); callback.doWhenDone(() -> promise.setResult(null)).doWhenRejected((@NotNull Runnable)promise::cancel); waitForPromise(promise); }
waitForCallback
253,972
void (int delay) { @NotNull Application app = ApplicationManager.getApplication(); assertDispatchThreadWithoutWriteAccess(); Disposable tempDisposable = Disposer.newDisposable(); AtomicBoolean runnableInvoked = new AtomicBoolean(); AtomicBoolean pooledRunnableInvoked = new AtomicBoolean(); AtomicBoolean alarmInvoked1 =...
waitForAlarm
253,973
void () { assertDispatchThreadWithoutWriteAccess(); IdeEventQueue eventQueue = IdeEventQueue.getInstance(); try (AccessToken ignored = ThreadContext.resetThreadContext()) { while (true) { AWTEvent event = eventQueue.peekEvent(); if (event == null) break; event = eventQueue.getNextEvent(); if (event instanceof Invocatio...
dispatchAllInvocationEventsInIdeEventQueue
253,974
void () { assertEventQueueDispatchThread(); while (true) { try (AccessToken ignored = ThreadContext.resetThreadContext()) { if (dispatchNextEventIfAny() == null) break; } catch (InterruptedException e) { throw new RuntimeException(e); } } }
dispatchAllEventsInIdeEventQueue
253,975
StringBuilder (@NotNull AbstractTreeStructure structure, @NotNull Object node, int currentLevel, @Nullable Comparator<?> comparator, int maxRowCount, char paddingChar, @Nullable Queryable.PrintInfo printInfo) { return print(structure, node, currentLevel, comparator, maxRowCount, paddingChar, o -> toString(o, printInfo)...
print
253,976
String (@NotNull AbstractTreeStructure structure, @NotNull Object node, @NotNull Function<Object, String> nodePresenter) { return print(structure, node, 0, Comparator.comparing(nodePresenter), -1, ' ', nodePresenter).toString(); }
print
253,977
StringBuilder (AbstractTreeStructure structure, Object node, int currentLevel, @Nullable Comparator<?> comparator, int maxRowCount, char paddingChar, Function<Object, String> nodePresenter) { StringBuilder buffer = new StringBuilder(); doPrint(buffer, currentLevel, node, structure, comparator, maxRowCount, 0, paddingCh...
print
253,978
int (StringBuilder buffer, int currentLevel, Object node, AbstractTreeStructure structure, @Nullable Comparator<?> comparator, int maxRowCount, int currentLine, char paddingChar, Function<Object, String> nodePresenter) { if (currentLine >= maxRowCount && maxRowCount != -1) return currentLine; StringUtil.repeatSymbol(bu...
doPrint
253,979
String (Object @NotNull [] objects) { return print(Arrays.asList(objects)); }
print
253,980
String (@NotNull Collection<?> c) { return c.stream().map(each -> toString(each, null)).collect(Collectors.joining("\n")); }
print
253,981
String (@NotNull ListModel<?> model) { StringBuilder result = new StringBuilder(); for (int i = 0; i < model.getSize(); i++) { result.append(toString(model.getElementAt(i), null)); result.append("\n"); } return result.toString(); }
print
253,982
String (@NotNull JTree tree) { return print(tree, false); }
print
253,983
void (@NotNull String actionId) { AnAction action = ActionManager.getInstance().getAction(actionId); assertNotNull(action); @SuppressWarnings("deprecation") DataContext context = DataManager.getInstance().getDataContext(); AnActionEvent event = AnActionEvent.createFromAnAction(action, null, "", context); assertTrue(Act...
invokeNamedAction
253,984
void (@NotNull String message, long expectedMs, long actual) { if (COVERAGE_ENABLED_BUILD) return; long expectedOnMyMachine = Math.max(1, expectedMs * Timings.CPU_TIMING / Timings.REFERENCE_CPU_TIMING); // Allow 10% more in case of test machine is busy. String logMessage = message; if (actual > expectedOnMyMachine) { i...
assertTiming
253,985
PerformanceTestInfo (@NonNls @NotNull String what, int expectedMs, @NotNull ThrowableRunnable<?> test) { return startPerformanceTestWithVariableInputSize(what, expectedMs, 1, () -> { test.run(); return 1; }); }
startPerformanceTest
253,986
PerformanceTestInfo (@NonNls @NotNull String what, int expectedMs, int expectedInputSize, @NotNull ThrowableComputable<Integer, ?> test) { return new PerformanceTestInfo(test, expectedMs, expectedInputSize, what); }
startPerformanceTestWithVariableInputSize
253,987
void (@Nullable String expected, @Nullable String actual) { if (expected != null) expected = FileUtil.toSystemIndependentName(expected); if (actual != null) actual = FileUtil.toSystemIndependentName(actual); assertEquals(expected, actual); }
assertPathsEqual
253,988
String () { return SystemProperties.getJavaHome() + (SystemInfo.isWindows ? "\\bin\\java.exe" : "/bin/java"); }
getJavaExe
253,989
URL () { String home = SystemProperties.getJavaHome(); try { return JavaVersion.current().feature >= 9 ? new URL("jrt:" + home) : new File(home + "/lib/rt.jar").toURI().toURL(); } catch (MalformedURLException e) { throw new RuntimeException(e); } }
getRtJarURL
253,990
void (@NotNull Project project) { if (!project.isDisposed()) { ApplicationManager.getApplication().invokeAndWait(() -> ProjectManagerEx.getInstanceEx().forceCloseProject(project)); } }
forceCloseProjectWithoutSaving
253,991
void (@NotNull Project project) { OpenProjectTaskBuilderKt.saveProject(project, false); }
saveProject
253,992
void (@NotNull Project project, boolean isForceSavingAllSettings) { OpenProjectTaskBuilderKt.saveProject(project, isForceSavingAllSettings); }
saveProject
253,993
void () { for (int i = 0; i < 50; i++) { CpuUsageData data = CpuUsageData.measureCpuUsage(() -> TimeoutUtil.sleep(100)); if (!data.hasAnyActivityBesides(Thread.currentThread())) { break; } } }
waitForAllBackgroundActivityToCalmDown
253,994
void (@NotNull String message, long expected, @NotNull Runnable actionToMeasure) { assertTiming(message, expected, 4, actionToMeasure); }
assertTiming
253,995
void (@NotNull String message, long expected, int attempts, @NotNull Runnable actionToMeasure) { while (true) { attempts--; waitForAllBackgroundActivityToCalmDown(); long duration = TimeoutUtil.measureExecutionTime(actionToMeasure::run); try { assertTiming(message, expected, duration); break; } catch (AssertionFailedEr...
assertTiming
253,996
void (@NotNull VirtualFile dir, VirtualFile @NotNull [] vfs) { if (dir.isInLocalFileSystem() && dir.getFileSystem() != TempFileSystem.getInstance()) { String vfsPaths = Stream.of(vfs).map(VirtualFile::getPath).sorted().collect(Collectors.joining("\n")); File[] io = Objects.requireNonNull(new File(dir.getPath()).listFil...
shallowCompare
253,997
String () { String homePath = IdeaTestExecutionPolicy.getHomePathWithPolicy(); if (new File(homePath, "community/.idea").isDirectory()) { homePath = homePath + File.separatorChar + "community"; } return homePath; }
getCommunityPath
253,998
String () { return getCommunityPath().replace(File.separatorChar, '/') + "/platform/platform-tests/testData/"; }
getPlatformTestDataPath
253,999
void (@NotNull String encoding, @NotNull ThrowableRunnable<?> r) { Charset.forName(encoding); // check the encoding exists try { Charset oldCharset = Charset.defaultCharset(); try { patchSystemFileEncoding(encoding); r.run(); } finally { patchSystemFileEncoding(oldCharset.name()); } } catch (Throwable t) { throw new Ru...
withEncoding