Class EquipmentChangeUtil

java.lang.Object
org.kigalisim.engine.support.EquipmentChangeUtil

public class EquipmentChangeUtil extends Object
Handles equipment stream operations with proper recharge accounting.

This class converts equipment-level operations into sales and retirement operations that properly account for recharge needs. When equipment levels change, the corresponding sales distributions and retirement rates are calculated to maintain consistency with the simulation's recharge logic.

  • Constructor Details

    • EquipmentChangeUtil

      public EquipmentChangeUtil(Engine engine)
      Creates a new EquipmentChangeUtil for the given engine.
      Parameters:
      engine - The Engine instance to operate on
  • Method Details

    • handleSet

      public void handleSet(EngineNumber targetEquipment)
      Handle setting equipment to a target value.

      Compares target equipment level with current level:

      • If higher: converts delta to sales operation (handles recharge automatically)
      • If lower: sets sales to 0 and retires excess from priorEquipment
      • If equal: no action needed

      Caller is responsible for checking year range before calling this method.

      Parameters:
      targetEquipment - The target equipment level in units
    • handleChange

      public void handleChange(EngineNumber changeAmount)
      Handle changing equipment by a delta amount.

      Supports both percentage and absolute changes:

      • Percentage: change equipment by +8%
      • Absolute: change equipment by +100 units

      Caller is responsible for checking year range before calling this method.

      Parameters:
      changeAmount - The change amount (percentage or units)
    • handleCap

      public void handleCap(EngineNumber capValue, String displaceTarget)
      Handle capping equipment to a maximum value.

      If current equipment exceeds cap, retires excess. Supports displacement to move retired equipment to another substance.

      Caller is responsible for checking year range before calling this method.

      Parameters:
      capValue - The maximum equipment level
      displaceTarget - Optional substance/stream to displace to (null for no displacement)
    • handleFloor

      public void handleFloor(EngineNumber floorValue, String displaceTarget)
      Handle flooring equipment to a minimum value.

      If current equipment is below floor, increases sales to meet minimum. Supports displacement to offset the increase.

      Caller is responsible for checking year range before calling this method.

      Parameters:
      floorValue - The minimum equipment level
      displaceTarget - Optional substance/stream to displace from (null for no displacement)