Class UpdateManager

java.lang.Object
simpaths.model.annotations.UpdateManager

public final class UpdateManager extends Object
Reflection-based processor that applies Lag and NullInitialised annotations at the start of each simulation time interval.

Processing order

  1. Read phase — all Lag-annotated fields have their source values read (via field reference or getter) and cached before any writes occur.
  2. Lag write phase — all cached lag values are written to their annotated fields.
  3. Null phase — all NullInitialised-annotated fields are set to null.

Reading all sources before writing any lag field guarantees correct behaviour for multi-period lag chains regardless of field declaration order. For example:

  L3 ← L2  (reads L2 before L2 is overwritten by the L2←L1 assignment)
  L2 ← L1  (reads L1 before L1 is overwritten by the L1←current assignment)
  L1 ← current

Typical usage in an entity's update method

  // In Person.updateLaggedVariables() or BenefitUnit.updateAttributes():
  UpdateManager.applyAnnotations(this);
See Also:
  • Method Details

    • applyAnnotations

      public static void applyAnnotations(Object entity)
      Applies all Lag and NullInitialised annotations on the given entity, walking the full class hierarchy.
      Parameters:
      entity - the object whose annotated fields should be updated; must not be null
      Throws:
      IllegalArgumentException - if a Lag annotation specifies neither field nor getter, or if NullInitialised is placed on a primitive field
      RuntimeException - wrapping any reflection error encountered during processing