Package org.kigalisim.engine.support
Class StreamUpdateExecutor
java.lang.Object
org.kigalisim.engine.support.StreamUpdateExecutor
Handles stream update operations for sales carry-over logic.
This class provides methods to handle sales stream combinations when setting domestic or import streams with unit-based values.
-
Constructor Summary
ConstructorsConstructorDescriptionStreamUpdateExecutor(Engine engine) Creates a new StreamUpdateExecutor for the given engine. -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute(StreamUpdate update) Executes a complete stream update operation with all side effects.handleImplicitRecharge(UseKey useKey, String streamName, EngineNumber value, boolean isSales, boolean isUnits, boolean isSalesSubstream) Handles implicit recharge logic for sales streams with equipment units.voidpropagateChanges(UseKey useKey, String streamName, boolean isSales, boolean isUnits) Propagates stream changes to dependent calculations based on stream type.
-
Constructor Details
-
StreamUpdateExecutor
Creates a new StreamUpdateExecutor for the given engine.- Parameters:
engine- The Engine instance to operate on
-
-
Method Details
-
execute
Executes a complete stream update operation with all side effects.This method consolidates all stream update logic including implicit recharge, state updates, units target tracking, and change propagation into a single call.
- Parameters:
update- The StreamUpdate containing all update parameters
-
handleImplicitRecharge
public ImplicitRechargeUpdate handleImplicitRecharge(UseKey useKey, String streamName, EngineNumber value, boolean isSales, boolean isUnits, boolean isSalesSubstream) Handles implicit recharge logic for sales streams with equipment units.When users have specified how much equipment is to be sold (not total volume of substance sales), this method determines the implicit recharge needed. In this case, servicing is implied to have enough substance to succeed when the recharge command runs. For non-unit-based or non-sales streams, clears or skips implicit recharge logic as needed.
- Parameters:
useKey- The use key containing application and substancestreamName- The name of the stream being setvalue- The original value specified by the userisSales- Whether this is a sales streamisUnits- Whether the value is in equipment unitsisSalesSubstream- Whether this is a sales substream (domestic/import)- Returns:
- ImplicitRechargeUpdate containing adjusted value and optional state update
-
propagateChanges
Propagates stream changes to dependent calculations based on stream type.Different stream types require different recalculation operations:
- Sales streams (domestic, import, sales): recalc population change, propagate to consumption
- Consumption stream: recalc sales, propagate to population change
- Equipment stream: recalc sales, propagate to consumption
- PriorEquipment stream: recalc retirement only
- Other streams: no propagation
- Parameters:
useKey- The use key containing application and substancestreamName- The name of the stream that was updatedisSales- Whether this is a sales streamisUnits- Whether the value was in equipment units
-