Annotation Interface Lag


@Retention(RUNTIME) @Target(FIELD) public @interface Lag
Marks a field as a lagged value to be updated at the start of each simulation time interval.

At each period update the annotated field will receive the value of its specified source, read from the same object before any lag assignments are written. This read-first semantics ensures correct behaviour for multi-period lag chains (e.g. L3 ← L2 ← L1 ← current) regardless of field declaration order.

Specify the source using exactly one of:

  • field() — name of a field on the same object to copy directly.
  • getter() — name of a no-argument getter method on the same object to invoke.

If both are specified, getter takes precedence. If neither is specified, UpdateManager.applyAnnotations(Object) will throw an IllegalArgumentException.

Example — direct field reference:

  @Lag(field = "labC4")
  private Les_c4 labC4L1;

Example — getter method:

  @Lag(getter = "getHouseholdStatus")
  private Indicator demStatusHhL1;

Example — multi-period lag chain (L2 ← L1, then L1 ← current getter):

  @Lag(field = "yEmpPersGrossMonthL1")
  private Double yEmpPersGrossMonthL2;

  @Lag(getter = "getYEmpPersGrossMonth")
  private Double yEmpPersGrossMonthL1;
See Also:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Name of the field on the same object whose value should be copied into the annotated field.
    Name of the no-argument method on the same object to invoke to obtain the source value.
  • Element Details

    • field

      String field
      Name of the field on the same object whose value should be copied into the annotated field. Ignored if getter() is also specified.
      Default:
      ""
    • getter

      String getter
      Name of the no-argument method on the same object to invoke to obtain the source value. Takes precedence over field() when both are specified.
      Default:
      ""