Package org.kigalisim.lang.operation
Class RetireOperation
java.lang.Object
org.kigalisim.lang.operation.RetireOperation
- All Implemented Interfaces:
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 Summary
ConstructorsConstructorDescriptionRetireOperation(Operation amountOperation) Create a new RetireOperation that applies to all years.RetireOperation(Operation amountOperation, ParsedDuring during) Create a new RetireOperation that applies to a specific time period. -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute(PushDownMachine machine) Execute the retire operation on the given push-down machine.
-
Constructor Details
-
RetireOperation
Create a new RetireOperation that applies to all years.- Parameters:
amountOperation- The operation that calculates the retirement rate.
-
RetireOperation
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
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.
-