Class EquipmentChangeUtil
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 Summary
ConstructorsConstructorDescriptionEquipmentChangeUtil(Engine engine) Creates a new EquipmentChangeUtil for the given engine. -
Method Summary
Modifier and TypeMethodDescriptionvoidhandleCap(EngineNumber capValue, String displaceTarget) Handle capping equipment to a maximum value.voidhandleChange(EngineNumber changeAmount) Handle changing equipment by a delta amount.voidhandleFloor(EngineNumber floorValue, String displaceTarget) Handle flooring equipment to a minimum value.voidhandleSet(EngineNumber targetEquipment) Handle setting equipment to a target value.
-
Constructor Details
-
EquipmentChangeUtil
Creates a new EquipmentChangeUtil for the given engine.- Parameters:
engine- The Engine instance to operate on
-
-
Method Details
-
handleSet
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
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
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 leveldisplaceTarget- Optional substance/stream to displace to (null for no displacement)
-
handleFloor
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 leveldisplaceTarget- Optional substance/stream to displace from (null for no displacement)
-