Package megamek.common.bays
Enum Class BayType
- All Implemented Interfaces:
Serializable,Comparable<BayType>,Constable,ITechnology,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.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intFields inherited from interface megamek.common.interfaces.ITechnology
DATE_ES, DATE_NONE, DATE_PS -
Method Summary
Modifier and TypeMethodDescriptionbooleandoubleintBays fall into three basic categories: CATEGORY_CARGO is for bulk transport and can be sized in fractional increments (usually half ton).longgetCost()intstatic BayTypegetTypeForBay(Bay bay) Finds the BayType that matches an existing bay.static BayTypegetTypeForEntity(Entity entity) Determines the most specific bay type required to transport the given entity.doublestatic BayTypestatic BayTypeReturns the enum constant of this class with the specified name.static BayType[]values()Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class java.lang.Enum
clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOfMethods inherited from interface megamek.common.interfaces.ITechnology
calcEraAvailability, calcEraAvailability, calcYearAvailability, calcYearAvailability, calcYearAvailability, findMinimumRulesLevel, findMinimumRulesLevel, getAdvancedRange, getAdvancedRange, getCodeFromIOAbbr, getCodeFromMMAbbr, getCommonDate, getEraAvailabilityName, getEraAvailabilityName, getExperimentalRange, getExperimentalRange, getExtinctionDate, getExtinctionRange, getExtinctionRange, getFullRatingName, getFullRatingName, getIntroductionDate, getProductionDate, getPrototypeDate, getReintroductionDate, getSimpleLevel, getSimpleLevel, getSimpleLevel, getStandardRange, getStandardRange, getTechLevel, getTechLevel, getTechRatingName, isAvailableIn, isAvailableIn, isAvailableIn, isExtinct, isExtinct, isExtinct, isIntroLevel, isLegal, isLegal, isUnofficialMethods inherited from interface megamek.common.interfaces.ITechnologyDelegator
getBaseAvailability, getCommonDate, getExtinctionDate, getExtinctionDate, getIntroductionDate, getIntroductionDate, getProductionDate, getProductionDate, getPrototypeDate, getPrototypeDate, getReintroductionDate, getReintroductionDate, getStaticTechLevel, getTechBase, getTechRating, isClan, isMixedTech
-
Enum Constant Details
-
STANDARD_CARGO
-
LIQUID_CARGO
-
REFRIGERATED_CARGO
-
INSULATED_CARGO
-
LIVESTOCK_CARGO
-
INFANTRY_FOOT
-
INFANTRY_JUMP
-
INFANTRY_MOTORIZED
-
INFANTRY_MECHANIZED
-
BATTLEARMOR_IS
-
BATTLEARMOR_CLAN
-
BATTLEARMOR_CS
-
MEK
-
FIGHTER
-
PROTOMEK
-
SMALL_CRAFT
-
VEHICLE_LIGHT
-
VEHICLE_HEAVY
-
VEHICLE_SH
-
-
Field Details
-
CATEGORY_CARGO
public static final int CATEGORY_CARGO- See Also:
-
CATEGORY_INFANTRY
public static final int CATEGORY_INFANTRY- See Also:
-
CATEGORY_NON_INFANTRY
public static final int CATEGORY_NON_INFANTRY- See Also:
-
-
Method Details
-
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
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 nameNullPointerException- 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
- Parameters:
en- An entity to load into a bay.- Returns:
- true if the Entity can be housed in the type of bay.
-
getTechSource
- Specified by:
getTechSourcein interfaceITechnologyDelegator
-
getDisplayName
- Returns:
- The name of the type of bay.
-
parse
-
getTypeForEntity
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_LIGHTbeforeVEHICLE_HEAVY).Returns
nullfor entities that are not transported in bays, such as DropShips (which use docking collars), JumpShips, WarShips, SpaceStations, and GunEmplacements, or whenentityisnull.- Parameters:
entity- The entity to find a bay type for- Returns:
- The most specific BayType that can transport this entity, or
nullif no bay type applies
-
getTypeForBay
Finds the BayType that matches an existing bay.- Parameters:
bay- A transport bay object- Returns:
- The BayType for the bay.
-