<commit_before>/* LanguageTool, a natural language style checker 
 * Copyright (C) 2006 <NAME> (http://www.danielnaber.de)
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
 * USA
 */
package org.languagetool.rules;

/**
 * A rule's category. Categories are used to group rules for
 * a better overview.
 * 
 * @author <NAME>
 */
public class Category {

  public enum Location {
    /** The rules in this category are part of the main distribution of
     * LanguageTool and are thus available on <a href="http://community.languagetool.org">community.languagetool.org</a>. */
    INTERNAL,
    /** The rules in this category are not part of the main distribution of LanguageTool. */
    EXTERNAL
  }

  private static final int DEFAULT_PRIORITY = 50;
  
  private final int priority;
  private final String name;
  private final Location location;

  private boolean defaultOff;

  /**
   * Create a new category with the given name and priority.
   * @param name name of the category
   * @param priority a value between 0 and 100 (inclusive)
   */
  public Category(final String name, final int priority, Location location) {
    if (priority < 0 || priority > 100) {
      throw new IllegalArgumentException("priority must be in range 0 - 100: " + priority);
    }
    this.name = name;
    this.priority = priority;
    this.location = location;
  }

  /**
   * @since 2.8
   */
  Category(final String name, final int priority) {
    this(name, priority, Location.INTERNAL);
  }

  /**
   * Create a new category with the default priority (50).
   * @param name name of the category
   */
  public Category(final String name) {
    this(name, Location.INTERNAL);
  }

  /**
   * Create a new category with the default priority (50).
   * @param name name of the category
   * @since 2.8
   */
  public Category(String name, Location location) {
    this(name, DEFAULT_PRIORITY, location);
  }

  public String getName() {
    return name;
  }

  public int getPriority() {
    return priority;
  }
  
  @Override
  public String toString() {
    return name;
  }

  /**
   * Checks whether the category has been turned off
   * by default by the category author.
   * @return True if the category is turned off by default.
   */
  public final boolean isDefaultOff() {
    return defaultOff;
  }
  
  /**
   * Turns the category off by default.
   */
  public final void setDefaultOff() {
    defaultOff = true;
  }

  /**
   * @since 2.8
   */
  public Location getLocation() {
    return location;
  }

}
<commit_msg>deprecate the Category constructors with priority, as the priority value isn't used at all<commit_after>/* LanguageTool, a natural language style checker 
 * Copyright (C) 2006 <NAME> (http://www.danielnaber.de)
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
 * USA
 */
package org.languagetool.rules;

/**
 * A rule's category. Categories are used to group rules for
 * a better overview.
 * 
 * @author <NAME>
 */
public class Category {

  public enum Location {
    /** The rules in this category are part of the main distribution of
     * LanguageTool and are thus available on <a href="http://community.languagetool.org">community.languagetool.org</a>. */
    INTERNAL,
    /** The rules in this category are not part of the main distribution of LanguageTool. */
    EXTERNAL
  }

  private static final int DEFAULT_PRIORITY = 50;
  
  private final int priority;
  private final String name;
  private final Location location;

  private boolean defaultOff;

  /**
   * Create a new category with the given name and priority.
   * @param name name of the category
   * @param priority a value between 0 and 100 (inclusive)
   * @deprecated priority will be removed, as it had not been used (deprecated since 2.8)
   */
  public Category(final String name, final int priority, Location location) {
    if (priority < 0 || priority > 100) {
      throw new IllegalArgumentException("priority must be in range 0 - 100: " + priority);
    }
    this.name = name;
    this.priority = priority;
    this.location = location;
  }

  /**
   * @since 2.8
   * @deprecated priority will be removed, as it had not been used (deprecated since 2.8)
   */
  Category(final String name, final int priority) {
    this(name, priority, Location.INTERNAL);
  }

  /**
   * Create a new category with the default priority (50).
   * @param name name of the category
   */
  public Category(final String name) {
    this(name, Location.INTERNAL);
  }

  /**
   * Create a new category with the default priority (50).
   * @param name name of the category
   * @since 2.8
   */
  public Category(String name, Location location) {
    this(name, DEFAULT_PRIORITY, location);
  }

  public String getName() {
    return name;
  }

  public int getPriority() {
    return priority;
  }
  
  @Override
  public String toString() {
    return name;
  }

  /**
   * Checks whether the category has been turned off
   * by default by the category author.
   * @return True if the category is turned off by default.
   */
  public final boolean isDefaultOff() {
    return defaultOff;
  }
  
  /**
   * Turns the category off by default.
   */
  public final void setDefaultOff() {
    defaultOff = true;
  }

  /**
   * @since 2.8
   */
  public Location getLocation() {
    return location;
  }

}

{'fraction_non_alphanumeric': 0.08534211708339572, 'fraction_numerical': 0.012876179068722862, 'mean_word_length': 3.0240963855421685, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4154553', 'n_tokens_mistral': 1930, 'n_tokens_neox': 1832, 'n_words': 811}