Class ImplicitRechargeUpdateBuilder

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

public final class ImplicitRechargeUpdateBuilder extends Object
Fluent builder for implicit recharge and precharge calculations.

Configure the builder with the stream context (use key, stream name, value, flags) and the supporting state access (simulation state, unit converter, base state getter, and the precomputed recharge volume), then call buildUpdate() for unit-based sales updates or buildClear() to clear the implicit streams for volume-based sales.

  • Constructor Details

    • ImplicitRechargeUpdateBuilder

      public ImplicitRechargeUpdateBuilder()
  • Method Details

    • setUseKey

      public ImplicitRechargeUpdateBuilder setUseKey(UseKey useKey)
      Sets the use key containing application and substance.
      Parameters:
      useKey - The use key for the operation
      Returns:
      This builder for fluent chaining
    • setStreamName

      public ImplicitRechargeUpdateBuilder setStreamName(String streamName)
      Sets the name of the stream being set.
      Parameters:
      streamName - The stream name being updated
      Returns:
      This builder for fluent chaining
    • setValue

      Sets the original value specified by the user.
      Parameters:
      value - The value being set for the stream
      Returns:
      This builder for fluent chaining
    • setIsSalesSubstream

      public ImplicitRechargeUpdateBuilder setIsSalesSubstream(boolean isSalesSubstream)
      Sets whether this is a sales substream (domestic or import).
      Parameters:
      isSalesSubstream - True if the stream is a sales substream
      Returns:
      This builder for fluent chaining
    • setIsSales

      public ImplicitRechargeUpdateBuilder setIsSales(boolean isSales)
      Sets whether this is a sales stream.
      Parameters:
      isSales - True if the stream is a sales stream
      Returns:
      This builder for fluent chaining
    • setSimulationState

      public ImplicitRechargeUpdateBuilder setSimulationState(SimulationState simulationState)
      Sets the simulation state used to query recharge and precharge configuration.
      Parameters:
      simulationState - The simulation state (stream keeper) to query
      Returns:
      This builder for fluent chaining
    • setUnitConverter

      public ImplicitRechargeUpdateBuilder setUnitConverter(UnitConverter unitConverter)
      Sets the unit converter used to convert the user-specified value.
      Parameters:
      unitConverter - The unit converter for value conversion
      Returns:
      This builder for fluent chaining
    • setStateGetter

      public ImplicitRechargeUpdateBuilder setStateGetter(StateGetter stateGetter)
      Sets the base state getter used when constructing the precharge converter.
      Parameters:
      stateGetter - The base state getter for precharge conversions
      Returns:
      This builder for fluent chaining
    • setRechargeVolume

      public ImplicitRechargeUpdateBuilder setRechargeVolume(EngineNumber rechargeVolume)
      Sets the precomputed recharge volume to apply.
      Parameters:
      rechargeVolume - The recharge volume in kg, as computed by RechargeVolumeCalculator
      Returns:
      This builder for fluent chaining
    • buildUpdate

      public ImplicitRechargeUpdate buildUpdate()
      Builds the implicit servicing update for a unit-based sales stream.

      This combines the recharge portion (always applied) and, when the user has configured a non-zero precharge population, the precharge portion into a single ImplicitRechargeUpdate that adjusts the stream value and records the implicit servicing volumes.

      Returns:
      An ImplicitRechargeUpdate with the adjusted value and state updates
    • buildClear

      public ImplicitRechargeUpdate buildClear()
      Builds a clear operation for a volume-based sales stream.

      For sales streams set without equipment units, the implicit recharge and precharge streams are zeroed out. For non-sales streams, no implicit servicing is needed and an empty update is returned.

      Returns:
      An ImplicitRechargeUpdate clearing the implicit streams if needed