Package org.kigalisim.engine.recalc
Class StreamUpdateBuilder
java.lang.Object
org.kigalisim.engine.recalc.StreamUpdateBuilder
Builder for creating StreamUpdate instances.
Provides a fluent interface for constructing StreamUpdate objects with optional parameters and validation.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new StreamUpdateBuilder with default values. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the StreamUpdate.Clears the distribution.clearKey()Clears the use key.Clears the units to record.Infers the subtractRecycling flag based on stream name and value units.setDistribution(SalesStreamDistribution distribution) Sets the distribution for sales streams.setForceUseFullRecharge(boolean forceUseFullRecharge) Sets whether to force use of full recharge.Sets the use key.Sets the stream name.setPropagateChanges(boolean propagateChanges) Sets whether changes should propagate.setSubtractRecycling(boolean subtractRecycling) Sets whether to subtract recycling.setUnitsToRecord(String unitsToRecord) Sets the units to record.setValue(EngineNumber value) Sets the stream value.setYearMatcher(Optional<YearMatcher> yearMatcher) Sets the year matcher.
-
Constructor Details
-
StreamUpdateBuilder
public StreamUpdateBuilder()Creates a new StreamUpdateBuilder with default values.
-
-
Method Details
-
setName
Sets the stream name.- Parameters:
name- the stream name- Returns:
- this builder
-
setValue
Sets the stream value.- Parameters:
value- the stream value- Returns:
- this builder
-
setYearMatcher
Sets the year matcher.- Parameters:
yearMatcher- the year matcher- Returns:
- this builder
-
setKey
Sets the use key.- Parameters:
key- the use key- Returns:
- this builder
-
clearKey
Clears the use key.- Returns:
- this builder
-
setPropagateChanges
Sets whether changes should propagate.- Parameters:
propagateChanges- whether to propagate changes- Returns:
- this builder
-
setUnitsToRecord
Sets the units to record.- Parameters:
unitsToRecord- the units to record- Returns:
- this builder
-
clearUnitsToRecord
Clears the units to record.- Returns:
- this builder
-
setSubtractRecycling
Sets whether to subtract recycling.- Parameters:
subtractRecycling- whether to subtract recycling- Returns:
- this builder
-
setForceUseFullRecharge
Sets whether to force use of full recharge.- Parameters:
forceUseFullRecharge- whether to force use of full recharge- Returns:
- this builder
-
setDistribution
Sets the distribution for sales streams.- Parameters:
distribution- the sales stream distribution- Returns:
- this builder
-
clearDistribution
Clears the distribution.- Returns:
- this builder
-
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
Builds the StreamUpdate.- Returns:
- the built StreamUpdate
- Throws:
IllegalStateException- if name or value is not set
-