Class StreamUpdateShortcuts
This class provides methods to update streams without reporting units or with displacement context for correct GWP calculations. These shortcuts streamline common operations in replace and displacement handling.
-
Constructor Summary
ConstructorsConstructorDescriptionStreamUpdateShortcuts(Engine engine) Creates a new StreamUpdateShortcuts for the given engine. -
Method Summary
Modifier and TypeMethodDescriptionvoidchangeStreamWithDisplacementContext(String stream, EngineNumber amount, Scope destinationScope) Change a stream value with proper displacement context for correct GWP calculations.voidchangeStreamWithDisplacementContext(String stream, EngineNumber amount, Scope destinationScope, boolean negativeAllowed) Change a stream value with proper displacement context for correct GWP calculations.voidchangeStreamWithoutReportingUnits(String stream, EngineNumber amount, Optional<YearMatcher> yearMatcher, Optional<UseKey> scope) Change a stream value without reporting units to the last units tracking system.voidchangeStreamWithoutReportingUnits(String stream, EngineNumber amount, Optional<YearMatcher> yearMatcher, Optional<UseKey> scope, boolean negativeAllowed) Change a stream value without reporting units to the last units tracking system.
-
Constructor Details
-
StreamUpdateShortcuts
Creates a new StreamUpdateShortcuts for the given engine.- Parameters:
engine- The Engine instance to operate on
-
-
Method Details
-
changeStreamWithoutReportingUnits
public void changeStreamWithoutReportingUnits(String stream, EngineNumber amount, Optional<YearMatcher> yearMatcher, Optional<UseKey> scope) Change a stream value without reporting units to the last units tracking system.This method updates a stream value without affecting the lastSpecifiedValue tracking used for unit-based carry-over behavior. It is used when the change should not influence subsequent relative changes.
- Parameters:
stream- The stream identifier to modifyamount- The amount to change the stream byyearMatcher- Matcher to determine if the change applies to current yearscope- The scope in which to make the change
-
changeStreamWithoutReportingUnits
public void changeStreamWithoutReportingUnits(String stream, EngineNumber amount, Optional<YearMatcher> yearMatcher, Optional<UseKey> scope, boolean negativeAllowed) Change a stream value without reporting units to the last units tracking system.This method is similar to changeStreamWithDisplacementContext but without the displacement context. It allows for consistent handling of negative stream values across both methods.
- Parameters:
stream- The stream identifier to modifyamount- The amount to change the stream byyearMatcher- Matcher to determine if the change applies to current yearscope- The scope in which to make the changenegativeAllowed- If true, negative stream values are permitted
-
changeStreamWithDisplacementContext
public void changeStreamWithDisplacementContext(String stream, EngineNumber amount, Scope destinationScope) Change a stream value with proper displacement context for correct GWP calculations.This method creates a custom recalc kit that uses the destination substance's properties (GWP, initial charge, energy intensity) to ensure correct emissions calculations during displacement operations. The engine scope is temporarily switched to the destination scope for accurate unit conversion and recalculation.
- Parameters:
stream- The stream identifier to modifyamount- The amount to change the stream bydestinationScope- The scope for the destination substance
-
changeStreamWithDisplacementContext
public void changeStreamWithDisplacementContext(String stream, EngineNumber amount, Scope destinationScope, boolean negativeAllowed) Change a stream value with proper displacement context for correct GWP calculations.This method creates a custom recalc kit that uses the destination substance's properties (GWP, initial charge, energy intensity) to ensure correct emissions calculations during displacement operations. The engine scope is temporarily switched to the destination scope for accurate unit conversion and recalculation, then restored to the original scope after the operation completes.
- Parameters:
stream- The stream identifier to modifyamount- The amount to change the stream bydestinationScope- The scope for the destination substancenegativeAllowed- If true, negative stream values are permitted
-