Enum Class BayType

java.lang.Object
java.lang.Enum<BayType>
megamek.common.bays.BayType
All Implemented Interfaces:
Serializable, Comparable<BayType>, Constable, ITechnology, ITechnologyDelegator

public enum BayType extends Enum<BayType> implements ITechnologyDelegator
Data for various transport bay types. This is used by MekHQ for cubicle parts, but can also be used in the future for a generic bay that hold multiple types of units.
  • Enum Constant Details

    • STANDARD_CARGO

      public static final BayType STANDARD_CARGO
    • LIQUID_CARGO

      public static final BayType LIQUID_CARGO
    • REFRIGERATED_CARGO

      public static final BayType REFRIGERATED_CARGO
    • INSULATED_CARGO

      public static final BayType INSULATED_CARGO
    • LIVESTOCK_CARGO

      public static final BayType LIVESTOCK_CARGO
    • INFANTRY_FOOT

      public static final BayType INFANTRY_FOOT
    • INFANTRY_JUMP

      public static final BayType INFANTRY_JUMP
    • INFANTRY_MOTORIZED

      public static final BayType INFANTRY_MOTORIZED
    • INFANTRY_MECHANIZED

      public static final BayType INFANTRY_MECHANIZED
    • BATTLEARMOR_IS

      public static final BayType BATTLEARMOR_IS
    • BATTLEARMOR_CLAN

      public static final BayType BATTLEARMOR_CLAN
    • BATTLEARMOR_CS

      public static final BayType BATTLEARMOR_CS
    • MEK

      public static final BayType MEK
    • FIGHTER

      public static final BayType FIGHTER
    • PROTOMEK

      public static final BayType PROTOMEK
    • SMALL_CRAFT

      public static final BayType SMALL_CRAFT
    • VEHICLE_LIGHT

      public static final BayType VEHICLE_LIGHT
    • VEHICLE_HEAVY

      public static final BayType VEHICLE_HEAVY
    • VEHICLE_SH

      public static final BayType VEHICLE_SH
  • Field Details

  • Method Details

    • values

      public static BayType[] 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 BayType 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
    • getCategory

      public int getCategory()
      Bays fall into three basic categories: CATEGORY_CARGO is for bulk transport and can be sized in fractional increments (usually half ton). Capacity is the fraction of bay tonnage that is available for storage. CATEGORY_INFANTRY calculates cost based on tonnage rather than unit capacity and has no cost for aerospace units. CATEGORY_NON_INFANTRY calculates cost per cubicle. Capacity is the number of entities that can fit in a single cubicle.
      Returns:
      The category index.
    • getWeight

      public double getWeight()
      Returns:
      The tonnage weight of a single unit of the bay type. For cargo the base unit is a single ton; for units the base unit is a number of Entity units equal to the capacity.
    • getCapacity

      public double getCapacity()
      Returns:
      The capacity of a single unit of the bay type. For cargo the is the number of tons of cargo that can be stored in a single ton of bay capacity. For unit transport bays this is the Entity count for the cubicle (usually one).
    • getPersonnel

      public int getPersonnel()
      Returns:
      The number of personnel that can be housed in by each unit of the bay.
    • getCost

      public long getCost()
      Returns:
      The base cost of a single unit of the bay type. Note that the cost for infantry units (conventional and battlearmor) is per ton and not per platoon/squad and aerospace units do not pay for the cost of infantry transport bays.
    • canLoad

      public boolean canLoad(Entity en)
      Parameters:
      en - An entity to load into a bay.
      Returns:
      true if the Entity can be housed in the type of bay.
    • getTechSource

      public ITechnology getTechSource()
      Specified by:
      getTechSource in interface ITechnologyDelegator
    • getDisplayName

      public String getDisplayName()
      Returns:
      The name of the type of bay.
    • parse

      @Nullable public static BayType parse(String name)
    • getTypeForEntity

      @Nullable public static BayType getTypeForEntity(@Nullable Entity entity)
      Determines the most specific bay type required to transport the given entity. Returns the first matching non-cargo BayType based on the enum declaration order, which places more specific types before more general ones (e.g. VEHICLE_LIGHT before VEHICLE_HEAVY).

      Returns null for entities that are not transported in bays, such as DropShips (which use docking collars), JumpShips, WarShips, SpaceStations, and GunEmplacements, or when entity is null.

      Parameters:
      entity - The entity to find a bay type for
      Returns:
      The most specific BayType that can transport this entity, or null if no bay type applies
    • getTypeForBay

      public static BayType getTypeForBay(Bay bay)
      Finds the BayType that matches an existing bay.
      Parameters:
      bay - A transport bay object
      Returns:
      The BayType for the bay.