Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
273,200
void () { @NonNls final String longName = "ThisIsAQuiteLongNameWithParentheses().Dots.-Minuses-_UNDERSCORES_digits239:colons:/slashes\\AndOfCourseManyLetters"; final List<MinusculeMatcher> matching = new ArrayList<>(); final List<MinusculeMatcher> nonMatching = new ArrayList<>(); for (String s : ContainerUtil.ar("*", "...
testPerformance
273,201
void () { PlatformTestUtil.startPerformanceTest(getName(), 120, () -> { String small = StringUtil.repeat("_", 50000); String big = StringUtil.repeat("_", small.length() + 1); assertMatches("*" + small, big); assertDoesntMatch("*" + big, small); }).assertTiming(); }
testOnlyUnderscoresPerformance
273,202
void () { PlatformTestUtil.startPerformanceTest(getName(), 30, () -> { String big = StringUtil.repeat("Aaaaaa", 50000); assertMatches("aaaaaaaaaaaaaaaaaaaaaaaa", big); assertDoesntMatch("aaaaaaaaaaaaaaaaaaaaaaaab", big); }).assertTiming(); }
testRepeatedLetterPerformance
273,203
void () { PlatformTestUtil.startPerformanceTest(getName(), 30, () -> { String pattern = "*<p> aaa <div id=\"a"; String html = "<html> <body> <H2> <FONT SIZE=\"-1\"> com.sshtools.cipher</FONT> <BR> Class AES128Cbc</H2> <PRE> java.lang.Object <IMG SRC=\"../../../resources/inherit.gif\" ALT=\"extended by\">com.maverick.ss...
testMatchingLongHtmlWithShortHtml
273,204
void () { String pattern = "*Then the large string is '{asdbsfafds adsfadasdfasdfasdfasdfasdfasdfsfasf adsfasdf sfasdfasdfasdfasdfasdfasdfd adsfadsfsafd adsfafdadsfsdfasdf sdf asdfasdfasfadsfasdfasfd asdfafd fasdfasdfasdfdsfas dadsfasfadsfafdsafddf dsf dsasdfasdfsdafsdfsdfsdfasdffafdadfafafasdfasdf asdfasdfasdfasdfasdf...
testMatchingLongStringWithAnotherLongStringWhereOnlyEndsDiffer
273,205
void (String pattern, String name) { PlatformTestUtil.startPerformanceTest(getName(), 30, () -> assertDoesntMatch(pattern, name)).assertTiming(); }
assertDoesntMatchFast
273,206
void () { PlatformTestUtil.startPerformanceTest(getName(), 30, () -> { String pattern = "*# -*- coding: utf-8 -*-$:. unshift(\"/Library/RubyMotion/lib\")require 'motion/project'Motion::Project::App. setup do |app| # Use `rake config' to see complete project settings. app. sdk_version = '4. 3'end"; String name = "# -*- ...
testMatchingLongRuby
273,207
void () { String s = "the class with its attributes mapped to fields of records parsed by an {@link AbstractParser} or written by an {@link AbstractWriter}."; PlatformTestUtil.startPerformanceTest(getName(), 30, () -> { assertMatches(s, s); assertMatches("*" + s, s); assertPreference(s, s.substring(0, 10), s); assertPr...
testLongStringMatchingWithItself
273,208
void () { DefaultLogger.disableStderrDumping(getTestRootDisposable()); SimpleModificationTracker dependency = new SimpleModificationTracker(); Function<String, String> getCached = arg -> CachedValuesManager.getManager(getProject()).getCachedValue(holder, () -> CachedValueProvider.Result.create("result " + arg, dependen...
testCachedValueCapturingInvalidStuff
273,209
Long () { return getPsiManager().getModificationTracker().getModificationCount(); }
getPsiModCount
273,210
void () { IdempotenceChecker.disableRandomChecksUntil(getTestRootDisposable()); PsiFile file = myFixture.addFileToProject("a.txt", ""); AtomicInteger recomputations = new AtomicInteger(); CachedValue<String> cv = CachedValuesManager.getManager(getProject()).createCachedValue(() -> { recomputations.incrementAndGet(); re...
testExternalChangesDoNotLeadToRecomputationOfPsiFileDependentCache
273,211
void () { VirtualFile moduleRoot = getTempDir().createVirtualDir(); ModuleRootModificationUtil.addContentRoot(getModule(), moduleRoot.getPath()); GlobalSearchScope projectScope = GlobalSearchScope.projectScope(getProject()); assertFalse(projectScope.isSearchInLibraries()); assertTrue(projectScope.isSearchInModuleConten...
testNotScope
273,212
void () { AtomicInteger targetCalled = new AtomicInteger(); GlobalSearchScope alwaysTrue = new DelegatingGlobalSearchScope(new EverythingGlobalScope()) { @Override public boolean contains(@NotNull VirtualFile file) { return true; } }; GlobalSearchScope target = new DelegatingGlobalSearchScope(new EverythingGlobalScope(...
testIntersectionPreservesOrderInCaseClientsWantToPutCheaperChecksFirst
273,213
boolean (@NotNull VirtualFile file) { return true; }
contains
273,214
boolean (@NotNull VirtualFile file) { targetCalled.incrementAndGet(); return true; }
contains
273,215
void () { VirtualFile moduleRoot = getTempDir().createVirtualDir(); assertNotNull(moduleRoot); PsiTestUtil.addSourceRoot(getModule(), moduleRoot); VirtualFile moduleRoot2 = getTempDir().createVirtualDir(); assertNotNull(moduleRoot2); PsiTestUtil.addSourceRoot(getModule(), moduleRoot2); GlobalSearchScope modScope = getM...
testUnionWithEmptyScopeMustNotAffectCompare
273,216
void () { PsiFile file = PsiFileFactory.getInstance(myProject).createFileFromText(PlainTextLanguage.INSTANCE, ""); VirtualFile vFile = file.getViewProvider().getVirtualFile(); assertFalse(GlobalSearchScope.allScope(myProject).contains(vFile)); assertFalse(PsiSearchScopeUtil.isInScope(GlobalSearchScope.allScope(myProjec...
testIsInScopeDoesNotAcceptRandomNonPhysicalFilesByDefault
273,217
void () { GlobalSearchScope scope = GlobalSearchScope.EMPTY_SCOPE.uniteWith(GlobalSearchScope.EMPTY_SCOPE); assertEquals(GlobalSearchScope.EMPTY_SCOPE, scope); GlobalSearchScope scope2 = GlobalSearchScope.union(new GlobalSearchScope[]{GlobalSearchScope.EMPTY_SCOPE, GlobalSearchScope.EMPTY_SCOPE}); assertEquals(GlobalSe...
testUnionWithEmptyAndUnion
273,218
void () { assertEquals("a\\.[^\\.]*", FilePatternPackageSet.convertToRegexp("a.*", '.')); assertEquals("a\\.(.*\\.)?[^\\.]*", FilePatternPackageSet.convertToRegexp("a..*", '.')); assertEquals("a\\/[^\\/]*", FilePatternPackageSet.convertToRegexp("a/*", '/')); assertEquals("a\\/.*\\.css", FilePatternPackageSet.convertToR...
testConvertToRegexp
273,219
void () { myStrategy = new StaticTextWhiteSpaceDefinitionStrategy("abc"); }
setUp
273,220
void () { assertSame(0, myStrategy.check(" abc", 0, 4)); assertSame(1, myStrategy.check(" abc", 1, 3)); }
notAtFirstPosition
273,221
void () { assertSame(3, myStrategy.check("abc", 0, 3)); assertSame(4, myStrategy.check(" abcde", 1, 5)); }
match
273,222
void () { assertSame(0, myStrategy.check("abc", 0, 2)); assertSame(1, myStrategy.check(" abc", 1, 3)); }
withoutEnd
273,223
void () { myStrategy = new StaticSymbolWhiteSpaceDefinitionStrategy('a', 'b', 'c'); }
setUp
273,224
void () { assertSame(0, myStrategy.check("def", 0, 2)); assertSame(1, myStrategy.check("defghi", 1, 2)); }
failOnTheFirstSymbol
273,225
void () { assertSame(1, myStrategy.check("adef", 0, 3)); assertSame(2, myStrategy.check("daefghi", 1, 3)); }
failInTheMiddle
273,226
void () { assertSame(2, myStrategy.check("abe", 0, 3)); assertSame(3, myStrategy.check("dabefghi", 1, 4)); }
failOnTheLastSymbol
273,227
void () { assertSame(3, myStrategy.check("abc", 0, 3)); assertSame(4, myStrategy.check("dabcefg", 1, 4)); }
successfulMatch
273,228
void (int indentExpected, int timesUsedExpected) { IndentUsageInfo maxIndentExpected = new IndentUsageInfo(indentExpected, timesUsedExpected); IndentUsageInfo indentInfo = getMaxUsedIndentInfo(); Assert.assertEquals("Indent size mismatch", maxIndentExpected.getIndentSize(), indentInfo.getIndentSize()); Assert.assertEqu...
doTestMaxUsedIndent
273,229
void (int indentExpected) { IndentUsageInfo indentInfo = getMaxUsedIndentInfo(); Assert.assertEquals("Indent size mismatch", indentExpected, indentInfo.getIndentSize()); }
doTestMaxUsedIndent
273,230
void () { doTestTabsUsed(null); }
doTestTabsUsed
273,231
void (int expectedIndent) { configureByFile(getFileNameWithExtension()); doTestIndentSize(null, expectedIndent); }
doTestIndentSize
273,232
void (String text, @Nullable CommonCodeStyleSettings.IndentOptions options, int expectedIndent) { configureFromFileText(getFileNameWithExtension(), text); doTestIndentSize(options, expectedIndent); }
doTestIndentSizeFromText
273,233
void (@Nullable CommonCodeStyleSettings.IndentOptions defaultIndentOptions) { configureByFile(getFileNameWithExtension()); if (defaultIndentOptions != null) { setIndentOptions(defaultIndentOptions); } CommonCodeStyleSettings.IndentOptions options = detectIndentOptions(getVFile(), getEditor().getDocument()); Assert.asse...
doTestTabsUsed
273,234
void (@Nullable CommonCodeStyleSettings.IndentOptions defaultIndentOptions, int expectedIndent) { if (defaultIndentOptions != null) { setIndentOptions(defaultIndentOptions); } CommonCodeStyleSettings.IndentOptions options = detectIndentOptions(getVFile(), getEditor().getDocument()); Assert.assertFalse("Tab usage detect...
doTestIndentSize
273,235
void (@NotNull CommonCodeStyleSettings.IndentOptions defaultIndentOptions) { CodeStyleSettings settings = CodeStyle.getSettings(getProject()); CommonCodeStyleSettings.IndentOptions indentOptions = settings.getIndentOptions(getFile().getFileType()); indentOptions.copyFrom(defaultIndentOptions); }
setIndentOptions
273,236
IndentUsageInfo () { configureByFile(getFileNameWithExtension()); Document document = getDocument(getFile()); FormattingModelBuilder builder = LanguageFormatting.INSTANCE.forContext(getFile()); Assert.assertNotNull(builder); FormattingModel model = builder.createModel(FormattingContext.create(getFile(), CodeStyle.getSe...
getMaxUsedIndentInfo
273,237
PsiDocumentManagerImpl () { return (PsiDocumentManagerImpl)PsiDocumentManager.getInstance(getProject()); }
getPsiDocumentManager
273,238
void () { final PsiFile file = getPsiDocumentManager().getCachedPsiFile(new MockDocument()); assertNull(file); }
testGetCachedPsiFile_NoFile
273,239
void () { final PsiFile file = getPsiDocumentManager().getPsiFile(new MockDocument()); assertNull(file); }
testGetPsiFile_NotRegisteredDocument
273,240
void () { VirtualFile vFile = createFile(); final PsiFile file = new MockPsiFile(vFile, getPsiManager()); final Document document = getDocument(file); assertNotNull(document); assertSame(document, FileDocumentManager.getInstance().getDocument(vFile)); }
testGetDocument_FirstGet
273,241
LightVirtualFile () { return new LightVirtualFile("foo.txt"); }
createFile
273,242
PsiFile (@NotNull VirtualFile vFile) { return getPsiManager().findFile(vFile); }
findFile
273,243
void () { assertEquals(0, getPsiDocumentManager().getUncommittedDocuments().length); }
testGetUncommittedDocuments_noDocuments
273,244
void () { final PsiFile file = findFile(createFile()); final Document document = getDocument(file); WriteCommandAction.runWriteCommandAction(null, () -> PsiToDocumentSynchronizer .performAtomically(file, () -> changeDocument(document, getPsiDocumentManager()))); assertEquals(0, getPsiDocumentManager().getUncommittedDoc...
testGetUncommittedDocuments_documentChanged_DontProcessEvents
273,245
void () { final Document document = new MockDocument(); WriteCommandAction.runWriteCommandAction(null, () -> changeDocument(document, getPsiDocumentManager())); assertEquals(0, getPsiDocumentManager().getUncommittedDocuments().length); }
testGetUncommittedDocuments_documentNotRegistered
273,246
void () { PsiFile file = findFile(createFile()); final Document document = getDocument(file); WriteCommandAction.runWriteCommandAction(null, () -> changeDocument(document, getPsiDocumentManager())); getPsiDocumentManager().commitDocument(document); assertEquals(0, getPsiDocumentManager().getUncommittedDocuments().lengt...
testCommitDocument_RemovesFromUncommittedList
273,247
Document (PsiFile file) { return getPsiDocumentManager().getDocument(file); }
getDocument
273,248
void (Document document, PsiDocumentManagerImpl manager) { DocumentEventImpl event = new DocumentEventImpl(document, 0, "", "", document.getModificationStamp(), false, 0, 0, 0); manager.beforeDocumentChange(event); manager.documentChanged(event); }
changeDocument
273,249
void () { PsiFile file = findFile(createFile()); final Document document = getDocument(file); WriteCommandAction.runWriteCommandAction(null, () -> changeDocument(document, getPsiDocumentManager())); getPsiDocumentManager().commitAllDocuments(); assertEquals(0, getPsiDocumentManager().getUncommittedDocuments().length); ...
testCommitAllDocument_RemovesFromUncommittedList
273,250
void () { PsiFile file = findFile(createFile()); assertNotNull(file); assertTrue(file.isPhysical()); final Document document = getDocument(file); assertNotNull(document); final Semaphore semaphore = new Semaphore(); semaphore.down(); getPsiDocumentManager().performWhenAllCommitted(() -> { assertTrue(getPsiDocumentManag...
testCommitInBackground
273,251
void (Semaphore semaphore) { TestTimeOut t = TestTimeOut.setTimeout(TIMEOUT_MS, TimeUnit.MILLISECONDS); while (!t.timedOut()) { if (semaphore.waitFor(1)) return; UIUtil.dispatchAllInvocationEvents(); } fail("Timeout"); }
waitAndPump
273,252
void (VirtualFile vFile, PsiFile psiFile, Document document) { assertNull(FileDocumentManager.getInstance().getDocument(vFile)); assertNull(FileDocumentManager.getInstance().getFile(document)); assertNull(getPsiDocumentManager().getPsiFile(document)); assertNull(getDocument(psiFile)); }
assertNoFileDocumentMapping
273,253
JComponent () { return null; }
createCenterPanel
273,254
JComponent () { return null; }
createCenterPanel
273,255
void () { try { DocumentCommitThread.getInstance().waitForAllCommits(100, TimeUnit.SECONDS); } catch (ExecutionException | InterruptedException | TimeoutException e) { throw new RuntimeException(e); } }
waitForCommits
273,256
void () { PsiFile file = findFile(createFile()); assertNotNull(file); assertTrue(file.isPhysical()); final Document document = getDocument(file); assertNotNull(document); WriteCommandAction.runWriteCommandAction(null, () -> document.insertString(0, "class X {}")); getPsiDocumentManager().performWhenAllCommitted(() -> {...
testPerformWhenAllCommittedMustNotNest
273,257
void () { Document document = createFreeThreadedDocument(); document.addDocumentListener(new PrioritizedDocumentListener() { @Override public int getPriority() { return 0; } @Override public void beforeDocumentChange(@NotNull DocumentEvent event) { throw new ProcessCanceledException(); } }); try { document.insertString...
testNoLeaksAfterPCEInListener
273,258
int () { return 0; }
getPriority
273,259
void (@NotNull DocumentEvent event) { throw new ProcessCanceledException(); }
beforeDocumentChange
273,260
Document () { PsiFile file = PsiFileFactory.getInstance(myProject).createFileFromText("a.txt", PlainTextFileType.INSTANCE, ""); return file.getViewProvider().getDocument(); }
createFreeThreadedDocument
273,261
void (@NotNull String content, @NotNull VirtualFile vFile, @NotNull Document document) { Charset charset = EncodingProjectManager.getInstance(getProject()).getEncoding(vFile, false); float bytesPerChar = charset == null ? 2 : charset.newEncoder().averageBytesPerChar(); int contentSize = (int)(FileUtilRt.LARGE_FILE_PREV...
assertLargeFileContentLimited
273,262
String () { return StringUtil.repeat("a", FileUtilRt.LARGE_FOR_CONTENT_LOADING + 1); }
getTooLargeContent
273,263
void () { Assume.assumeTrue("This test must have JavaFileType in its classpath", FileTypeManager.getInstance().findFileTypeByName("JAVA") != null); }
assumeJavaInClassPath
273,264
void () { NonBlockingReadActionImpl.waitForAsyncTaskCompletion(); PsiFileFactory factory = PsiFileFactory.getInstance(getProject()); List<PsiFile> files = new ArrayList<>(); for (int i = 0; i < 90; i++) { files.add(factory.createFileFromText("a.xml", XMLLanguage.INSTANCE, "<a><b><c/></b></a>", false, false)); } AtomicI...
testNonPhysicalDocumentCommitsDoNotInterruptBackgroundTasks
273,265
void () { ExecutorService executor = AppExecutorUtil.createBoundedApplicationPoolExecutor(getTestName(false), 10); PsiFile mainFile = findFile(createFile()); Document mainDoc = getDocument(mainFile); PsiFileFactory factory = PsiFileFactory.getInstance(getProject()); List<Future<?>> futures = new ArrayList<>(); for (int...
testPerformWhenAllCommittedDoesNotRaceWithBackgroundLightCommitsResultingInExceptions
273,266
void () { PsiFile file = findFile(createFile()); Document document = getDocument(file); AtomicBoolean called = new AtomicBoolean(true); getProject().getMessageBus().connect(getTestRootDisposable()).subscribe(PsiManagerImpl.ANY_PSI_CHANGE_TOPIC, new AnyPsiChangeListener() { @Override public void afterPsiChanged(boolean ...
testDocumentIsUncommittedInsidePsiListener
273,267
void (boolean isPhysical) { called.set(true); assertFalse(getPsiDocumentManager().isCommitted(document)); assertTrue(getPsiDocumentManager().isUncommited(document)); assertSameElements(getPsiDocumentManager().getUncommittedDocuments(), document); }
afterPsiChanged
273,268
void () { Document ftDocument = createFreeThreadedDocument(); CompletableFuture<Boolean> called = new CompletableFuture<>(); WriteCommandAction.runWriteCommandAction(myProject, () -> { ftDocument.insertString(0, " "); getPsiDocumentManager().performWhenAllCommitted(() -> called.complete(true)); }); assertTrue(PlatformT...
test_performWhenAllCommitted_works_eventually_despite_nonPhysical_uncommitted
273,269
void () { Document ftDocument = createFreeThreadedDocument(); CompletableFuture<Boolean> called = new CompletableFuture<>(); WriteCommandAction.runWriteCommandAction(myProject, () -> { ftDocument.insertString(0, " "); getPsiDocumentManager().performLaterWhenAllCommitted(() -> called.complete(true)); }); assertTrue(Plat...
test_performLaterWhenAllCommitted_works_eventually_despite_nonPhysical_uncommitted
273,270
void () { Document ftDocument = createFreeThreadedDocument(); CompletableFuture<Boolean> called = new CompletableFuture<>(); WriteCommandAction.runWriteCommandAction(myProject, () -> { ftDocument.insertString(0, " "); AppUIExecutor.onUiThread().withDocumentsCommitted(myProject).submit(() -> called.complete(true)); }); ...
test_AppUIExecutor_withDocumentsCommitted_works_eventually_despite_nonPhysical_uncommitted
273,271
void () { Document document = getDocument(findFile(createFile())); CompletableFuture<Boolean> called = new CompletableFuture<>(); WriteCommandAction.runWriteCommandAction(myProject, () -> { document.insertString(0, " "); ApplicationManager.getApplication().invokeLater(() -> { LaterInvocator.enterModal(this); assertFals...
test_performWhenAllCommitted_may_be_invoked_from_writeUnsafe_modality
273,272
void () { Document document = getDocument(findFile(createFile())); WriteCommandAction.runWriteCommandAction(myProject, () -> document.insertString(0, " ")); ProgressManager.getInstance().run(new Task.Modal(myProject, "", true) { @Override public void run(@NotNull ProgressIndicator indicator) { assertFalse(getPsiDocumen...
test_commitAndRunReadAction_commits_documents_in_needed_modality
273,273
void (@NotNull ProgressIndicator indicator) { assertFalse(getPsiDocumentManager().isCommitted(document)); getPsiDocumentManager().commitAndRunReadAction(() -> assertTrue(getPsiDocumentManager().isCommitted(document))); }
run
273,274
void () { assertEquals(-1, doTest("n", "\\n")); }
testBackslashBeforeSequence
273,275
void () { assertEquals(2, doTest("n", "\\\\n")); }
testEscapedBackslashBeforeSequence
273,276
void () { assertEquals(-1, doTest("n", "\\\\\\n")); }
testTwoBackslashesBeforeSequence
273,277
void () { assertEquals(2, doTest("n", "\\nn")); }
testBackslashNBeforeSequence
273,278
void () { assertEquals(-1, doTest("n", "%d\\n")); }
testBackslashBeforeSequenceNotBeginning
273,279
int (String pattern, String text) { StringSearcher searcher = new StringSearcher(pattern, true, true, true); final int[] index = {-1}; LowLevelSearchUtil.processTexts(text, 0, text.length(), searcher, value -> { index[0] = value; return false; }); return index[0]; }
doTest
273,280
void () { StringSearcher searcher = new StringSearcher("xxx", true, true); IntList found = new IntArrayList(new int[]{-1}); CharSequence text = StringUtil.repeat("xxx z ", 1000000); PlatformTestUtil.startPerformanceTest("processTextOccurrences", 100, ()-> { for (int i=0; i<10000; i++) { found.removeInt(0); int startOff...
testProcessTextOccurrencesNeverScansBeyondStartEndOffsetIfNeverAskedTo
273,281
void () { T1 = new IElementType("T1", Language.ANY); T2 = new IElementType("T2", Language.ANY); fakeElements(1, 128); T3 = new IElementType("T3", Language.ANY); T4 = new IElementType("T4", Language.ANY); fakeElements(201, 204); T5 = new IElementType("T5", Language.ANY); T6 = new IElementType("T6", Language.ANY); }
setUp
273,282
void () { S1 = TokenSet.create(T1); S12 = TokenSet.create(T1, T2); S3 = TokenSet.create(T3); S34 = TokenSet.create(T3, T4); S5 = TokenSet.create(T5); }
isetup
273,283
void () { check(S1, T1); check(S12, T1, T2); check(S3, T3); check(S34, T3, T4); }
create
273,284
void () { assertArrayEquals(IElementType.EMPTY_ARRAY, TokenSet.EMPTY.getTypes()); assertArrayEquals(new IElementType[]{T1, T2}, S12.getTypes()); assertArrayEquals(new IElementType[]{T3, T4}, S34.getTypes()); assertEquals("[]", TokenSet.EMPTY.toString()); assertEquals("[T1, T2]", S12.toString()); assertEquals("[T3, T4]"...
getTypes
273,285
void () { check(TokenSet.orSet(S1, S12, S3), T1, T2, T3); check(TokenSet.orSet(S1, S3), T1, T3); }
orSet
273,286
void () { check(TokenSet.andSet(S1, S12), T1); check(TokenSet.andSet(S12, S34)); }
andSet
273,287
void () { final TokenSet S123 = TokenSet.orSet(S12, S3); check(TokenSet.andNot(S123, S12), T3); check(TokenSet.andNot(S123, S5), T1, T2, T3); }
andNot
273,288
void (int from, int to) { for (int i = from; i <= to; i++) { new IElementType("Test element #" + i, Language.ANY); } }
fakeElements
273,289
void (@NotNull TokenSet set, IElementType @NotNull ... elements) { final Set<IElementType> expected = ContainerUtil.newHashSet(elements); for (IElementType t : Arrays.asList(T1, T2, T3, T4, T5, T6)) { if (expected.contains(t)) { assertTrue("missed: " + t, set.contains(t)); } else { assertFalse("unexpected: " + t, set.c...
check
273,290
void () { final IElementType[] elementTypes = IElementType.enumerate(IElementType.TRUE); final TokenSet set = TokenSet.create(); final int shift = new Random().nextInt(500000); PlatformTestUtil.startPerformanceTest("TokenSet.contains()", 25, () -> { for (int i = 0; i < 1000000; i++) { final IElementType next = elementT...
performance
273,291
void () { SplittableRandom random = new SplittableRandom(1); String[] data = Stream.generate(() -> { StringBuilder sb = new StringBuilder(); random.ints(random.nextInt(5, 25), 'a', 'z') .map(ch -> random.nextInt(100) == 0 ? "0123456789$_@%вгдежзиклмно".charAt(ch - 'a') : random.nextInt(6) == 0 ? Character.toUpperCase(c...
testStability
273,292
void () { TypoTolerantMatcher matcher = new TypoTolerantMatcher("*", NameUtil.MatchingCaseSensitivity.NONE, ""); String[] data = new String[]{"foo", "bar", "buzz"}; List<String> matched = ContainerUtil.filter(data, matcher::matches); List<String> expected = List.of("foo", "bar", "buzz"); assertEquals(expected, matched)...
testEmptyPattern
273,293
String (String varName, String input) { StringBuilder result = new StringBuilder(varName + " =\n\""); int curLineLength = 0; for (int i = 0; i < input.length(); i++) { char ch = input.charAt(i); String charRepresentation; if (ch == '"' || ch == '\\') { charRepresentation = "\\" + ch; } else if (ch < 127) { charRepresen...
toJavaStringLiteral
273,294
String (List<Mapping> mappings, List<String> initials) { Map<String, Character> encoding = initials.stream() .collect(Collectors.toMap(s -> s, s -> (char)(PinyinMatcher.BASE_CHAR + initials.indexOf(s)))); Map<Integer, Character> map = mappings.stream() .collect(Collectors.toMap(mapping -> mapping.codePoint, m -> encodi...
getDataString
273,295
List<String> (List<Mapping> mappings) { return mappings.stream().map(Mapping::charString).distinct() .sorted(Comparator.comparing(String::length).thenComparing(Comparator.naturalOrder())) .collect(Collectors.toList()); }
generateInitials
273,296
record (int codePoint, long chars) { String charString() { return BitSet.valueOf(new long[]{chars}).stream().mapToObj(bit -> Character.toString((char)(bit + 'a'))) .collect(Collectors.joining()); } static Mapping merge(Mapping m1, Mapping m2) { if (m1.codePoint != m2.codePoint) throw new IllegalArgumentException(); ret...
Mapping
273,297
Mapping (Mapping m1, Mapping m2) { if (m1.codePoint != m2.codePoint) throw new IllegalArgumentException(); return new Mapping(m1.codePoint, m1.chars | m2.chars); }
merge
273,298
Mapping (String line) { if (line.startsWith("#")) return null; String[] parts = line.split("\\s+"); if (parts.length != 3) return null; if (!parts[0].startsWith("U+")) return null; int codePoint = Integer.parseInt(parts[0].substring(2), 16); if (codePoint < PinyinMatcher.BASE_CODE_POINT) return null; // Codepoints outs...
parseUniHan
273,299
String () { return String.format("%04X: %s", codePoint, charString()); }
toString