Class RetireExactOperation
- All Implemented Interfaces:
Operation
retire N year old exact shortcut.
Delegates the actual retirement to the existing units-based retirement path once the
age-N cohort's size is computed by amountOperation, optionally replacing retired
equipment to maintain population the same way RetireWithReplacementOperation and
RetireWeibullOperation do. Kept as its own operation type rather than reusing
RetireOperation / RetireWithReplacementOperation directly so that
ProgramValidator can flag it when combined with a directly-set
priorEquipment, whose age this shortcut's sales-history lookup cannot see, unless
assumingNew is set.
-
Constructor Summary
ConstructorsConstructorDescriptionRetireExactOperation(Operation amountOperation, int ageYears, boolean assumingNew, boolean withReplacement) Create a new RetireExactOperation that applies to all years.RetireExactOperation(Operation amountOperation, int ageYears, boolean assumingNew, boolean withReplacement, ParsedDuring during) Create a new RetireExactOperation that applies to a specific time period. -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute(PushDownMachine machine) Execute the exact retire operation on the given push-down machine.booleanWhether prior equipment is treated as a pseudo-cohort assumed to have entered service when the simulation began.
-
Constructor Details
-
RetireExactOperation
public RetireExactOperation(Operation amountOperation, int ageYears, boolean assumingNew, boolean withReplacement) Create a new RetireExactOperation that applies to all years.- Parameters:
amountOperation- The operation that calculates the age-N cohort size to retire.ageYears- The exact age in years at which the cohort retires.assumingNew- Whether prior equipment should be treated as a pseudo-cohort assumed to have entered service when the simulation began (theassuming newmodifier).withReplacement- Whether retired equipment should be replaced to maintain population.
-
RetireExactOperation
public RetireExactOperation(Operation amountOperation, int ageYears, boolean assumingNew, boolean withReplacement, ParsedDuring during) Create a new RetireExactOperation that applies to a specific time period.- Parameters:
amountOperation- The operation that calculates the age-N cohort size to retire.ageYears- The exact age in years at which the cohort retires.assumingNew- Whether prior equipment should be treated as a pseudo-cohort assumed to have entered service when the simulation began (theassuming newmodifier).withReplacement- Whether retired equipment should be replaced to maintain population.during- The time period during which this operation applies.
-
-
Method Details
-
getAssumingNew
public boolean getAssumingNew()Whether prior equipment is treated as a pseudo-cohort assumed to have entered service when the simulation began.- Returns:
- true if the
assuming newmodifier is set
-
execute
Execute the exact retire operation on the given push-down machine.Evaluates the amount operation to get the size of the age-N cohort, 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. With
assuming new, any priorEquipment not explained by tracked sales cohorts is added to the retirement amount in the one year the simulation reaches the given age (as if that stock had entered service when the simulation began). The cohort is then retired, replacing it to maintain population whenwithReplacementis set.
-