Class RetireWithReplacementOperation

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

public class RetireWithReplacementOperation extends Object implements Operation
Operation that retires equipment and immediately replaces it by increasing sales.

This operation executes a normal retirement and then increases sales by the same amount, effectively maintaining the equipment population while simulating equipment turnover.

  • Constructor Details

    • RetireWithReplacementOperation

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

      public RetireWithReplacementOperation(Operation amountOperation, ParsedDuring during)
      Create a new RetireWithReplacementOperation 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 and replacement operation.
      This operation executes a normal retirement and then increases sales by the actual retirement amount, effectively maintaining the equipment population while simulating equipment turnover. The operation:
      • Executes the amount operation to calculate the retirement rate
      • Validates that the current year is in the specified time range
      • Checks for mixed retire commands with and without replacement
      • Determines target units for replacement based on last specified sales units
      • Measures equipment before and after retirement to calculate actual reduction
      • Increases sales by the actual reduction amount to replace retired equipment
      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.