Class TestSmallCraft

All Implemented Interfaces:
TestEntityOption

public class TestSmallCraft extends TestAero
Class for testing and validating instantiations for Small Craft and Drop-ships.
  • Field Details

  • Constructor Details

  • Method Details

    • legalArmorsFor

      public static List<ArmorType> legalArmorsFor(ITechManager techManager)
      Filters all small craft/drop-ship armor according to given tech constraints
      Parameters:
      techManager - Used to check the tech constraints
      Returns:
      A list of all armors that meet the tech constraints
    • maxArmorPoints

      public static int maxArmorPoints(SmallCraft sc)
    • maxArmorWeight

      public static double maxArmorWeight(SmallCraft smallCraft)
      Computes the maximum number armor level in tons
    • extraSlotCost

      public static double[] extraSlotCost(SmallCraft sc)
      Computes the amount of weight required for fire control systems and power distribution systems for exceeding the base limit of weapons per firing arc.

      Spheroid aft side arcs are implemented as rear-mounted; the return value uses the index of forward side + 3 for the aft side arcs.

      Parameters:
      sc - The small craft/drop-ship in question
      Returns:
      Returns a double array, where each element corresponds to a location and the value is the extra tonnage required by exceeding the base allotment
    • calculateEngineTonnage

      public static double calculateEngineTonnage(boolean clan, double tonnage, int desiredSafeThrust, boolean dropship, int year)
      Computes the weight of the engine.
      Parameters:
      clan - Whether the unit is a Clan design
      tonnage - The weight of the unit
      desiredSafeThrust - The safe thrust value
      dropship - Whether the unit is a drop-ship (only relevant for primitives)
      year - The original construction year (only relevant for primitives)
      Returns:
      The weight of the engine in tons
    • weightFreeHeatSinks

      public static int weightFreeHeatSinks(SmallCraft sc)
    • smallCraftEngineMultiplier

      public static double smallCraftEngineMultiplier(int year)
    • smallCraftControlMultiplier

      public static double smallCraftControlMultiplier(int year)
    • dropshipEngineMultiplier

      public static double dropshipEngineMultiplier(int year)
    • dropshipControlMultiplier

      public static double dropshipControlMultiplier(int year)
    • minimumBaseCrew

      public static int minimumBaseCrew(SmallCraft sc)
      Returns:
      Minimum crew requirements based on unit type and equipment crew requirements.
    • getEntity

      public Entity getEntity()
      Overrides:
      getEntity in class TestAero
    • isSmallCraft

      public boolean isSmallCraft()
      Overrides:
      isSmallCraft in class TestAero
    • getWeightControls

      public double getWeightControls()
      Overrides:
      getWeightControls in class TestAero
    • getWeightEngine

      public double getWeightEngine()
      Overrides:
      getWeightEngine in class TestAero
    • printWeightEngine

      public String printWeightEngine()
      Overrides:
      printWeightEngine in class TestEntity
    • getWeightFuel

      public double getWeightFuel()
      Overrides:
      getWeightFuel in class TestAero
    • getCountHeatSinks

      public int getCountHeatSinks()
      Overrides:
      getCountHeatSinks in class TestAero
    • getWeightHeatSinks

      public double getWeightHeatSinks()
      Overrides:
      getWeightHeatSinks in class TestAero
    • getWeightAmmo

      public double getWeightAmmo()
      Overrides:
      getWeightAmmo in class TestEntity
    • getWeightMisc

      public double getWeightMisc()
      Overrides:
      getWeightMisc in class TestAero
    • printWeightMisc

      public String printWeightMisc()
      Overrides:
      printWeightMisc in class TestAero
    • printWeapon

      public StringBuffer printWeapon()
      Overrides:
      printWeapon in class TestEntity
    • printAmmo

      public StringBuffer printAmmo()
      Overrides:
      printAmmo in class TestEntity
    • hasDoubleHeatSinks

      public boolean hasDoubleHeatSinks()
      Overrides:
      hasDoubleHeatSinks in class TestAero
    • printWeightControls

      public String printWeightControls()
      Overrides:
      printWeightControls in class TestAero
    • printWeightFuel

      public String printWeightFuel()
      Overrides:
      printWeightFuel in class TestAero
    • getAero

      public Aero getAero()
      Overrides:
      getAero in class TestAero
    • getSmallCraft

      public SmallCraft getSmallCraft()
    • correctArmor

      public boolean correctArmor(StringBuffer buff)
      Checks to see if this unit has valid armor assignment.
      Overrides:
      correctArmor in class TestAero
      Parameters:
      buff - A buffer that collects messages about validation failures
      Returns:
      Whether the unit's armor is valid
    • correctHeatSinks

      public boolean correctHeatSinks(StringBuffer buff)
      Checks that the heatsink type is a legal value.
      Overrides:
      correctHeatSinks in class TestAero
      Parameters:
      buff - A buffer that collects messages about validation failures
      Returns:
      Whether the unit's heat sinks are valid.
    • correctEntity

      public boolean correctEntity(StringBuffer buff, int ammoTechLvl)
      Overrides:
      correctEntity in class TestAero
    • hasIllegalEquipmentCombinations

      public boolean hasIllegalEquipmentCombinations(StringBuffer buff)
      Description copied from class: TestEntity
      Check if the unit has combinations of equipment which are not allowed in the construction rules.
      Overrides:
      hasIllegalEquipmentCombinations in class TestEntity
      Parameters:
      buff - diagnostics are appended to this
      Returns:
      true if the entity is illegal
    • correctCrew

      public boolean correctCrew(StringBuffer buffer)
      Checks that the unit meets minimum crew and quarters requirements.
      Parameters:
      buffer - Where to write messages explaining failures.
      Returns:
      true if the crew data is valid.
    • printEntity

      public StringBuffer printEntity()
      Overrides:
      printEntity in class TestAero
    • calculateWeightExact

      public double calculateWeightExact()
      Description copied from class: TestEntity
      According to TM p.22, unit weights are to be rounded up to the nearest half ton or kilo, but in MML for construction at least we should be able to show the exact weight. This method returns the unrounded weight.
      Overrides:
      calculateWeightExact in class TestAero
      Returns:
      The unrounded weight of the unit.
    • printWeightCalculation

      public String printWeightCalculation()
      Overrides:
      printWeightCalculation in class TestAero
    • printLocations

      public String printLocations()
      Overrides:
      printLocations in class TestAero
    • getName

      public String getName()
      Overrides:
      getName in class TestAero