Package megamek.common.equipment
Class EquipmentMode
java.lang.Object
megamek.common.equipment.EquipmentMode
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 Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedEquipmentMode(String name) Protected constructor since we don't allow direct creation of the mode. -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleangetActionName(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.getDisplayableName(boolean wantNormal) static EquipmentModegetName()getStateName(EquipmentType equipmentType) Returns the label to show when this mode is what the equipment currently is, or is about to become.inthashCode()booleanisArmed()booleanisHeat()booleanbooleanisOff()toString()
-
Field Details
-
modesHash
Hash of all modes -
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 constructor since we don't allow direct creation of the mode. Modes available via
getModeConstructs the new mode denoted by the given name.
- Parameters:
name- unique mode identifier
-
-
Method Details
-
getName
- Returns:
- mode name/identifier
-
getDisplayableName
- Returns:
- the localized displayable name presented by the GUI to the user.
-
getDisplayableName
- Returns:
- the localized displayable name presented by the GUI to the user.
-
getStateName
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, ornullwhen the caller has no equipment context- Returns:
- the state label, falling back to
getDisplayableName()when no state label is defined - See Also:
-
getActionName
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, ornullwhen the caller has no equipment context- Returns:
- the action label, falling back to
getDisplayableName()when no action label is defined - See Also:
-
getMode
- Parameters:
name- mode name- Returns:
- unique mode that corresponds to the given name
-
equals
-
equals
- Parameters:
modeName- The name of the mode to compare with. Overloaded just forStringclasses.- Returns:
trueif this mode equals to the mode denoted by the given name
-
toString
-
isHeat
public boolean isHeat() -
isIndirect
public boolean isIndirect() -
isArmed
public boolean isArmed() -
isOff
public boolean isOff() -
hashCode
public int hashCode()
-