Unnamed: 0 int64 0 305k | body stringlengths 7 52.9k | name stringlengths 1 185 |
|---|---|---|
18,500 | PsiElement () { return last; } | getLast |
18,501 | boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; CommentRange that = (CommentRange)o; if (first != null ? !first.equals(that.first) : that.first != null) return false; if (last != null ? !last.equals(that.last) : that.last != null) return false; return true; } | equals |
18,502 | int () { int result = first != null ? first.hashCode() : 0; result = 31 * result + (last != null ? last.hashCode() : 0); return result; } | hashCode |
18,503 | int () { return type; } | getType |
18,504 | int () { return start; } | getStart |
18,505 | int () { return end; } | getEnd |
18,506 | String () { return prefix; } | getPrefix |
18,507 | String () { return suffix; } | getSuffix |
18,508 | int (@NotNull CommentAction object) { int s = object.getStart(); int diff = s - start; if (diff == 0) { diff = type == ACTION_INSERT ? 1 : -1; } return diff; } | compareTo |
18,509 | LanguageOptions () { return new LanguageOptions(); } | getDefaultOptions |
18,510 | LanguageOptions (boolean prefix) { LanguageOptions languageOptions = new LanguageOptions(); languageOptions.setPrefixLines(prefix); return languageOptions; } | createDefaultOptions |
18,511 | UpdateCopyright (Project project, Module module, VirtualFile file, FileType base, CopyrightProfile options) { return new UpdateXmlFileCopyright(project, module, file, options); } | createInstance |
18,512 | LanguageOptions () { return createDefaultOptions(false); } | getDefaultOptions |
18,513 | boolean () { return getFile() instanceof XmlFile; } | accept |
18,514 | void () { logger.debug("updating " + getFile().getVirtualFile()); XmlDoctype doctype = null; PsiElement root = null; XmlDocument doc = ((XmlFile)getFile()).getDocument(); PsiElement elem = doc.getFirstChild(); while (elem != null) { if (elem instanceof XmlProlog) { PsiElement prolog = elem.getFirstChild(); while (prolog != null) { if (prolog instanceof XmlDoctype) { doctype = (XmlDoctype)prolog; } prolog = prolog.getNextSibling(); } } else if (elem instanceof XmlTag || elem instanceof XmlElementDecl || elem instanceof XmlAttributeDecl) { root = elem; break; } elem = elem.getNextSibling(); } PsiElement first = doc.getFirstChild(); if (root == null) { root = doc.getLastChild(); } int location = getLanguageOptions().getFileLocation(); if (doctype != null) { checkComments(first, doctype, location == XmlOptions.LOCATION_BEFORE_DOCTYPE); first = doctype; } else if (location == XmlOptions.LOCATION_BEFORE_DOCTYPE) { location = XmlOptions.LOCATION_BEFORE_ROOTTAG; } if (root != null) { checkComments(first, root, location == XmlOptions.LOCATION_BEFORE_ROOTTAG); } else if (location == XmlOptions.LOCATION_BEFORE_ROOTTAG) { // If we get here we have an empty file checkComments(first, first, true); } } | scanFile |
18,515 | PsiElement (PsiElement element) { if (element == null) return null; PsiElement res = element.getPrevSibling(); if (res != null) { if (res instanceof XmlProlog prolog) { if (prolog.getChildren().length > 0) { res = prolog.getLastChild(); } else { res = prolog.getPrevSibling(); } } } else { if (element.getParent() instanceof XmlProlog) { res = element.getParent().getPrevSibling(); } } return res; } | getPreviousSibling |
18,516 | PsiElement (PsiElement element) { if (element == null) return null; PsiElement res = element instanceof XmlProlog ? element : element.getNextSibling(); if (res != null) { if (res instanceof XmlProlog prolog) { if (prolog.getChildren().length > 0) { res = prolog.getFirstChild(); } else { res = prolog.getNextSibling(); } } } else { if (element.getParent() instanceof XmlProlog) { res = element.getParent().getNextSibling(); } } return res; } | getNextSibling |
18,517 | String (String prefix, String suffix) { return getCommentText(prefix, suffix, null); } | getCommentText |
18,518 | String (String prefix, String suffix, String oldComment) { if (commentText == null) { FileType ftype = root.getFileType(); LanguageOptions opts = CopyrightManager.getInstance(project).getOptions().getMergedOptions(ftype.getName()); String notice = myCopyrightProfile.getNotice(); String base = notice != null ? EntityUtil.decode(notice) : ""; if (base.isEmpty()) { commentText = ""; } else { String expanded = VelocityHelper.evaluate(manager.findFile(root), project, module, base, oldComment); String cmt = FileTypeUtil.buildComment(root.getFileType(), expanded, opts); commentText = StringUtil.convertLineSeparators(prefix + cmt + suffix); } } return commentText; } | getCommentText |
18,519 | VirtualFile () { return root; } | getRoot |
18,520 | PsiManager () { return manager; } | getManager |
18,521 | void () { commentText = null; } | resetCommentText |
18,522 | int (String text) { int cnt = 0; for (int i = 0; i < text.length(); i++) { if (text.charAt(i) == '\n') { cnt++; } } return cnt; } | countNewline |
18,523 | void () { List<PsiComment> comments = SyntaxTraverser.psiTraverser(getFile()) .withTraversal(TreeTraversal.LEAVES_DFS) .traverse() .takeWhile(Conditions.instanceOf(PsiComment.class, PsiWhiteSpace.class)) .filter(PsiComment.class) .toList(); checkComments(ContainerUtil.getLastItem(comments), true, comments); } | scanFile |
18,524 | UpdateCopyright (Project project, Module module, VirtualFile file, FileType base, CopyrightProfile options) { return new UpdateAnyFileCopyright(project, module, file, options); } | createInstance |
18,525 | String () { return name; } | getName |
18,526 | String (String text) { StringBuilder res = new StringBuilder(text.length()); for (int i = 0; i < text.length(); i++) { char ch = text.charAt(i); if (ch == '&') { res.append("&"); } else if (ch == '$') { res.append("$"); } else { res.append(ch); } } return res.toString(); } | encode |
18,527 | String (String text) { StringBuilder res = new StringBuilder(text.length()); for (int i = 0; i < text.length(); i++) { char ch = text.charAt(i); if (ch == '&') { int semi = text.indexOf(';', i); if (semi > i) { char newch = '&'; String entity = text.substring(i, semi + 1); if (entity.equals("$")) { newch = '$'; } else if (entity.equals("&")) { i = semi; } if (newch != ch) { ch = newch; i = semi; } } } res.append(ch); } return res.toString(); } | decode |
18,528 | String (@Nullable PsiFile file, @Nullable Project project, @Nullable Module module, @NotNull String template) { return evaluate(file, project, module, template, null); } | evaluate |
18,529 | String (@Nullable PsiFile file, @Nullable Project project, @Nullable Module module, @NotNull String template, @Nullable String oldComment) { VelocityEngine engine = getEngine(); VelocityContext vc = new VelocityContext(); vc.put("today", new DateInfo()); if (file != null) vc.put("file", new FileInfo(file)); if (project != null) vc.put("project", new ProjectInfo(project)); if (module != null) vc.put("module", new ModuleInfo(module)); vc.put("username", System.getProperty("user.name")); vc.put("originalComment", new CommentInfo(oldComment)); if (file != null) { final VirtualFile virtualFile = PsiUtilCore.getVirtualFile(file); if (virtualFile != null) { final CopyrightVariablesProvider variablesProvider = CopyrightVariablesProviders.INSTANCE.forFileType(virtualFile.getFileType()); if (variablesProvider != null) { final Map<String, Object> context = new HashMap<>(); variablesProvider.collectVariables(context, project, module, file); for (Map.Entry<String, Object> entry : context.entrySet()) { vc.put(entry.getKey(), entry.getValue()); } } } } try { StringWriter sw = new StringWriter(); boolean stripLineBreak = false; if (template.endsWith("$")) { template += getVelocitySuffix(); stripLineBreak = true; } engine.evaluate(vc, sw, CopyrightManager.class.getName(), template); final String result = sw.getBuffer().toString(); return stripLineBreak ? StringUtil.trimEnd(result, getVelocitySuffix()) : result; } catch (Exception e) { return ""; } } | evaluate |
18,530 | String () { return "\n"; } | getVelocitySuffix |
18,531 | String () { return myText; } | getText |
18,532 | String (String regexp) { return match(regexp, 1, "", ""); } | match |
18,533 | String (String regexp, int group, String suffix) { return match(regexp, group, suffix, ""); } | match |
18,534 | String (String regexp, int group, String suffix, String ignoreValue) { if (myText == null) { return ""; } Matcher matcher = Pattern.compile(".*" + regexp + ".*", Pattern.DOTALL | Pattern.MULTILINE).matcher(myText); if (matcher.matches()) { String date = matcher.group(group); if (!StringUtil.isEmpty(date) && !date.equals(ignoreValue)) { return date + suffix; } } return ""; } | match |
18,535 | String () { return getVirtualFile() != null ? getVirtualFile().getPath() : ""; } | getPathName |
18,536 | String () { return getVirtualFile() != null ? getVirtualFile().getName() : ""; } | getFileName |
18,537 | String () { return getFileName(); } | getClassName |
18,538 | String () { return getPathName(); } | getQualifiedClassName |
18,539 | DateInfo () { if (getVirtualFile() != null) { return new DateInfo(getVirtualFile().getTimeStamp()); } else { return new DateInfo(); } } | getLastModified |
18,540 | VirtualFile () { return file.getVirtualFile(); } | getVirtualFile |
18,541 | String () { return name; } | getName |
18,542 | int () { return calendar.get(Calendar.YEAR); } | getYear |
18,543 | int () { return calendar.get(Calendar.MONTH) + 1; } | getMonth |
18,544 | int () { return calendar.get(Calendar.DAY_OF_MONTH); } | getDay |
18,545 | int () { return calendar.get(Calendar.HOUR); } | getHour |
18,546 | int () { return calendar.get(Calendar.HOUR_OF_DAY); } | getHour24 |
18,547 | int () { return calendar.get(Calendar.MINUTE); } | getMinute |
18,548 | int () { return calendar.get(Calendar.SECOND); } | getSecond |
18,549 | String (String format) { SimpleDateFormat sdf = new SimpleDateFormat(format); return sdf.format(calendar.getTime()); } | format |
18,550 | String () { return new SimpleDateFormat().format(calendar.getTime()); } | toString |
18,551 | List<CopyrightProfile> (File file) { try { List<CopyrightProfile> profiles = new ArrayList<>(); Element root = JDOMUtil.load(file); if (root.getName().equals("component")) { final Element copyrightElement = root.getChild("copyright"); if (copyrightElement != null) extractNewNoticeAndKeyword(copyrightElement, profiles); } else { for (Element component : root.getChildren("component")) { String name = component.getAttributeValue("name"); if (name.equals("CopyrightManager")) { for (Element o : component.getChildren("copyright")) { extractNewNoticeAndKeyword(o, profiles); } } else if (name.equals("copyright")) { extractNoticeAndKeyword(component, profiles); } } } return profiles; } catch (Exception e) { logger.info(e); Messages.showErrorDialog(e.getMessage(), CopyrightBundle.message("dialog.title.import.failure")); return null; } } | loadOptions |
18,552 | void (Element valueElement, List<? super CopyrightProfile> profiles) { CopyrightProfile profile = new CopyrightProfile(); boolean extract = false; for (Element l : valueElement.getChildren("LanguageOptions")) { if (l.getAttributeValue("name").equals("__TEMPLATE__")) { for (Element o1 : l.getChildren("option")) { extract |= extract(profile, o1); } break; } } if (extract) profiles.add(profile); } | extractNoticeAndKeyword |
18,553 | void (Element valueElement, List<? super CopyrightProfile> profiles) { CopyrightProfile profile = new CopyrightProfile(); boolean extract = false; for (Element l : valueElement.getChildren("option")) { extract |= extract(profile, l); } if (extract) profiles.add(profile); } | extractNewNoticeAndKeyword |
18,554 | boolean (final CopyrightProfile profile, final Element el) { if (el.getAttributeValue("name").equals("notice")) { profile.setNotice(el.getAttributeValue("value")); return true; } else if (el.getAttributeValue("name").equals("keyword")) { profile.setKeyword(el.getAttributeValue("value")); } else if (el.getAttributeValue("name").equals("myName")) { profile.setName(el.getAttributeValue("value")); } else if (el.getAttributeValue("name").equals("allowReplaceKeyword")) { profile.setAllowReplaceRegexp(StringUtil.escapeToRegexp(el.getAttributeValue("value"))); } else if (el.getAttributeValue("name").equals("allowReplaceRegexp")) { profile.setAllowReplaceRegexp(el.getAttributeValue("value")); } return false; } | extract |
18,555 | int () { return fileTypeOverride; } | getFileTypeOverride |
18,556 | void (int fileTypeOverride) { this.fileTypeOverride = fileTypeOverride; } | setFileTypeOverride |
18,557 | boolean () { return relativeBefore; } | isRelativeBefore |
18,558 | void (boolean relativeBefore) { this.relativeBefore = relativeBefore; } | setRelativeBefore |
18,559 | boolean () { return addBlankAfter; } | isAddBlankAfter |
18,560 | void (boolean addBlankAfter) { this.addBlankAfter = addBlankAfter; } | setAddBlankAfter |
18,561 | boolean () { return addBlankBefore; } | isAddBlankBefore |
18,562 | void (boolean addBlankBefore) { this.addBlankBefore = addBlankBefore; } | setAddBlankBefore |
18,563 | int () { return fileLocation; } | getFileLocation |
18,564 | void (int fileLocation) { this.fileLocation = fileLocation; } | setFileLocation |
18,565 | boolean (Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final LanguageOptions that = (LanguageOptions)o; if (addBlankAfter != that.addBlankAfter) { return false; } if(addBlankBefore != that.addBlankBefore){ return false; } if (fileLocation != that.fileLocation) { return false; } if (fileTypeOverride != that.fileTypeOverride) { return false; } if (relativeBefore != that.relativeBefore) { return false; } if (block != that.block) { return false; } if (box != that.box) { return false; } if (!Objects.equals(filler, that.filler)) { return false; } if (lenAfter != that.lenAfter) { return false; } if (lenBefore != that.lenBefore) { return false; } if (prefixLines != that.prefixLines) { return false; } if (separateAfter != that.separateAfter) { return false; } return separateBefore == that.separateBefore; } | equals |
18,566 | int () { int result; result = (block ? 1 : 0); result = 29 * result + (separateBefore ? 1 : 0); result = 29 * result + (separateAfter ? 1 : 0); result = 29 * result + (prefixLines ? 1 : 0); result = 29 * result + lenBefore; result = 29 * result + lenAfter; result = 29 * result + (box ? 1 : 0); result = 29 * result + filler.hashCode(); result = 29 * result + fileTypeOverride; result = 29 * result + (relativeBefore ? 1 : 0); result = 29 * result + (addBlankAfter ? 1 : 0); result = 29 * result + (addBlankBefore ? 1 : 0); result = 29 * result + fileLocation; return result; } | hashCode |
18,567 | String () { return "LanguageOptions" + ", fileTypeOverride=" + fileTypeOverride + ", relativeBefore=" + relativeBefore + ", addBlankAfter=" + addBlankAfter + ", addBlankBefore=" + addBlankBefore + ", fileLocation=" + fileLocation + ", block=" + block + ", separateBefore=" + separateBefore + ", separateAfter=" + separateAfter + ", prefixLines=" + prefixLines + ", lenBefore=" + lenBefore + ", lenAfter=" + lenAfter + ", box=" + box + ", filler=" + filler + '} | toString |
18,568 | boolean () { return block; } | isBlock |
18,569 | void (boolean block) { this.block = block; } | setBlock |
18,570 | boolean () { return separateBefore; } | isSeparateBefore |
18,571 | void (boolean separateBefore) { this.separateBefore = separateBefore; } | setSeparateBefore |
18,572 | boolean () { return separateAfter; } | isSeparateAfter |
18,573 | void (boolean separateAfter) { this.separateAfter = separateAfter; } | setSeparateAfter |
18,574 | boolean () { return prefixLines; } | isPrefixLines |
18,575 | void (boolean prefixLines) { this.prefixLines = prefixLines; } | setPrefixLines |
18,576 | int () { return lenBefore; } | getLenBefore |
18,577 | void (int lenBefore) { this.lenBefore = lenBefore; } | setLenBefore |
18,578 | int () { return lenAfter; } | getLenAfter |
18,579 | void (int lenAfter) { this.lenAfter = lenAfter; } | setLenAfter |
18,580 | boolean () { return box; } | isBox |
18,581 | void (boolean box) { this.box = box; } | setBox |
18,582 | String () { return filler; } | getFiller |
18,583 | void (String filler) { this.filler = filler; } | setFiller |
18,584 | boolean () { return trim; } | isTrim |
18,585 | void (boolean trim) { this.trim = trim; } | setTrim |
18,586 | LanguageOptions (String fileTypeName) { LanguageOptions res = options.get(fileTypeName); if (res != null) return res; final FileType fileType = FileTypeManager.getInstance().findFileTypeByName(fileTypeName); if (fileType == null) return new LanguageOptions(); FileType acceptableFileType = CopyrightUpdaters.INSTANCE.getRegisteredFileTypeFromLanguageHierarchy(fileType); if (acceptableFileType != null) { res = this.options.get(acceptableFileType.getName()); if (res != null) return res; } final UpdateCopyrightsProvider provider = CopyrightUpdaters.INSTANCE.forFileType(fileType); if (provider != null) return provider.getDefaultOptions(); return new LanguageOptions(); } | getOptions |
18,587 | LanguageOptions () { return getOptions(LANG_TEMPLATE); } | getTemplateOptions |
18,588 | void (String name, LanguageOptions options) { this.options.put(name, options); } | setOptions |
18,589 | void (LanguageOptions options) { setOptions(LANG_TEMPLATE, options); } | setTemplateOptions |
18,590 | LanguageOptions (String name) { try { LanguageOptions lang = getOptions(name).clone(); LanguageOptions temp = getTemplateOptions().clone(); switch (lang.getFileTypeOverride()) { case LanguageOptions.USE_TEMPLATE -> { temp.setFileLocation(lang.getFileLocation()); temp.setFileTypeOverride(lang.getFileTypeOverride()); lang = temp; } case LanguageOptions.USE_TEXT -> { } } return lang; } catch (CloneNotSupportedException e) { // This shouldn't happen } return null; } | getMergedOptions |
18,591 | boolean (Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final Options options1 = (Options)o; return options.equals(options1.options); } | equals |
18,592 | int () { int result; result = options.hashCode(); return result; } | hashCode |
18,593 | String () { return "Options" + "{options=" + options + '}'; } | toString |
18,594 | int () { return 311; } | hashCode |
18,595 | boolean (Object o) { return o instanceof IntelliJWorkspaceReaderM31; } | equals |
18,596 | WorkspaceRepository () { return myWorkspaceRepository; } | getRepository |
18,597 | File (Artifact artifact) { return MavenModuleMap.getInstance().findArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getExtension(), artifact.getClassifier(), artifact.getBaseVersion()); } | findArtifact |
18,598 | List<String> (Artifact artifact) { return Collections.emptyList(); } | findVersions |
18,599 | void () { if (myIndicator.isCanceled()) throw new MavenProcessCanceledRuntimeException(); } | checkCanceled |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.