Package mekhq.campaign.parts.enums
Enum Class PartQuality
- All Implemented Interfaces:
Serializable,Comparable<PartQuality>,Constable
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic List<PartQuality>allQualities(boolean reversed) static PartQualitystatic PartQualityfromNumeric(int rawQuality) getName()getName(boolean reversed) intmegamek.common.enums.TechRatingtoName(boolean reversed) intstatic PartQualityReturns the enum constant of this class with the specified name.static PartQuality[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
QUALITY_A
-
QUALITY_B
-
QUALITY_C
-
QUALITY_D
-
QUALITY_E
-
QUALITY_F
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
toNumeric
public int toNumeric()- Returns:
- numeric quality 0-5 bad-good
-
getName
- Returns:
- String letter name for quality A-F bad-good
-
getName
- 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
- Parameters:
rawQuality- - numeric quality 0-5 bad-good- Returns:
- corresponding PartQuality
-
toName
- 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
- 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
- Returns:
- Hex color code for coloring parts of this quality.
-
improveQuality
- Returns:
- PartQuality that is one step better than this one, clamped
-
reduceQuality
- Returns:
- PartQuality that is one step worse than this one, clamped
-
allQualities
- Returns:
- A list of PartQualities in order bad to good
-