Class GetStreamOperation

java.lang.Object
org.kigalisim.lang.operation.GetStreamOperation
All Implemented Interfaces:
Operation

public class GetStreamOperation extends Object implements Operation
Operation to get a stream value.

Retrieves a stream value from the engine's current scope or from a specified substance scope. Supports optional unit conversion and optional lookback to prior years via the yearsPast parameter.

  • Constructor Details

    • GetStreamOperation

      public GetStreamOperation(String streamName)
      Create a new GetStreamOperation.
      Parameters:
      streamName - The name of the stream to get.
    • GetStreamOperation

      public GetStreamOperation(String streamName, int yearsPast)
      Create a new GetStreamOperation with a lookback period.
      Parameters:
      streamName - The name of the stream to get.
      yearsPast - The number of years to look back. Zero means current year.
    • GetStreamOperation

      public GetStreamOperation(String streamName, String units)
      Create a new GetStreamOperation with unit conversion.
      Parameters:
      streamName - The name of the stream to get.
      units - The units to convert to.
    • GetStreamOperation

      public GetStreamOperation(String streamName, int yearsPast, String units)
      Create a new GetStreamOperation with unit conversion and lookback period.
      Parameters:
      streamName - The name of the stream to get.
      yearsPast - The number of years to look back. Zero means current year.
      units - The units to convert to.
    • GetStreamOperation

      public GetStreamOperation(String streamName, String targetSubstance, String units)
      Create a new GetStreamOperation with scope resolution and unit conversion.
      Parameters:
      streamName - The name of the stream to get.
      targetSubstance - The substance name to resolve to (for indirect access).
      units - The units to convert to.
    • GetStreamOperation

      public GetStreamOperation(String streamName, int yearsPast, String targetSubstance, String units)
      Create a new GetStreamOperation with scope resolution, unit conversion, and lookback period.
      Parameters:
      streamName - The name of the stream to get.
      yearsPast - The number of years to look back. Zero means current year.
      targetSubstance - The substance name to resolve to (for indirect access).
      units - The units to convert to.
  • Method Details

    • execute

      public void execute(PushDownMachine machine)
      Execute the calculation and leave the result at the top of the stack.
      Specified by:
      execute in interface Operation
      Parameters:
      machine - The machine in which to execute the calculation if needed.
    • getStaticSemantics

      public OperationStaticSemantics getStaticSemantics()
      Get a record describing this operation's semantics.

      Get a record describing this operation's semantics that are inferrable from its static expression in code. In other words, properties and effects which do not require inspection at time of executing the operation.

      Specified by:
      getStaticSemantics in interface Operation
      Returns:
      Inference of common static properties found for this operation.