/** * Returns true if the given category is a valid category * * @param name the category name to be checked * @return true if the given string is a valid category */ public final boolean isCategoryName(String name) { for (Category c : getCategories()) { if (c.getName().equals(name) || c.getFullName().equals(name)) { return true; } } return false; }
/** * Creates a new top level {@link Category} with the given sorting priority. * * @param name the name of the category * @param priority a sorting priority, with higher being more important * @return a new category */ public static Category create(String name, int priority) { return new Category(null, name, null, priority); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Category category = (Category) o; //noinspection SimplifiableIfStatement if (!name.equals(category.name)) { return false; } return parent != null ? parent.equals(category.parent) : category.parent == null; }
@Override public String toString() { return getFullName(); }
List<Issue> sorted = new ArrayList<>(issues); Collections.sort(sorted, (issue1, issue2) -> { int d = issue1.getCategory().compareTo(issue2.getCategory()); if (d != 0) { return d; for (Issue issue : sorted) { Category category = issue.getCategory(); if (!category.equals(previousCategory)) { String name = category.getFullName(); System.out.println(name); for (int i = 0, n = name.length(); i < n; i++) {
int categoryDelta = issue.getCategory().compareTo(other.issue.getCategory()); if (categoryDelta != 0) { return categoryDelta;
/** * Returns a full name for this category. For a top level category, this is just * the {@link #getName()} value, but for nested categories it will include the parent * names as well. * * @return a full name for this category */ public String getFullName() { if (mParent != null) { return mParent.getFullName() + ':' + mName; } else { return mName; } }
int categoryDelta = issue.getCategory().compareTo(other.issue.getCategory()); if (categoryDelta != 0) { return categoryDelta;
/** * Returns true if the given category is a valid category * * @param name the category name to be checked * @return true if the given string is a valid category */ public final boolean isCategoryName(@NonNull String name) { for (Category category : getCategories()) { if (category.getName().equals(name) || category.getFullName().equals(name)) { return true; } } return false; }
/** * Returns a full name for this category. For a top level category, this is just * the {@link #getName()} value, but for nested categories it will include the parent * names as well. * * @return a full name for this category */ public String getFullName() { if (parent != null) { return parent.getFullName() + ':' + name; } else { return name; } }
/** * Creates a new top level {@link Category} with the given sorting priority. * * @param parent the name of a parent category, or null * @param name the name of the category * @param explanation an optional explanation of the category * @param priority a sorting priority, with higher being more important * @return a new category */ public static Category create(Category parent, String name, String explanation, int priority) { return new Category(parent, name, null, priority); }
return false; if (!issue.getCategory().equals(warning.issue.getCategory())) { return false;
if (issue.getCategory().getName().startsWith(category) || issue.getCategory().getFullName().startsWith(category)) { listIssue(System.out, issue); if (issue.getCategory().getName().startsWith(category) || issue.getCategory().getFullName().startsWith(category)) { describeIssue(issue); System.out.println(); if (issue.getCategory().getName().startsWith(category) || issue.getCategory().getFullName().startsWith(category)) { flags.getSuppressedIds().add(issue.getId()); if (issue.getCategory().getName().startsWith(category) || issue.getCategory().getFullName().startsWith(category)) { flags.getEnabledIds().add(issue.getId()); if (issue.getCategory().getName().startsWith(category) || issue.getCategory().getFullName().startsWith(category)) { checkedIds.add(issue.getId());
private static void displayValidIds(IssueRegistry registry, PrintStream out) { List<Category> categories = registry.getCategories(); out.println("Valid issue categories:"); for (Category category : categories) { out.println(" " + category.getFullName()); } out.println(); List<Issue> issues = registry.getIssues(); out.println("Valid issue id's:"); for (Issue issue : issues) { listIssue(out, issue); } }
/** * Creates a new top level {@link Category} with the given sorting priority. * * @param name the name of the category * @param priority a sorting priority, with higher being more important * @return a new category */ @NonNull public static Category create(@NonNull String name, int priority) { return new Category(null, name, priority); }
writer.write("<br/>\n"); writer.write("Category: "); writer.write(issue.getCategory().getFullName()); writer.write("</div>\n");
/** * Creates a new top level {@link Category} with the given sorting priority. * * @param parent the name of a parent category, or null * @param name the name of the category * @param priority a sorting priority, with higher being more important * @return a new category */ @NonNull public static Category create(@Nullable Category parent, @NonNull String name, int priority) { return new Category(parent, name, priority); }
private static void describeIssue(Issue issue) { System.out.println(issue.getId()); for (int i = 0; i < issue.getId().length(); i++) { System.out.print('-'); } System.out.println(); System.out.println(wrap("Summary: " + issue.getBriefDescription(TEXT))); System.out.println("Priority: " + issue.getPriority() + " / 10"); System.out.println("Severity: " + issue.getDefaultSeverity().getDescription()); System.out.println("Category: " + issue.getCategory().getFullName()); if (!issue.isEnabledByDefault()) { System.out.println("NOTE: This issue is disabled by default!"); System.out.println(String.format("You can enable it by adding %1$s %2$s", ARG_ENABLE, issue.getId())); } System.out.println(); System.out.println(wrap(issue.getExplanation(TEXT))); List<String> moreInfo = issue.getMoreInfo(); if (!moreInfo.isEmpty()) { System.out.println("More information: "); for (String uri : moreInfo) { System.out.println(uri); } } }
writer.write("<tr><td></td><td class=\"categoryColumn\">"); previousCategory = issue.getCategory(); String categoryName = issue.getCategory().getFullName(); writer.write("<a href=\"#"); writer.write(categoryName);