Enum Class MissionRole

java.lang.Object
java.lang.Enum<MissionRole>
megamek.client.ratgenerator.MissionRole
All Implemented Interfaces:
Serializable, Comparable<MissionRole>, Constable

public enum MissionRole extends Enum<MissionRole>
Used to adjust availability to conform to a particular mission role.
  • Enum Constant Details

  • Method Details

    • values

      public static MissionRole[] 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 MissionRole 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
    • fitsUnitType

      public boolean fitsUnitType(int unitType)
      Identifies if a role applies to a given unit type
      Parameters:
      unitType - type of unit to check
      Returns:
      true if role applies to the provided unit type
    • adjustAvailabilityByRole

      public static Double adjustAvailabilityByRole(double avRating, Collection<MissionRole> desiredRoles, ModelRecord mRec, int year, int strictness)
      Adjusts the provided availability rating based on desired roles, the roles the provided unit has, and other factors such as unit type, movement speed, and weapon types.
      Parameters:
      avRating - Availability rating as positive number, typically 0-10
      desiredRoles - Roles that are desired or mandatory, use null for general use
      mRec - ModelRecord of specific unit to check
      year - Year to test in
      strictness - Zero or higher, larger values are more restrictive
      Returns:
      Modified avRating, higher if better suited for a specific role, lower if less suited, or null if unit is not compatible
    • parseRole

      public static MissionRole parseRole(String role)
      Convert role from string to enum. Underscores (_) are treated as spaces, all characters are forced to lower case for comparisons.
      Parameters:
      role - role name
      Returns:
      Null if an unrecognized role string is provided
    • toString

      public String toString()
      Overrides:
      toString in class Enum<MissionRole>