Enum Class PartQuality

java.lang.Object
java.lang.Enum<PartQuality>
mekhq.campaign.parts.enums.PartQuality
All Implemented Interfaces:
Serializable, Comparable<PartQuality>, Constable

public enum PartQuality extends Enum<PartQuality>
Represents the quality of a Part. Quality is a scale that ranges from A to F. By the book, A is bad and F is good, but there is an option that inverts this scale, hence the 'reverse' options on the various functions available here.

Internally quality is represented by a number 0 to 5, bad to good.

  • Enum Constant Details

  • Method Details

    • values

      public static PartQuality[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static PartQuality valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • toNumeric

      public int toNumeric()
      Returns:
      numeric quality 0-5 bad-good
    • getName

      public String getName()
      Returns:
      String letter name for quality A-F bad-good
    • getName

      public String getName(boolean reversed)
      Parameters:
      reversed - - are quality names reversed per the campaign option
      Returns:
      String letter name for quality A-F bad-good (or good-bad if reversed)
    • getTechRating

      public megamek.common.enums.TechRating getTechRating()
      Returns:
      TechRating for this quality
    • fromNumeric

      public static PartQuality fromNumeric(int rawQuality)
      Parameters:
      rawQuality - - numeric quality 0-5 bad-good
      Returns:
      corresponding PartQuality
    • toName

      public String toName(boolean reversed)
      Parameters:
      reversed - - are quality names reversed per the campaign option
      Returns:
      String letter name for quality A-F bad-good (or good-bad if reversed)
    • fromName

      public static PartQuality fromName(String code, boolean reversed)
      Parameters:
      code - - one-character String name from A-F bad-good (or good-bad if reversed)
      reversed - - are quality names reversed per the campaign option
      Returns:
      corresponding PartQuality
    • getRepairModifier

      public int getRepairModifier()
      Returns:
      modifier for repair rolls using a part of this quality
    • getHexColor

      public String getHexColor()
      Returns:
      Hex color code for coloring parts of this quality.
    • improveQuality

      public PartQuality improveQuality()
      Returns:
      PartQuality that is one step better than this one, clamped
    • reduceQuality

      public PartQuality reduceQuality()
      Returns:
      PartQuality that is one step worse than this one, clamped
    • allQualities

      public static List<PartQuality> allQualities(boolean reversed)
      Returns:
      A list of PartQualities in order bad to good