Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
292,900
void (@NotNull String name) { this.name = name; }
setName
292,901
List<MatchResult> () { return Collections.unmodifiableList(myChildren); }
getChildren
292,902
int () { if (!myMultipleMatch) return (getMatch() != null) ? 1 : 0; return myChildren.size(); }
size
292,903
boolean () { return myScopeMatch; }
isScopeMatch
292,904
boolean () { return myMultipleMatch; }
isMultipleMatch
292,905
boolean () { return !myChildren.isEmpty(); }
hasChildren
292,906
void () { myChildren.clear(); }
removeChildren
292,907
MatchResult () { return myChildren.remove(myChildren.size() - 1); }
removeLastChild
292,908
void (final boolean scopeMatch) { myScopeMatch = scopeMatch; }
setScopeMatch
292,909
void (final boolean multipleMatch) { myMultipleMatch = multipleMatch; }
setMultipleMatch
292,910
MatchResultImpl (@NotNull String name) { // @todo this could be performance bottleneck, replace with hash lookup! for (final MatchResult match : myChildren) { final MatchResultImpl res = (MatchResultImpl)match; if (name.equals(res.getName())) { return res; } } return null; }
getChild
292,911
MatchResult (@NotNull String name) { for (MatchResult child : myChildren) { if (name.equals(child.getName())) { return child; } final MatchResult deep = ((MatchResultImpl)child).findChild(name); if (deep != null) { return deep; } } return null; }
findChild
292,912
MatchResult (@NotNull String typedVar) { // @todo this could be performance bottleneck, replace with hash lookup! for (int i = 0, size = myChildren.size(); i < size; i++) { final MatchResult child = myChildren.get(i); if (typedVar.equals(child.getName())) { myChildren.remove(i); return child; } } return null; }
removeChild
292,913
void (@NotNull MatchResult result) { if (result instanceof MatchResultImpl) { ((MatchResultImpl)result).parent = this; } myChildren.add(result); }
addChild
292,914
MatchResult () { if (parent == null) return this; MatchResultImpl root = parent; while (root.parent != null) { root = root.parent; } return root; }
getRoot
292,915
void (@NotNull String matchImage) { this.matchImage = matchImage; }
setMatchImage
292,916
boolean () { return target; }
isTarget
292,917
void (boolean target) { this.target = target; }
setTarget
292,918
int () { return start; }
getStart
292,919
void (int start) { this.start = start; }
setStart
292,920
int () { return end; }
getEnd
292,921
void (int end) { this.end = end; }
setEnd
292,922
String () { return "MatchResultImpl{name='" + name + '\'' + ", matchImage='" + matchImage + '\'' + "}"; }
toString
292,923
void (@NotNull PsiElement element) { targetNode = element; }
setTargetNode
292,924
PsiElement () { return targetNode; }
getTargetNode
292,925
MatchingStrategy () { return strategy; }
getStrategy
292,926
void (MatchingStrategy strategy) { this.strategy = strategy; }
setStrategy
292,927
int () { return nodeCount; }
getNodeCount
292,928
NodeIterator () { return nodes; }
getNodes
292,929
void (@NotNull List<? extends PsiElement> elements) { nodes = new ArrayBackedNodeIterator(PsiUtilCore.toPsiElementArray(elements)); nodeCount = elements.size(); }
setNodes
292,930
boolean (final PsiElement element) { return element != null && isTypedVar(element.getText()); }
isTypedVar
292,931
boolean (PsiElement element) { if (element == null || element.getTextLength() <= 0) { return false; } final String str = getTypedVarString(element); return !str.isEmpty() && isTypedVar(str); }
isRealTypedVar
292,932
String (@NotNull PsiElement element) { final StructuralSearchProfile profile = StructuralSearchUtil.getProfileByPsiElement(element); final String typedVarString = profile == null ? element.getText() : profile.getTypedVarString(element); return typedVarString.trim(); }
getTypedVarString
292,933
MatchingHandler (@NotNull PsiElement node) { return handlers.get(node); }
getHandlerSimple
292,934
MatchingHandler (@NotNull PsiElement node) { if (node == last) { return lastHandler; } MatchingHandler handler = handlers.get(node); if (handler == null) { handler = new SimpleHandler(); setHandler(node, handler); } last = node; lastHandler = handler; return handler; }
getHandler
292,935
MatchingHandler (@NotNull String name) { return handlers.get(name); }
getHandler
292,936
void (@NotNull PsiElement node, @NotNull MatchingHandler handler) { last = null; handlers.put(node, handler); }
setHandler
292,937
SubstitutionHandler (@NotNull String name, @NotNull String compiledName, boolean target, int minOccurs, int maxOccurs, boolean greedy) { SubstitutionHandler handler = (SubstitutionHandler)handlers.get(compiledName); if (handler != null) return handler; handler = doCreateSubstitutionHandler(name, target, minOccurs, maxO...
createSubstitutionHandler
292,938
SubstitutionHandler (@NotNull String name, boolean target, int minOccurs, int maxOccurs, boolean greedy) { return new SubstitutionHandler(name, target, minOccurs, maxOccurs, greedy); }
doCreateSubstitutionHandler
292,939
SearchScope () { return scope; }
getScope
292,940
void (SearchScope scope) { this.scope = scope; }
setScope
292,941
void () { handlers.clear(); last = null; lastHandler = null; }
clearHandlers
292,942
boolean (@NotNull PsiElement element) { return true; }
isToResetHandler
292,943
List<PsiElement> (@NotNull String name) { final Collection<PsiElement> elements = variableNodes.get(name); return elements instanceof List ? (List<PsiElement>)elements : new SmartList<>(elements); }
getVariableNodes
292,944
void (@NotNull String name, @NotNull PsiElement node) { variableNodes.putValue(name, node); }
putVariableNode
292,945
PsiElement () { return myElement; }
getElement
292,946
boolean () { return myResult; }
getResult
292,947
boolean (boolean result) { return myResult = result; }
setResult
292,948
MatchContext () { return matchContext; }
getMatchContext
292,949
boolean (@NotNull NodeIterator elements, @NotNull NodeIterator elements2) { return MatchingHandler.matchInAnyOrder(elements, elements2, matchContext); }
doMatchInAnyOrder
292,950
boolean (@Nullable PsiElement patternNode, @Nullable PsiElement matchNode) { if (patternNode == null) { return isLeftLooseMatching(); } final MatchingHandler handler = matchContext.getPattern().getHandler(patternNode); return matchNode != null ? handler.match(patternNode, matchNode, matchContext) && handler.validate(ma...
matchOptionally
292,951
NodeFilter () { return LexicalNodesFilter.getInstance(); }
getNodeFilter
292,952
boolean (PsiElement typedElement, PsiElement match) { final MatchingHandler initialHandler = matchContext.getPattern().getHandler(typedElement); MatchingHandler handler = initialHandler; if (handler instanceof DelegatingHandler) { handler = ((DelegatingHandler)handler).getDelegate(); } assert handler instanceof Substit...
handleTypedElement
292,953
boolean (PsiElement element) { final MatchingHandler handler = getMatchContext().getPattern().getHandler(element); return handler instanceof SubstitutionHandler && ((SubstitutionHandler)handler).getMinOccurs() == 0; }
allowsAbsenceOfMatch
292,954
boolean (PsiElement patternElement, PsiElement matchElement) { ProgressManager.checkCanceled(); if (patternElement == matchElement) return true; if (patternElement == null) { // absence of pattern element is match return true; } if (matchElement == null) { // absence of match element needs check if allowed. return allo...
match
292,955
PsiElementVisitor (PsiElement element) { final StructuralSearchProfile profile = StructuralSearchUtil.getProfileByPsiElement(element); if (profile == null) { LOG.warn("No StructuralSearchProfile found for language " + element.getLanguage().getID()); return null; } return profile.createMatchingVisitor(this); }
getVisitorForElement
292,956
boolean (@NotNull NodeIterator patternNodes, @NotNull NodeIterator matchNodes) { if (!patternNodes.hasNext()) { while (matchNodes.current() instanceof PsiComment) matchNodes.advance(); return !matchNodes.hasNext(); } final PsiElement current = patternNodes.current(); return matchContext.getPattern().getHandler(current)...
matchSequentially
292,957
void (@NotNull NodeIterator elements) { final CompiledPattern pattern = matchContext.getPattern(); final NodeIterator patternNodes = pattern.getNodes().clone(); final MatchResultImpl saveResult = matchContext.hasResult() ? matchContext.getResult() : null; matchContext.saveMatchedNodes(); try { if (!patternNodes.hasNext...
matchContext
292,958
boolean () { return matchContext.getOptions().isLooseMatching(); }
isLeftLooseMatching
292,959
boolean () { return false; }
isRightLooseMatching
292,960
boolean (@Nullable PsiElement left, @Nullable PsiElement right) { if (left == null) return right == null; return right != null && matchText(left.getText(), right.getText()); }
matchText
292,961
boolean (String left, String right) { return matchContext.getOptions().isCaseSensitiveMatch() ? left.equals(right) : left.equalsIgnoreCase(right); }
matchText
292,962
void (PsiElement patternNode, boolean typedVar, PsiElement matchNode) { final MatchResultImpl ourResult = matchContext.hasResult() ? matchContext.getResult() : null; matchContext.popResult(); if (myResult) { if (typedVar) { final SubstitutionHandler handler = (SubstitutionHandler)matchContext.getPattern().getHandler(pa...
scopeMatch
292,963
void (MatchResult source) { final MatchResultImpl result = matchContext.getResult(); for (MatchResult child : source.getChildren()) result.addChild(child); }
copyResults
292,964
NodeFilter () { return ourFilter; }
getFilter
292,965
void (@NotNull PsiElement element, @NotNull MatchingHandler handler) { MatchingHandler realHandler = context.getPattern().getHandlerSimple(element); if (realHandler instanceof SubstitutionHandler) { ((SubstitutionHandler)realHandler).setMatchHandler(handler); } else { // @todo care about composite handler in this case ...
setHandler
292,966
void (@NotNull PsiElement element) { if ((!ourFilter.accepts(element) || StructuralSearchUtil.isIdentifier(element)) && context.getPattern().isRealTypedVar(element) && context.getPattern().getHandlerSimple(element) == null ) { final CompiledPattern pattern = context.getPattern(); String name = pattern.getTypedVarString...
handle
292,967
CompileContext () { return context; }
getContext
292,968
int () { return myCodeBlockLevel; }
getCodeBlockLevel
292,969
void (int codeBlockLevel) { this.myCodeBlockLevel = codeBlockLevel; }
setCodeBlockLevel
292,970
void (@NotNull MatchingHandler handler, @NotNull NodeFilter filter) { if (handler.getFilter() != null && handler.getFilter().getClass() != filter.getClass()) { // for constructor we will have the same handler for class and method and tokens itself handler.setFilter(new CompositeNodeFilter(filter, handler.getFilter()));...
setFilter
292,971
void (@NotNull PsiElement element, @NotNull NodeFilter filter) { context.getPattern().getHandler(element).setFilter(filter); }
setFilterSimple
292,972
List<PsiElement> () { return myLexicalNodes; }
getLexicalNodes
292,973
void (@NotNull PsiElement node) { myLexicalNodes.add(node); }
addLexicalNode
292,974
boolean (@NotNull String pattern) { return ourSubstitutionPattern.matcher(pattern).find(); }
hasFragments
292,975
MatchingHandler (@NotNull String pattern, @NotNull OccurenceKind kind) { return processPatternStringWithFragments(pattern, kind, ourSubstitutionPattern); }
processPatternStringWithFragments
292,976
MatchingHandler (@NotNull String pattern, @NotNull OccurenceKind kind, @NotNull Pattern substitutionPattern) { String content; if (kind == OccurenceKind.LITERAL) { content = pattern.substring(1, pattern.length() - 1); } else if (kind == OccurenceKind.COMMENT || kind == OccurenceKind.TEXT) { content = pattern; } else { ...
processPatternStringWithFragments
292,977
boolean (RegExpPredicate predicate, @NotNull SubstitutionHandler handler) { return predicate != null && handler.getMinOccurs() != 0 && predicate.couldBeOptimized(); }
isSuitablePredicate
292,978
void (@NotNull String word, boolean endTransaction, @NotNull GlobalCompilingVisitor.OccurenceKind kind, @NotNull CompileContext compileContext) { if (!compileContext.getSearchHelper().doOptimizing()) { return; } final StructuralSearchProfile profile = StructuralSearchUtil.getProfileByFileType(compileContext.getOptions(...
addFilesToSearchForGivenWord
292,979
void (@NotNull String name, @NotNull GlobalCompilingVisitor.OccurenceKind kind) { if (kind == OccurenceKind.LITERAL) name = StringUtil.unescapeStringCharacters(name); for (String word : StringUtil.getWordsInStringLongestFirst(name)) { addFilesToSearchForGivenWord(word, true, kind, getContext()); } }
processTokenizedName
292,980
boolean () { return myScope instanceof GlobalSearchScope; }
doOptimizing
292,981
void () { super.clear(); if (filesToScan != null) { filesToScan.clear(); filesToScan2.clear(); } }
clear
292,982
void (@NotNull String word) { myTransactionStarted = true; VirtualFile[] files = CacheManager.getInstance(myProject) .getVirtualFilesWithWord(word, (short)(IN_CODE | IN_PLAIN_TEXT), (GlobalSearchScope)myScope, myCaseSensitive); process(files); }
doAddSearchWordInCode
292,983
void (@NotNull String word) { myTransactionStarted = true; VirtualFile[] files = CacheManager.getInstance(myProject).getVirtualFilesWithWord(word, IN_PLAIN_TEXT, (GlobalSearchScope)myScope, myCaseSensitive); process(files); }
doAddSearchWordInText
292,984
void (@NotNull String word) { myTransactionStarted = true; VirtualFile[] files = CacheManager.getInstance(myProject).getVirtualFilesWithWord(word, IN_COMMENTS, (GlobalSearchScope)myScope, myCaseSensitive); process(files); }
doAddSearchWordInComments
292,985
void (@NotNull String word) { myTransactionStarted = true; VirtualFile[] files = CacheManager.getInstance(myProject).getVirtualFilesWithWord(word, IN_STRINGS, (GlobalSearchScope)myScope, myCaseSensitive); process(files); }
doAddSearchWordInLiterals
292,986
void () { if (!myTransactionStarted) return; myTransactionStarted = false; super.endTransaction(); Set<VirtualFile> map = filesToScan; if (!map.isEmpty()) map.clear(); filesToScan = filesToScan2; filesToScan2 = map; }
endTransaction
292,987
Set<VirtualFile> () { assert !myTransactionStarted; if (filesToScan == null) { return Collections.emptySet(); } return filesToScan; }
getFilesSetToScan
292,988
void (VirtualFile @NotNull [] files) { if (scanRequest == 0) { Collections.addAll(filesToScan2, files); } else { for (VirtualFile file : files) { if (filesToScan.contains(file)) { filesToScan2.add(file); } } } }
process
292,989
void (@NotNull PsiElement first, PsiElement last) { if (last == first) { first.delete(); } else { first.getParent().deleteChildRange(first, last); } }
delete
292,990
void () { try { PsiElement first = null; PsiElement last = null; for (PsiElement element : elements) { if (!element.isValid()) continue; if (first == null) { first = last = element; } else if (last.getNextSibling() == element) { last = element; } else { delete(first, last); first = last = element; } } if (first != null...
run
292,991
void (PsiElement @NotNull [] topLevelElements) { final CompileContext context = myCompilingVisitor.getContext(); final CompiledPattern pattern = context.getPattern(); if (pattern.getStrategy() == null) { final MatchOptions options = context.getOptions(); pattern.setStrategy(new XmlMatchingStrategy(options.getDialect())...
compile
292,992
void (@NotNull PsiElement element) { element.accept(myOptimizer); }
optimize
292,993
void (@NotNull XmlTag tag) { if (!handleWord(tag.getName(), CODE, myCompilingVisitor.getContext())) return; super.visitXmlTag(tag); }
visitXmlTag
292,994
void (@NotNull XmlAttribute attribute) { if (!handleWord(attribute.getName(), CODE, myCompilingVisitor.getContext())) return; handleWord(attribute.getValue(), CODE, myCompilingVisitor.getContext()); super.visitXmlAttribute(attribute); }
visitXmlAttribute
292,995
void (@NotNull XmlToken token) { super.visitXmlToken(token); final IElementType tokenType = token.getTokenType(); if (tokenType == XmlTokenType.XML_COMMENT_CHARACTERS || tokenType == XmlTokenType.XML_DATA_CHARACTERS) { handleWord(token.getText(), TEXT, myCompilingVisitor.getContext()); } }
visitXmlToken
292,996
void (@NotNull PsiElement element) { if (!(element.getLanguage() instanceof XMLLanguage) && StructuralSearchUtil.compileForeignElement(element, myCompilingVisitor)) { return; } myCompilingVisitor.handle(element); super.visitElement(element); }
visitElement
292,997
void (@NotNull XmlToken token) { final IElementType tokenType = token.getTokenType(); if (tokenType != XmlTokenType.XML_NAME && tokenType != XmlTokenType.XML_TAG_NAME && tokenType != XmlTokenType.XML_COMMENT_CHARACTERS && tokenType != XmlTokenType.XML_DATA_CHARACTERS) { return; } super.visitXmlToken(token); if (tokenTy...
visitXmlToken
292,998
void (@NotNull XmlText text) { super.visitXmlText(text); if (myCompilingVisitor.getContext().getPattern().isRealTypedVar(text)) { myCompilingVisitor.setFilterSimple(text, TagValueFilter.getInstance()); } }
visitXmlText
292,999
void (@NotNull XmlTag tag) { super.visitXmlTag(tag); // there are a lot of implementations of XmlTag which we should be able to match myCompilingVisitor.setFilterSimple(tag, element -> element instanceof XmlTag); }
visitXmlTag