Class RetireOperation

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

public class RetireOperation extends Object implements Operation
Operation that retires a percentage of equipment each year.

This operation calculates a retirement rate and applies it to the engine. It can optionally be limited to a specific time period using a ParsedDuring object.

  • Constructor Details

    • RetireOperation

      public RetireOperation(Operation amountOperation)
      Create a new RetireOperation that applies to all years.
      Parameters:
      amountOperation - The operation that calculates the retirement rate.
    • RetireOperation

      public RetireOperation(Operation amountOperation, ParsedDuring during)
      Create a new RetireOperation that applies to a specific time period.
      Parameters:
      amountOperation - The operation that calculates the retirement rate.
      during - The time period during which this operation applies.
  • Method Details

    • execute

      public void execute(PushDownMachine machine)
      Execute the retire operation on the given push-down machine.
      Evaluates the amount operation to get the retirement rate, builds a year matcher from the optional during clause, and checks if this operation should execute in the current year. If the year is in range, validates that retire commands are not mixed with and without replacement in the same step, then applies the retirement to the engine.
      Specified by:
      execute in interface Operation
      Parameters:
      machine - The push-down machine context for evaluating operations.