Class HangarStatistics

java.lang.Object
mekhq.campaign.unit.HangarStatistics

public class HangarStatistics extends Object
Provides methods to gather statistics on units in a hangar.
  • Constructor Details

    • HangarStatistics

      public HangarStatistics(Hangar hangar)
  • Method Details

    • getHangar

      public Hangar getHangar()
    • getNumberOfUnitsByType

      public int getNumberOfUnitsByType(long type)
    • getNumberOfUnitsByType

      public int getNumberOfUnitsByType(long type, boolean inTransit)
    • tallyBaysByType

      public HashMap<Long,Integer> tallyBaysByType(boolean inTransit)
      Tallies the number of units in the hangar by their entity type or bay category.

      The returned HashMap maps entity type identifiers (or entity type plus vehicle bitmask) to the count of units of that type currently in the hangar.

      • If inTransit is false, only present (not in-transit) units are considered.
      • Mothballed units are counted using the Unit.ETYPE_MOTHBALLED key.
      • Tanks are tallied into three categories based on unit weight:
        • Light Vehicles: weight ≤ 50.0 (with LIGHT_VEHICLE_BIT)
        • Heavy Vehicles: 50.0 < weight ≤ 100.0
        • Super Heavy: weight > 100.0 (with SUPER_HEAVY_BIT)
      • Other unit types (Mek, DropShip, Small Craft, etc.) use their respective entity type long constants.
      • Infantry and BattleArmor are separated; only true Infantry (not BattleArmor) are counted under Entity.ETYPE_INFANTRY.
      • Types not covered by the checked entity classes are not included in the result.
      Parameters:
      inTransit - if true, includes units that are in transit; if false, only includes units that are present
      Returns:
      a HashMap mapping entity type (or bay type) keys to the number of distinct units of that type in the hangar
    • getNumberOfUnitsByType

      public int getNumberOfUnitsByType(long type, boolean inTransit, boolean lv)
    • getOccupiedBays

      public int getOccupiedBays(long type)
    • getOccupiedBays

      public int getOccupiedBays(long type, boolean lv)
    • getTotalMekBays

      public int getTotalMekBays()
    • getTotalASFBays

      public int getTotalASFBays()
    • getTotalSmallCraftBays

      public int getTotalSmallCraftBays()
    • getTotalBattleArmorBays

      public int getTotalBattleArmorBays()
    • getTotalInfantryBays

      public int getTotalInfantryBays()
    • getTotalHeavyVehicleBays

      public int getTotalHeavyVehicleBays()
    • getTotalSuperHeavyVehicleBays

      public int getTotalSuperHeavyVehicleBays()
    • getTotalLightVehicleBays

      public int getTotalLightVehicleBays()
    • getTotalProtoMekBays

      public int getTotalProtoMekBays()
    • getTotalDockingCollars

      public int getTotalDockingCollars()
    • getTotalLargeCraftPassengerCapacity

      public int getTotalLargeCraftPassengerCapacity()