Class StreamUpdateBuilder

java.lang.Object
org.kigalisim.engine.recalc.StreamUpdateBuilder

public final class StreamUpdateBuilder extends Object
Builder for creating StreamUpdate instances.

Provides a fluent interface for constructing StreamUpdate objects with optional parameters and validation.

  • Constructor Details

    • StreamUpdateBuilder

      public StreamUpdateBuilder()
      Creates a new StreamUpdateBuilder with default values.
  • Method Details

    • setName

      public StreamUpdateBuilder setName(String name)
      Sets the stream name.
      Parameters:
      name - the stream name
      Returns:
      this builder
    • setValue

      public StreamUpdateBuilder setValue(EngineNumber value)
      Sets the stream value.
      Parameters:
      value - the stream value
      Returns:
      this builder
    • setYearMatcher

      public StreamUpdateBuilder setYearMatcher(Optional<YearMatcher> yearMatcher)
      Sets the year matcher.
      Parameters:
      yearMatcher - the year matcher
      Returns:
      this builder
    • setKey

      public StreamUpdateBuilder setKey(UseKey key)
      Sets the use key.
      Parameters:
      key - the use key
      Returns:
      this builder
    • clearKey

      public StreamUpdateBuilder clearKey()
      Clears the use key.
      Returns:
      this builder
    • setPropagateChanges

      public StreamUpdateBuilder setPropagateChanges(boolean propagateChanges)
      Sets whether changes should propagate.
      Parameters:
      propagateChanges - whether to propagate changes
      Returns:
      this builder
    • setUnitsToRecord

      public StreamUpdateBuilder setUnitsToRecord(String unitsToRecord)
      Sets the units to record.
      Parameters:
      unitsToRecord - the units to record
      Returns:
      this builder
    • clearUnitsToRecord

      public StreamUpdateBuilder clearUnitsToRecord()
      Clears the units to record.
      Returns:
      this builder
    • setSubtractRecycling

      public StreamUpdateBuilder setSubtractRecycling(boolean subtractRecycling)
      Sets whether to subtract recycling.
      Parameters:
      subtractRecycling - whether to subtract recycling
      Returns:
      this builder
    • setForceUseFullRecharge

      public StreamUpdateBuilder setForceUseFullRecharge(boolean forceUseFullRecharge)
      Sets whether to force use of full recharge.
      Parameters:
      forceUseFullRecharge - whether to force use of full recharge
      Returns:
      this builder
    • setDistribution

      public StreamUpdateBuilder setDistribution(SalesStreamDistribution distribution)
      Sets the distribution for sales streams.
      Parameters:
      distribution - the sales stream distribution
      Returns:
      this builder
    • clearDistribution

      public StreamUpdateBuilder clearDistribution()
      Clears the distribution.
      Returns:
      this builder
    • inferSubtractRecycling

      public StreamUpdateBuilder inferSubtractRecycling()
      Infers the subtractRecycling flag based on stream name and value units.
      Returns:
      this builder with subtractRecycling set appropriately
      Throws:
      RuntimeException - if name or value is null or invalid
    • build

      public StreamUpdate build()
      Builds the StreamUpdate.
      Returns:
      the built StreamUpdate
      Throws:
      IllegalStateException - if name or value is not set