Enum Class ForceType

java.lang.Object
java.lang.Enum<ForceType>
mekhq.campaign.force.ForceType
All Implemented Interfaces:
Serializable, Comparable<ForceType>, Constable

public enum ForceType extends Enum<ForceType>
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 Constants
    Enum Constant
    Description
    Convoy 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 Type
    Method
    Description
    static ForceType
    fromOrdinal(int ordinal)
    Retrieves a ForceType 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
    Checks if this force type is CONVOY.
    boolean
    Checks if this force type is SECURITY.
    boolean
    Checks if this force type is STANDARD.
    boolean
    Checks if this force type is SUPPORT.
    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[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • STANDARD

      public static final ForceType STANDARD
      Standard force type, typically used for combat.
    • SUPPORT

      public static final ForceType SUPPORT
      Support force type, used by forces that should be deployed in StratCon but not involved in combat.
    • CONVOY

      public static final ForceType CONVOY
      Convoy force type, typically used by the Resupply module.
    • SECURITY

      public static final ForceType SECURITY
      Security force type, typically used by the Prisoner Events module.
  • Method Details

    • values

      public static ForceType[] 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 ForceType 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
    • getDisplayName

      public String 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 the ForceType resource bundle located in the mekhq.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

      public String 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 is STANDARD.
      Returns:
      true if this is the STANDARD type; otherwise, false.
    • isSupport

      public boolean isSupport()
      Checks if this force type is SUPPORT.
      Returns:
      true if this is the SUPPORT type; otherwise, false.
    • isConvoy

      public boolean isConvoy()
      Checks if this force type is CONVOY.
      Returns:
      true if this is the CONVOY type; otherwise, false.
    • isSecurity

      public boolean isSecurity()
      Checks if this force type is SECURITY.
      Returns:
      true if this is the SECURITY type; otherwise, false.
    • fromOrdinal

      public static ForceType fromOrdinal(int ordinal)
      Retrieves a ForceType 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 to STANDARD.