Package mekhq.campaign.force
Enum Class ForceType
- All Implemented Interfaces:
Serializable
,Comparable<ForceType>
,Constable
Represents the various types of forces available.
It is used to classify and manipulate forces within the game.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionConvoy force type, typically used by the Resupply module.Security force type, typically used by the Prisoner Events module.Standard force type, typically used for combat.Support force type, used by forces that should be deployed in StratCon but not involved in combat. -
Method Summary
Modifier and TypeMethodDescriptionstatic ForceType
fromOrdinal
(int ordinal) Retrieves aForceType
based on its ordinal value.Retrieves the display name for the ForceType by fetching a localized label from the relevant resource bundle.Retrieves the symbol associated with this ForceType.boolean
isConvoy()
Checks if this force type isCONVOY
.boolean
Checks if this force type isSECURITY
.boolean
Checks if this force type isSTANDARD
.boolean
Checks if this force type isSUPPORT
.boolean
This flag indicates whether, when changing to this ForceType, whether all child forces should be changed to the same ForceType.boolean
This flag indicates whether, when changing to this ForceType, whether all parent forces should be changed to STANDARD.static ForceType
Returns the enum constant of this class with the specified name.static ForceType[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
STANDARD
Standard force type, typically used for combat. -
SUPPORT
Support force type, used by forces that should be deployed in StratCon but not involved in combat. -
CONVOY
Convoy force type, typically used by the Resupply module. -
SECURITY
Security force type, typically used by the Prisoner Events module.
-
-
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
-
getDisplayName
Retrieves the display name for the ForceType by fetching a localized label from the relevant resource bundle.The method uses the
name
of the current instance to construct a resource key in the format[name].label
. This key is used to look up a localized string from theForceType
resource bundle located in themekhq.resources
package. The formatted text at the specified key is returned as the display name.- Returns:
- The localized display name for the current instance.
-
getSymbol
Retrieves the symbol associated with this ForceType.The method determines the symbol to display for the current instance by looking up a localization resource key in the
ForceType
resource bundle, with keys formatted as[enumName].symbol
.If the current instance is
STANDARD
, an empty string is returned as the symbol.- Returns:
- The localized symbol associated with the current instance, or an empty string
if the instance is
STANDARD
.
-
shouldStandardizeParents
public boolean shouldStandardizeParents()This flag indicates whether, when changing to this ForceType, whether all parent forces should be changed to STANDARD.- Returns:
true
if parent relationships should be standardized;false
otherwise.
-
shouldChildrenInherit
public boolean shouldChildrenInherit()This flag indicates whether, when changing to this ForceType, whether all child forces should be changed to the same ForceType.- Returns:
true
if children should inherit from parents;false
otherwise.
-
isStandard
public boolean isStandard()Checks if this force type isSTANDARD
.- Returns:
true
if this is theSTANDARD
type; otherwise,false
.
-
isSupport
public boolean isSupport()Checks if this force type isSUPPORT
.- Returns:
true
if this is theSUPPORT
type; otherwise,false
.
-
isConvoy
public boolean isConvoy()Checks if this force type isCONVOY
.- Returns:
true
if this is theCONVOY
type; otherwise,false
.
-
isSecurity
public boolean isSecurity()Checks if this force type isSECURITY
.- Returns:
true
if this is theSECURITY
type; otherwise,false
.
-
fromOrdinal
Retrieves aForceType
based on its ordinal value.- Parameters:
ordinal
- the ordinal index of the force type.- Returns:
- the corresponding
ForceType
if the ordinal is valid; otherwise, defaults toSTANDARD
.
-