Package org.kigalisim.engine.recalc.util
Class DemandAnalysisBuilder
java.lang.Object
org.kigalisim.engine.support.ValidatedBuilder<DemandAnalysis>
org.kigalisim.engine.recalc.util.DemandAnalysisBuilder
Builder for demand analysis calculations in sales recalculation.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected DemandAnalysisBuild the demand analysis.setEolRecycledKg(BigDecimal eolRecycledKg) Set the end-of-life recycled material amount.setImplicitPrechargeKg(BigDecimal implicitPrechargeKg) Set the implicit precharge amount.setImplicitRechargeKg(BigDecimal implicitRechargeKg) Set the implicit recharge amount.setPrechargeVolume(EngineNumber prechargeVolume) Set the precharge volume.setRechargeRecycledKg(BigDecimal rechargeRecycledKg) Set the recharge-stage recycled material amount.setRechargeVolume(EngineNumber rechargeVolume) Set the recharge volume.setScopeEffective(UseKey scopeEffective) Set the effective scope.setSimulationState(SimulationState simulationState) Set the simulation state.setVolumeForNew(EngineNumber volumeForNew) Set the volume needed for new equipment.protected voidvalidate()Validate that all fields required to build a DemandAnalysis have been set.Methods inherited from class org.kigalisim.engine.support.ValidatedBuilder
build, requireField, requireField
-
Constructor Details
-
DemandAnalysisBuilder
public DemandAnalysisBuilder()Create a new DemandAnalysisBuilder.
-
-
Method Details
-
setRechargeVolume
Set the recharge volume.- Parameters:
rechargeVolume- The total recharge volume in kg- Returns:
- This builder for fluent chaining
-
setPrechargeVolume
Set the precharge volume.- Parameters:
prechargeVolume- The total precharge volume in kg- Returns:
- This builder for fluent chaining
-
setVolumeForNew
Set the volume needed for new equipment.- Parameters:
volumeForNew- The substance volume needed for new equipment in kg- Returns:
- This builder for fluent chaining
-
setImplicitRechargeKg
Set the implicit recharge amount.- Parameters:
implicitRechargeKg- The implicit recharge from unit-based specs in kg- Returns:
- This builder for fluent chaining
-
setImplicitPrechargeKg
Set the implicit precharge amount.- Parameters:
implicitPrechargeKg- The implicit precharge from unit-based specs in kg- Returns:
- This builder for fluent chaining
-
setEolRecycledKg
Set the end-of-life recycled material amount.- Parameters:
eolRecycledKg- The EOL recycled material in kg- Returns:
- This builder for fluent chaining
-
setRechargeRecycledKg
Set the recharge-stage recycled material amount.- Parameters:
rechargeRecycledKg- The recharge-stage recycled material in kg- Returns:
- This builder for fluent chaining
-
setSimulationState
Set the simulation state.- Parameters:
simulationState- The simulation state to query for induction rates- Returns:
- This builder for fluent chaining
-
setScopeEffective
Set the effective scope.- Parameters:
scopeEffective- The use key scope for induction rate queries- Returns:
- This builder for fluent chaining
-
buildInternal
Build the demand analysis.This method orchestrates the calculation of total demand, determination of unit-based specification preservation, calculation of required virgin material, and calculation of the recharge residual.
- Specified by:
buildInternalin classValidatedBuilder<DemandAnalysis>- Returns:
- A DemandAnalysis containing the computed demand, spec type, virgin material, and recharge residual
-
validate
protected void validate()Validate that all fields required to build a DemandAnalysis have been set.Fails fast with a clear message instead of letting a missing field surface later as a
NullPointerExceptiondeep inside demand calculation.- Specified by:
validatein classValidatedBuilder<DemandAnalysis>- Throws:
IllegalStateException- if a required field is missing
-