Class EquipmentMode

java.lang.Object
megamek.common.equipment.EquipmentMode

public class EquipmentMode extends Object

Class EquipmentMode describes a Equipment's particular mode.

The getDisplayableName method allows you to obtain the localized string from a predefined ResourceBundle.

The equals function allows to check if the mode is equivalent to the mode identified by the given name.

There is no way to create the instance of the EquipmentMode directly, use EquipmentMode#getMode instead.

See Also:
  • Field Details

    • modesHash

      protected static Hashtable<String,EquipmentMode> modesHash
      Hash of all modes
    • name

      protected String name
      Unique internal mode identifier. Used as the part of the key to look for the displayable name presented to user.
  • Constructor Details

    • EquipmentMode

      protected EquipmentMode(String name)

      Protected constructor since we don't allow direct creation of the mode. Modes available via getMode

      Constructs the new mode denoted by the given name.

      Parameters:
      name - unique mode identifier
  • Method Details

    • getName

      public String getName()
      Returns:
      mode name/identifier
    • getDisplayableName

      public String getDisplayableName()
      Returns:
      the localized displayable name presented by the GUI to the user.
    • getDisplayableName

      public String getDisplayableName(boolean wantNormal)
      Returns:
      the localized displayable name presented by the GUI to the user.
    • getStateName

      public String getStateName(@Nullable EquipmentType equipmentType)
      Returns the label to show when this mode is what the equipment currently is, or is about to become. Some systems read naturally as a command when offered as a choice but not as a description of a state - Enhanced Imaging is selected with "Engage Enhanced Imaging" but, once running, is described as "Enhanced Imaging Engaged".
      Parameters:
      equipmentType - the equipment the mode belongs to, or null when the caller has no equipment context
      Returns:
      the state label, falling back to getDisplayableName() when no state label is defined
      See Also:
    • getActionName

      public String getActionName(@Nullable EquipmentType equipmentType)
      Returns the label to show when this mode is offered to the player as a change they can make, such as an entry in the unit display's mode dropdown.
      Parameters:
      equipmentType - the equipment the mode belongs to, or null when the caller has no equipment context
      Returns:
      the action label, falling back to getDisplayableName() when no action label is defined
      See Also:
    • getMode

      public static EquipmentMode getMode(String name)
      Parameters:
      name - mode name
      Returns:
      unique mode that corresponds to the given name
    • equals

      public boolean equals(Object modeName)
      Overrides:
      equals in class Object
      Parameters:
      modeName - The name of the mode to compare with. Overloaded just for String classes.
      Returns:
      true if this mode equals to the mode denoted by the given name
    • equals

      public boolean equals(String modeName)
      Parameters:
      modeName - The name of the mode to compare with. Overloaded just for String classes.
      Returns:
      true if this mode equals to the mode denoted by the given name
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isHeat

      public boolean isHeat()
    • isIndirect

      public boolean isIndirect()
    • isArmed

      public boolean isArmed()
    • isOff

      public boolean isOff()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object