Package org.kigalisim.engine.state
Class FrozenPriorEquipmentBases
java.lang.Object
org.kigalisim.engine.state.FrozenPriorEquipmentBases
- All Implemented Interfaces:
PriorEquipmentBases
Immutable snapshot of
PriorEquipmentBases state.
Holds only final fields populated at construction and throws
UnsupportedOperationException from every mutator, so a snapshot
captured for a prior-year lookup can never be silently corrupted.
-
Constructor Summary
ConstructorsConstructorDescriptionFrozenPriorEquipmentBases(Optional<EngineNumber> retirementBasePopulation, Optional<EngineNumber> appliedRetirementAmount, boolean hasReplacementThisStep, boolean retireCalculatedThisStep, Optional<EngineNumber> rechargeBasePopulation, Optional<EngineNumber> appliedRechargeAmount, Optional<EngineNumber> prechargeBasePopulation, Optional<EngineNumber> appliedPrechargeAmount, boolean recyclingCalculatedThisStep) Create a new immutable snapshot with the specified field values. -
Method Summary
Modifier and TypeMethodDescriptionfreeze()Get an immutable snapshot of this instance.Get the applied precharge amount.Get the applied recharge amount.Get the applied retirement amount.booleanGet whether replacement was used in this step's retire commands.Get the precharge base population.Get the recharge base population.booleanGet whether recycling has been calculated this step.booleanGet whether retire has been calculated this step.Get the retirement base population.voidReset all tracking state at the beginning of a timestep.voidSet the applied precharge amount.voidSet the applied recharge amount.voidSet the applied retirement amount.voidsetHasReplacementThisStep(boolean value) Set whether replacement is used in this step's retire commands.voidSet the precharge base population.voidSet the recharge base population.voidsetRecyclingCalculatedThisStep(boolean calculated) Set whether recycling has been calculated this step.voidsetRetireCalculatedThisStep(boolean calculated) Set whether retire has been calculated this step.voidSet the retirement base population.
-
Constructor Details
-
FrozenPriorEquipmentBases
public FrozenPriorEquipmentBases(Optional<EngineNumber> retirementBasePopulation, Optional<EngineNumber> appliedRetirementAmount, boolean hasReplacementThisStep, boolean retireCalculatedThisStep, Optional<EngineNumber> rechargeBasePopulation, Optional<EngineNumber> appliedRechargeAmount, Optional<EngineNumber> prechargeBasePopulation, Optional<EngineNumber> appliedPrechargeAmount, boolean recyclingCalculatedThisStep) Create a new immutable snapshot with the specified field values.- Parameters:
retirementBasePopulation- The retirement base population, or empty if not capturedappliedRetirementAmount- The total amount already retired this stephasReplacementThisStep- Whether replacement was used in this step's retire commandsretireCalculatedThisStep- Whether retire has been calculated this steprechargeBasePopulation- The recharge base population, or empty if not capturedappliedRechargeAmount- The total amount already recharged this step in kgprechargeBasePopulation- The precharge base population, or empty if not capturedappliedPrechargeAmount- The total amount already precharged this step in kgrecyclingCalculatedThisStep- Whether recycling has been calculated this step
-
-
Method Details
-
getRetirementBasePopulation
Get the retirement base population.- Specified by:
getRetirementBasePopulationin interfacePriorEquipmentBases- Returns:
- The base population, or empty if not yet captured this step
-
setRetirementBasePopulation
Set the retirement base population.- Specified by:
setRetirementBasePopulationin interfacePriorEquipmentBases- Parameters:
value- The base population value- Throws:
UnsupportedOperationException- always, since this instance is frozen
-
getAppliedRetirementAmount
Get the applied retirement amount.- Specified by:
getAppliedRetirementAmountin interfacePriorEquipmentBases- Returns:
- The total amount already retired this step
-
setAppliedRetirementAmount
Set the applied retirement amount.- Specified by:
setAppliedRetirementAmountin interfacePriorEquipmentBases- Parameters:
value- The total amount retired this step- Throws:
UnsupportedOperationException- always, since this instance is frozen
-
getHasReplacementThisStep
public boolean getHasReplacementThisStep()Get whether replacement was used in this step's retire commands.- Specified by:
getHasReplacementThisStepin interfacePriorEquipmentBases- Returns:
- true if with replacement, false if without replacement
-
setHasReplacementThisStep
public void setHasReplacementThisStep(boolean value) Set whether replacement is used in this step's retire commands.- Specified by:
setHasReplacementThisStepin interfacePriorEquipmentBases- Parameters:
value- true for with replacement, false for without replacement- Throws:
UnsupportedOperationException- always, since this instance is frozen
-
getRetireCalculatedThisStep
public boolean getRetireCalculatedThisStep()Get whether retire has been calculated this step.- Specified by:
getRetireCalculatedThisStepin interfacePriorEquipmentBases- Returns:
- true if retire was calculated, false otherwise
-
setRetireCalculatedThisStep
public void setRetireCalculatedThisStep(boolean calculated) Set whether retire has been calculated this step.- Specified by:
setRetireCalculatedThisStepin interfacePriorEquipmentBases- Parameters:
calculated- true if retire was calculated, false otherwise- Throws:
UnsupportedOperationException- always, since this instance is frozen
-
getRechargeBasePopulation
Get the recharge base population.- Specified by:
getRechargeBasePopulationin interfacePriorEquipmentBases- Returns:
- The base population, or empty if not yet captured this step
-
setRechargeBasePopulation
Set the recharge base population.- Specified by:
setRechargeBasePopulationin interfacePriorEquipmentBases- Parameters:
value- The base population value- Throws:
UnsupportedOperationException- always, since this instance is frozen
-
getAppliedRechargeAmount
Get the applied recharge amount.- Specified by:
getAppliedRechargeAmountin interfacePriorEquipmentBases- Returns:
- The total amount already recharged this step in kg
-
setAppliedRechargeAmount
Set the applied recharge amount.- Specified by:
setAppliedRechargeAmountin interfacePriorEquipmentBases- Parameters:
value- The total amount recharged this step in kg- Throws:
UnsupportedOperationException- always, since this instance is frozen
-
getPrechargeBasePopulation
Get the precharge base population.- Specified by:
getPrechargeBasePopulationin interfacePriorEquipmentBases- Returns:
- The base population, or empty if not yet captured this step
-
setPrechargeBasePopulation
Set the precharge base population.- Specified by:
setPrechargeBasePopulationin interfacePriorEquipmentBases- Parameters:
value- The base population value- Throws:
UnsupportedOperationException- always, since this instance is frozen
-
getAppliedPrechargeAmount
Get the applied precharge amount.- Specified by:
getAppliedPrechargeAmountin interfacePriorEquipmentBases- Returns:
- The total amount already precharged this step in kg
-
setAppliedPrechargeAmount
Set the applied precharge amount.- Specified by:
setAppliedPrechargeAmountin interfacePriorEquipmentBases- Parameters:
value- The total amount precharged this step in kg- Throws:
UnsupportedOperationException- always, since this instance is frozen
-
getRecyclingCalculatedThisStep
public boolean getRecyclingCalculatedThisStep()Get whether recycling has been calculated this step.- Specified by:
getRecyclingCalculatedThisStepin interfacePriorEquipmentBases- Returns:
- true if recycling was calculated, false otherwise
-
setRecyclingCalculatedThisStep
public void setRecyclingCalculatedThisStep(boolean calculated) Set whether recycling has been calculated this step.- Specified by:
setRecyclingCalculatedThisStepin interfacePriorEquipmentBases- Parameters:
calculated- true if recycling was calculated, false otherwise- Throws:
UnsupportedOperationException- always, since this instance is frozen
-
resetStateAtTimestep
public void resetStateAtTimestep()Reset all tracking state at the beginning of a timestep.- Specified by:
resetStateAtTimestepin interfacePriorEquipmentBases- Throws:
UnsupportedOperationException- always, since this instance is frozen
-
freeze
Get an immutable snapshot of this instance.The snapshot shares immutable
EngineNumber-typed values by reference but does not share mutable containers, so later mutation of this instance does not affect the snapshot.- Specified by:
freezein interfacePriorEquipmentBases- Returns:
- this same instance, since it is already frozen
-