Class StreamUpdateShortcuts

java.lang.Object
org.kigalisim.engine.support.StreamUpdateShortcuts

public class StreamUpdateShortcuts extends Object
Handles stream update shortcut operations for displacement and replacement.

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 Details

    • StreamUpdateShortcuts

      public StreamUpdateShortcuts(Engine engine)
      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 modify
      amount - The amount to change the stream by
      yearMatcher - Matcher to determine if the change applies to current year
      scope - 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 modify
      amount - The amount to change the stream by
      yearMatcher - Matcher to determine if the change applies to current year
      scope - The scope in which to make the change
      negativeAllowed - 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 modify
      amount - The amount to change the stream by
      destinationScope - 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 modify
      amount - The amount to change the stream by
      destinationScope - The scope for the destination substance
      negativeAllowed - If true, negative stream values are permitted