Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
288,000
boolean (final @Nullable Object o, final ProcessingContext context) { return o == null; }
accepts
288,001
Self () { //noinspection Convert2Diamond (would break compilation: IDEA-168317) return adapt(new ElementPatternCondition<T>(new InitialPatternCondition(Object.class) { @Override public boolean accepts(final @Nullable Object o, final ProcessingContext context) { return o != null; } })); }
notNull
288,002
boolean (final @Nullable Object o, final ProcessingContext context) { return o != null; }
accepts
288,003
Self (@NotNull Key<? super T> key) { return with(new PatternCondition<T>("save") { @Override public boolean accepts(final @NotNull T t, final ProcessingContext context) { context.put(key, t); return true; } }); }
save
288,004
boolean (final @NotNull T t, final ProcessingContext context) { context.put(key, t); return true; }
accepts
288,005
Self (final @NonNls String key) { return with(new PatternCondition<T>("save") { @Override public boolean accepts(final @NotNull T t, final ProcessingContext context) { context.put(key, t); return true; } }); }
save
288,006
boolean (final @NotNull T t, final ProcessingContext context) { context.put(key, t); return true; }
accepts
288,007
Self (@NotNull PatternCondition<? super T> pattern) { final ElementPatternCondition<T> condition = getCondition().append(pattern); return adapt(condition); }
with
288,008
Self (@NotNull ElementPatternCondition<T> condition) { try { final ObjectPattern s = (ObjectPattern)clone(); s.myInitialCondition = condition.getInitialCondition(); List<PatternCondition<? super T>> conditions = condition.getConditions(); s.myConditions = conditions.isEmpty() ? null : conditions.size() == 1 ? conditions.get(0) : conditions; //noinspection unchecked return (Self)s; } catch (CloneNotSupportedException e) { throw new RuntimeException(e); } }
adapt
288,009
Self (final PatternCondition<? super T> pattern) { return with(new PatternCondition<T>("without") { @Override public boolean accepts(final @NotNull T o, final ProcessingContext context) { return !pattern.accepts(o, context); } }); }
without
288,010
boolean (final @NotNull T o, final ProcessingContext context) { return !pattern.accepts(o, context); }
accepts
288,011
String () { return getCondition().toString(); }
toString
288,012
String[] () { return myValues; }
getValues
288,013
boolean (final @NotNull String str, final ProcessingContext context) { for (final String value : myValues) { if (str.equalsIgnoreCase(value)) return true; } return false; }
accepts
288,014
Self (final StringPattern namePattern) { return with(new PatternCondition<T>("withParentDirectoryName") { @Override public boolean accepts(final @NotNull T t, final ProcessingContext context) { PsiDirectory directory = t.getContainingDirectory(); return directory != null && namePattern.accepts(directory.getName(), context); } }); }
withParentDirectoryName
288,015
boolean (final @NotNull T t, final ProcessingContext context) { PsiDirectory directory = t.getContainingDirectory(); return directory != null && namePattern.accepts(directory.getName(), context); }
accepts
288,016
Self (final ElementPattern<? extends T> filePattern) { return with(new PatternCondition<T>("withOriginalFile") { @Override public boolean accepts(@NotNull T file, ProcessingContext context) { return filePattern.accepts(file.getOriginalFile()); } }); }
withOriginalFile
288,017
boolean (@NotNull T file, ProcessingContext context) { return filePattern.accepts(file.getOriginalFile()); }
accepts
288,018
Self (final ElementPattern<? extends VirtualFile> vFilePattern) { return with(new PatternCondition<T>("withVirtualFile") { @Override public boolean accepts(@NotNull T file, ProcessingContext context) { return vFilePattern.accepts(file.getVirtualFile(), context); } }); }
withVirtualFile
288,019
boolean (@NotNull T file, ProcessingContext context) { return vFilePattern.accepts(file.getVirtualFile(), context); }
accepts
288,020
Self (final ElementPattern<? extends FileType> fileTypePattern) { return with(new PatternCondition<T>("withFileType") { @Override public boolean accepts(@NotNull T file, ProcessingContext context) { return fileTypePattern.accepts(file.getFileType(), context); } }); }
withFileType
288,021
boolean (@NotNull T file, ProcessingContext context) { return fileTypePattern.accepts(file.getFileType(), context); }
accepts
288,022
Class<T> () { return myAcceptedClass; }
getAcceptedClass
288,023
boolean (@Nullable Object o, final ProcessingContext context) { return myAcceptedClass.isInstance(o); }
accepts
288,024
void (@NonNls @NotNull StringBuilder builder, final String indent) { builder.append("instanceOf(").append(myAcceptedClass.getSimpleName()).append(")"); }
append
288,025
Self (final Class<? extends ParentType> @NotNull ... types) { return with(new PatternCondition<T>("withParents") { @Override public boolean accepts(@NotNull T t, ProcessingContext context) { ParentType current = getParent(t); for (Class<? extends ParentType> type : types) { if (current == null || !type.isInstance(current)) { return false; } current = getParent(current); } return true; } }); }
withParents
288,026
boolean (@NotNull T t, ProcessingContext context) { ParentType current = getParent(t); for (Class<? extends ParentType> type : types) { if (current == null || !type.isInstance(current)) { return false; } current = getParent(current); } return true; }
accepts
288,027
Self (final @NotNull Class<? extends ParentType> type) { return withParent(StandardPatterns.instanceOf(type)); }
withParent
288,028
Self (final @NotNull ElementPattern<? extends ParentType> pattern) { return withSuperParent(1, pattern); }
withParent
288,029
Self (final @NotNull ElementPattern<? extends ParentType> pattern) { return withChildren(StandardPatterns.<ParentType>collection().atLeastOne(pattern)); }
withChild
288,030
Self (final @NotNull ElementPattern<? extends ParentType> pattern) { return withChildren(StandardPatterns.<ParentType>collection().first(pattern)); }
withFirstChild
288,031
Self (final @NotNull ElementPattern<? extends ParentType> pattern) { return withChildren(StandardPatterns.<ParentType>collection().last(pattern)); }
withLastChild
288,032
Self (final @NotNull ElementPattern<Collection<ParentType>> pattern) { return with(new PatternConditionPlus<T, Collection<ParentType>>("withChildren", pattern) { @Override public boolean processValues(T t, ProcessingContext context, PairProcessor<? super Collection<ParentType>, ? super ProcessingContext> processor) { return processor.process(Arrays.asList(getChildren(t)), context); } }); }
withChildren
288,033
boolean (T t, ProcessingContext context, PairProcessor<? super Collection<ParentType>, ? super ProcessingContext> processor) { return processor.process(Arrays.asList(getChildren(t)), context); }
processValues
288,034
Self (final @NotNull ElementPattern<? super ParentType> pattern) { return with(new PatternCondition<T>("isFirstAcceptedChild") { @Override public boolean accepts(final @NotNull T t, final ProcessingContext context) { final ParentType parent = getParent(t); if (parent != null) { final ParentType[] children = getChildren(parent); for (ParentType child : children) { if (pattern.accepts(child, context)) { return child == t; } } } return false; } }); }
isFirstAcceptedChild
288,035
boolean (final @NotNull T t, final ProcessingContext context) { final ParentType parent = getParent(t); if (parent != null) { final ParentType[] children = getChildren(parent); for (ParentType child : children) { if (pattern.accepts(child, context)) { return child == t; } } } return false; }
accepts
288,036
Self (final int level, final @NotNull Class<? extends ParentType> aClass) { return withSuperParent(level, StandardPatterns.instanceOf(aClass)); }
withSuperParent
288,037
Self (final int level, final @NotNull ElementPattern<? extends ParentType> pattern) { return with(new PatternConditionPlus<T, ParentType>(level == 1 ? "withParent" : "withSuperParent", pattern) { @Override public boolean processValues(T t, ProcessingContext context, PairProcessor<? super ParentType, ? super ProcessingContext> processor) { ParentType parent = t; for (int i = 0; i < level; i++) { if (parent == null) return true; parent = getParent(parent); } return processor.process(parent, context); } }); }
withSuperParent
288,038
boolean (T t, ProcessingContext context, PairProcessor<? super ParentType, ? super ProcessingContext> processor) { ParentType parent = t; for (int i = 0; i < level; i++) { if (parent == null) return true; parent = getParent(parent); } return processor.process(parent, context); }
processValues
288,039
Self (final @NotNull Class<? extends ParentType> pattern) { return inside(StandardPatterns.instanceOf(pattern)); }
inside
288,040
Self (final @NotNull ElementPattern<? extends ParentType> pattern) { return inside(false, pattern); }
inside
288,041
Self (final boolean strict, final @NotNull ElementPattern<? extends ParentType> pattern) { return with(new PatternConditionPlus<T, ParentType>("inside", pattern) { @Override public boolean processValues(T t, ProcessingContext context, PairProcessor<? super ParentType, ? super ProcessingContext> processor) { ParentType element = strict ? getParent(t) : t; while (element != null) { if (!processor.process(element, context)) return false; element = getParent(element); } return true; } }); }
inside
288,042
boolean (T t, ProcessingContext context, PairProcessor<? super ParentType, ? super ProcessingContext> processor) { ParentType element = strict ? getParent(t) : t; while (element != null) { if (!processor.process(element, context)) return false; element = getParent(element); } return true; }
processValues
288,043
Self (final int levelsUp, final @NotNull ElementPattern<? extends ParentType> pattern) { return with(new PatternCondition<T>("withAncestor") { @Override public boolean accepts(@NotNull T t, ProcessingContext context) { ParentType element = t; for (int i=0; i<levelsUp+1;i++) { if (pattern.accepts(element, context)) return true; element = getParent(element); if (element == null) break; } return false; } }); }
withAncestor
288,044
boolean (@NotNull T t, ProcessingContext context) { ParentType element = t; for (int i=0; i<levelsUp+1;i++) { if (pattern.accepts(element, context)) return true; element = getParent(element); if (element == null) break; } return false; }
accepts
288,045
Self (final boolean strict, final @NotNull ElementPattern<? extends ParentType> pattern, final @NotNull ElementPattern<? extends ParentType> stopAt) { return with(new PatternCondition<T>("inside") { @Override public boolean accepts(@NotNull T t, ProcessingContext context) { ParentType element = strict ? getParent(t) : t; while (element != null) { if (stopAt.accepts(element, context)) return false; if (pattern.accepts(element, context)) return true; element = getParent(element); } return false; } }); }
inside
288,046
boolean (@NotNull T t, ProcessingContext context) { ParentType element = strict ? getParent(t) : t; while (element != null) { if (stopAt.accepts(element, context)) return false; if (pattern.accepts(element, context)) return true; element = getParent(element); } return false; }
accepts
288,047
Self (final boolean strict, final ElementPattern<? extends ParentType> @NotNull ... patterns) { return with(new PatternCondition<T>("insideSequence") { @Override public boolean accepts(final @NotNull T t, final ProcessingContext context) { int i = 0; ParentType element = strict ? getParent(t) : t; while (element != null && i < patterns.length) { for (int j = i; j < patterns.length; j++) { if (patterns[j].accepts(element, context)) { if (i != j) return false; i++; break; } } element = getParent(element); } return true; } }); }
insideSequence
288,048
boolean (final @NotNull T t, final ProcessingContext context) { int i = 0; ParentType element = strict ? getParent(t) : t; while (element != null && i < patterns.length) { for (int j = i; j < patterns.length; j++) { if (patterns[j].accepts(element, context)) { if (i != j) return false; i++; break; } } element = getParent(element); } return true; }
accepts
288,049
Self (final ElementPattern<? extends ParentType> pattern) { return with(new PatternCondition<T>("afterSibling") { @Override public boolean accepts(@NotNull T t, ProcessingContext context) { final ParentType parent = getParent(t); if (parent == null) return false; final ParentType[] children = getChildren(parent); final int i = Arrays.asList(children).indexOf(t); if (i <= 0) return false; return pattern.accepts(children[i - 1], context); } }); }
afterSibling
288,050
boolean (@NotNull T t, ProcessingContext context) { final ParentType parent = getParent(t); if (parent == null) return false; final ParentType[] children = getChildren(parent); final int i = Arrays.asList(children).indexOf(t); if (i <= 0) return false; return pattern.accepts(children[i - 1], context); }
accepts
288,051
Self (final @NotNull ElementPattern skip, final ElementPattern<? extends ParentType> pattern) { return with(new PatternCondition<T>("afterSiblingSkipping") { @Override public boolean accepts(@NotNull T t, ProcessingContext context) { final ParentType parent = getParent(t); if (parent == null) return false; final ParentType[] children = getChildren(parent); int i = Arrays.asList(children).indexOf(t); while (--i >= 0) { if (!skip.accepts(children[i], context)) { return pattern.accepts(children[i], context); } } return false; } }); }
afterSiblingSkipping
288,052
boolean (@NotNull T t, ProcessingContext context) { final ParentType parent = getParent(t); if (parent == null) return false; final ParentType[] children = getChildren(parent); int i = Arrays.asList(children).indexOf(t); while (--i >= 0) { if (!skip.accepts(children[i], context)) { return pattern.accepts(children[i], context); } } return false; }
accepts
288,053
PsiElement[] (final @NotNull PsiElement element) { return element.getChildren(); }
getChildren
288,054
PsiElement (final @NotNull PsiElement element) { if (element instanceof PsiFile && InjectedLanguageManager.getInstance(element.getProject()).isInjectedFragment((PsiFile)element)) { return element.getParent(); } return element.getContext(); }
getParent
288,055
Self (IElementType type) { return withElementType(PlatformPatterns.elementType().equalTo(type)); }
withElementType
288,056
Self (TokenSet type) { return withElementType(PlatformPatterns.elementType().tokenSet(type)); }
withElementType
288,057
Self (final @NlsSafe String @NotNull ... withText) { return afterLeaf(psiElement().withText(StandardPatterns.string().oneOf(withText))); }
afterLeaf
288,058
Self (final @NotNull ElementPattern<? extends PsiElement> pattern) { return afterLeafSkipping(psiElement().whitespaceCommentEmptyOrError(), pattern); }
afterLeaf
288,059
Self (final @NlsSafe String @NotNull ... withText) { return beforeLeaf(psiElement().withText(StandardPatterns.string().oneOf(withText))); }
beforeLeaf
288,060
Self (final @NotNull ElementPattern<? extends PsiElement> pattern) { return beforeLeafSkipping(psiElement().whitespaceCommentEmptyOrError(), pattern); }
beforeLeaf
288,061
Self () { return withElementType(TokenType.WHITE_SPACE); }
whitespace
288,062
Self () { return andOr(psiElement().whitespace(), psiElement(PsiComment.class), psiElement(PsiErrorElement.class)); }
whitespaceCommentOrError
288,063
Self () { return andOr(psiElement().whitespace(), psiElement(PsiComment.class), psiElement(PsiErrorElement.class), psiElement().withText("")); }
whitespaceCommentEmptyOrError
288,064
Self (final @NotNull ElementPattern<? extends PsiElement> pattern) { return withChildren(collection(PsiElement.class).filter(not(psiElement().whitespace()), collection(PsiElement.class).first(pattern))); }
withFirstNonWhitespaceChild
288,065
Self (final Class<? extends PsiReference> referenceClass) { return with(new PatternCondition<T>("withReference") { @Override public boolean accepts(final @NotNull T t, final ProcessingContext context) { for (final PsiReference reference : t.getReferences()) { if (referenceClass.isInstance(reference)) { return true; } } return false; } }); }
withReference
288,066
boolean (final @NotNull T t, final ProcessingContext context) { for (final PsiReference reference : t.getReferences()) { if (referenceClass.isInstance(reference)) { return true; } } return false; }
accepts
288,067
Self (final @NotNull ElementPattern<? extends PsiFile> filePattern) { return with(new PatternCondition<T>("inFile") { @Override public boolean accepts(final @NotNull T t, final ProcessingContext context) { return filePattern.accepts(t.getContainingFile(), context); } }); }
inFile
288,068
boolean (final @NotNull T t, final ProcessingContext context) { return filePattern.accepts(t.getContainingFile(), context); }
accepts
288,069
Self (final @NotNull ElementPattern<? extends VirtualFile> filePattern) { return with(new PatternCondition<T>("inVirtualFile") { @Override public boolean accepts(final @NotNull T t, final ProcessingContext context) { return filePattern.accepts(t.getContainingFile().getViewProvider().getVirtualFile(), context); } }); }
inVirtualFile
288,070
boolean (final @NotNull T t, final ProcessingContext context) { return filePattern.accepts(t.getContainingFile().getViewProvider().getVirtualFile(), context); }
accepts
288,071
Self (final @NotNull T o) { return with(new PatternCondition<T>("equalTo") { @Override public boolean accepts(final @NotNull T t, final ProcessingContext context) { return t.getManager().areElementsEquivalent(t, o); } }); }
equalTo
288,072
boolean (final @NotNull T t, final ProcessingContext context) { return t.getManager().areElementsEquivalent(t, o); }
accepts
288,073
Self (final ElementPattern<IElementType> pattern) { return with(new PatternCondition<T>("withElementType") { @Override public boolean accepts(final @NotNull T t, final ProcessingContext context) { final ASTNode node = t.getNode(); return node != null && pattern.accepts(node.getElementType()); } }); }
withElementType
288,074
boolean (final @NotNull T t, final ProcessingContext context) { final ASTNode node = t.getNode(); return node != null && pattern.accepts(node.getElementType()); }
accepts
288,075
Self (final @NotNull @NonNls String text) { return withText(StandardPatterns.string().equalTo(text)); }
withText
288,076
Self (final @NotNull String text) { return withoutText(StandardPatterns.string().equalTo(text)); }
withoutText
288,077
Self (final @NotNull @NonNls String name) { return withName(StandardPatterns.string().equalTo(name)); }
withName
288,078
Self (final @NonNls String @NotNull ... names) { return withName(StandardPatterns.string().oneOf(names)); }
withName
288,079
Self (final @NotNull ElementPattern<String> name) { return with(new PsiNamePatternCondition<>("withName", name)); }
withName
288,080
Self (final @NotNull ElementPattern skip, final @NotNull ElementPattern pattern) { return with(new PatternCondition<T>("afterLeafSkipping") { @Override public boolean accepts(@NotNull T t, final ProcessingContext context) { PsiElement element = t; while (true) { element = PsiTreeUtil.prevLeaf(element); if (element != null && element.getTextLength() == 0) { continue; } if (!skip.accepts(element, context)) { return pattern.accepts(element, context); } } } }); }
afterLeafSkipping
288,081
boolean (@NotNull T t, final ProcessingContext context) { PsiElement element = t; while (true) { element = PsiTreeUtil.prevLeaf(element); if (element != null && element.getTextLength() == 0) { continue; } if (!skip.accepts(element, context)) { return pattern.accepts(element, context); } } }
accepts
288,082
Self (final @NotNull ElementPattern skip, final @NotNull ElementPattern pattern) { return with(new PatternCondition<T>("beforeLeafSkipping") { @Override public boolean accepts(@NotNull T t, final ProcessingContext context) { PsiElement element = t; while (true) { element = PsiTreeUtil.nextLeaf(element); if (element != null && element.getTextLength() == 0) { continue; } if (!skip.accepts(element, context)) { return pattern.accepts(element, context); } } } }); }
beforeLeafSkipping
288,083
boolean (@NotNull T t, final ProcessingContext context) { PsiElement element = t; while (true) { element = PsiTreeUtil.nextLeaf(element); if (element != null && element.getTextLength() == 0) { continue; } if (!skip.accepts(element, context)) { return pattern.accepts(element, context); } } }
accepts
288,084
Self (final @NotNull ElementPattern pattern) { return with(new PatternCondition<T>("atStartOf") { @Override public boolean accepts(@NotNull T t, final ProcessingContext context) { PsiElement element = t; while (element != null) { if (pattern.accepts(element, context)) { return element.getTextRange().getStartOffset() == t.getTextRange().getStartOffset(); } element = element.getContext(); } return false; } }); }
atStartOf
288,085
boolean (@NotNull T t, final ProcessingContext context) { PsiElement element = t; while (element != null) { if (pattern.accepts(element, context)) { return element.getTextRange().getStartOffset() == t.getTextRange().getStartOffset(); } element = element.getContext(); } return false; }
accepts
288,086
Self (final @NotNull ElementPattern lengthPattern) { return with(new PatternConditionPlus<T, Integer>("withTextLength", lengthPattern) { @Override public boolean processValues(T t, ProcessingContext context, PairProcessor<? super Integer, ? super ProcessingContext> integerProcessingContextPairProcessor) { return integerProcessingContextPairProcessor.process(t.getTextLength(), context); } }); }
withTextLength
288,087
boolean (T t, ProcessingContext context, PairProcessor<? super Integer, ? super ProcessingContext> integerProcessingContextPairProcessor) { return integerProcessingContextPairProcessor.process(t.getTextLength(), context); }
processValues
288,088
Self () { return withTextLengthLongerThan(0); }
notEmpty
288,089
Self (final int minLength) { return with(new PatternCondition<T>("withTextLengthLongerThan") { @Override public boolean accepts(@NotNull T t, ProcessingContext context) { return t.getTextLength() > minLength; } }); }
withTextLengthLongerThan
288,090
boolean (@NotNull T t, ProcessingContext context) { return t.getTextLength() > minLength; }
accepts
288,091
Self (final @NotNull ElementPattern text) { return with(_withText(text)); }
withText
288,092
PatternCondition<T> (final ElementPattern pattern) { return new PatternConditionPlus<T, String>("_withText", pattern) { @Override public boolean processValues(T t, ProcessingContext context, PairProcessor<? super String, ? super ProcessingContext> processor) { return processor.process(t.getText(), context); } }; }
_withText
288,093
boolean (T t, ProcessingContext context, PairProcessor<? super String, ? super ProcessingContext> processor) { return processor.process(t.getText(), context); }
processValues
288,094
Self (final @NotNull ElementPattern text) { return without(_withText(text)); }
withoutText
288,095
Self (final @NotNull Language language) { return with(new PatternCondition<T>("withLanguage") { @Override public boolean accepts(final @NotNull T t, final ProcessingContext context) { return t.getLanguage().equals(language); } }); }
withLanguage
288,096
boolean (final @NotNull T t, final ProcessingContext context) { return t.getLanguage().equals(language); }
accepts
288,097
Self (final ElementPattern<? extends PsiMetaData> metaDataPattern) { return with(new PatternCondition<T>("withMetaData") { @Override public boolean accepts(final @NotNull T t, final ProcessingContext context) { return t instanceof PsiMetaOwner && metaDataPattern.accepts(((PsiMetaOwner)t).getMetaData(), context); } }); }
withMetaData
288,098
boolean (final @NotNull T t, final ProcessingContext context) { return t instanceof PsiMetaOwner && metaDataPattern.accepts(((PsiMetaOwner)t).getMetaData(), context); }
accepts
288,099
Self (final ElementPattern<? extends PsiElement> targetPattern) { return with(new PatternCondition<T>("referencing") { @Override public boolean accepts(final @NotNull T t, final ProcessingContext context) { final PsiReference[] references = t.getReferences(); for (final PsiReference reference : references) { if (targetPattern.accepts(reference.resolve(), context)) return true; if (reference instanceof PsiPolyVariantReference) { for (final ResolveResult result : ((PsiPolyVariantReference)reference).multiResolve(true)) { if (targetPattern.accepts(result.getElement(), context)) return true; } } } return false; } }); }
referencing