Class ModifiablePerson

java.lang.Object
io.github.ai4ci.abm.Person
io.github.ai4ci.abm.ModifiablePerson
All Implemented Interfaces:
Abstraction.Entity, Abstraction.HistoricalStateProvider<PersonHistory>, Serializable

@ParametersAreNonnullByDefault @Generated({"Modifiables.generator","Person"}) @NotThreadSafe public class ModifiablePerson extends Person
A modifiable implementation of the Person type.

Use the constructor to create new modifiable instances. You may even extend this class to add some convenience methods, however most of the methods in this class are final to preserve safety and predictable invariants.

ModifiablePerson is not thread-safe

See Also:
  • Constructor Details

    • ModifiablePerson

      public ModifiablePerson()
  • Method Details

    • getId

      public final Integer getId()
      Specified by:
      getId in class Person
      Returns:
      value of id attribute
    • getOutbreak

      public final ModifiableOutbreak getOutbreak()
      Specified by:
      getOutbreak in class Person
      Returns:
      value of outbreak attribute
    • getBaseline

      public final PersonBaseline getBaseline()
      Specified by:
      getBaseline in class Person
      Returns:
      value of baseline attribute
    • getCurrentState

      public final PersonState getCurrentState()
      Specified by:
      getCurrentState in class Person
      Returns:
      value of currentState attribute
    • getDemographic

      public final PersonDemographic getDemographic()
      Specified by:
      getDemographic in class Person
      Returns:
      value of demographic attribute
    • getNextState

      public final Ephemeral<ImmutablePersonState.Builder> getNextState()
      Specified by:
      getNextState in class Person
      Returns:
      value of nextState attribute
    • getNextHistory

      public final Ephemeral<ImmutablePersonHistory.Builder> getNextHistory()
      Specified by:
      getNextHistory in class Person
      Returns:
      value of nextHistory attribute
    • getStateMachine

      public final StateMachine getStateMachine()
      Specified by:
      getStateMachine in class Person
      Returns:
      value of stateMachine attribute
    • getHistory

      public final List<PersonHistory> getHistory()
      Specified by:
      getHistory in interface Abstraction.HistoricalStateProvider<PersonHistory>
      Specified by:
      getHistory in class Person
      Returns:
      modifiable list history
    • clear

      @CanIgnoreReturnValue public ModifiablePerson clear()
      Clears the object by setting all attributes to their initial values.
      Returns:
      this for use in a chained invocation
    • from

      public ModifiablePerson from(Person instance)
      Fill this modifiable instance with attribute values from the provided Person instance. Regular attribute values will be overridden, i.e. replaced with ones of an instance. Any of the instance's absent optional values will not be copied (will not override current values). Collection elements and entries will be added, not replaced.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this for use in a chained invocation
    • from

      public ModifiablePerson from(ModifiablePerson instance)
      Fill this modifiable instance with attribute values from the provided Person instance. Regular attribute values will be overridden, i.e. replaced with ones of an instance. Any of the instance's absent optional values will not be copied (will not override current values). Collection elements and entries will be added, not replaced.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this for use in a chained invocation
    • setId

      @CanIgnoreReturnValue public ModifiablePerson setId(Integer id)
      Assigns a value to the id attribute.
      Parameters:
      id - The value for id
      Returns:
      this for use in a chained invocation
    • setOutbreak

      @CanIgnoreReturnValue public ModifiablePerson setOutbreak(Outbreak outbreak)
      Assigns a value to the outbreak attribute.
      Parameters:
      outbreak - The value for outbreak
      Returns:
      this for use in a chained invocation
    • setBaseline

      @CanIgnoreReturnValue public ModifiablePerson setBaseline(PersonBaseline baseline)
      Assigns a value to the baseline attribute.
      Parameters:
      baseline - The value for baseline
      Returns:
      this for use in a chained invocation
    • setCurrentState

      @CanIgnoreReturnValue public ModifiablePerson setCurrentState(PersonState currentState)
      Assigns a value to the currentState attribute.
      Parameters:
      currentState - The value for currentState
      Returns:
      this for use in a chained invocation
    • setDemographic

      @CanIgnoreReturnValue public ModifiablePerson setDemographic(PersonDemographic demographic)
      Assigns a value to the demographic attribute.
      Parameters:
      demographic - The value for demographic
      Returns:
      this for use in a chained invocation
    • setNextState

      @CanIgnoreReturnValue public ModifiablePerson setNextState(Ephemeral<ImmutablePersonState.Builder> nextState)
      Assigns a value to the nextState attribute.
      Parameters:
      nextState - The value for nextState
      Returns:
      this for use in a chained invocation
    • setNextHistory

      @CanIgnoreReturnValue public ModifiablePerson setNextHistory(Ephemeral<ImmutablePersonHistory.Builder> nextHistory)
      Assigns a value to the nextHistory attribute.
      Parameters:
      nextHistory - The value for nextHistory
      Returns:
      this for use in a chained invocation
    • setStateMachine

      @CanIgnoreReturnValue public ModifiablePerson setStateMachine(StateMachine stateMachine)
      Assigns a value to the stateMachine attribute.
      Parameters:
      stateMachine - The value for stateMachine
      Returns:
      this for use in a chained invocation
    • addHistory

      @CanIgnoreReturnValue public ModifiablePerson addHistory(PersonHistory element)
      Adds one element to history list.
      Parameters:
      element - The history element
      Returns:
      this for use in a chained invocation
    • addHistory

      @CanIgnoreReturnValue public final ModifiablePerson addHistory(PersonHistory... elements)
      Adds elements to history list.
      Parameters:
      elements - An array of history elements
      Returns:
      this for use in a chained invocation
    • setHistory

      @CanIgnoreReturnValue public ModifiablePerson setHistory(Iterable<? extends PersonHistory> elements)
      Sets or replaces all elements for history list.
      Parameters:
      elements - An iterable of history elements
      Returns:
      this for use in a chained invocation
    • addAllHistory

      @CanIgnoreReturnValue public ModifiablePerson addAllHistory(Iterable<? extends PersonHistory> elements)
      Adds elements to history list.
      Parameters:
      elements - An iterable of history elements
      Returns:
      this for use in a chained invocation
    • initialisedId

      public final boolean initialisedId()
      Returns true if the required attribute id is set.
      Returns:
      true if set
    • initialisedOutbreak

      public final boolean initialisedOutbreak()
      Returns true if the required attribute outbreak is set.
      Returns:
      true if set
    • initialisedBaseline

      public final boolean initialisedBaseline()
      Returns true if the required attribute baseline is set.
      Returns:
      true if set
    • initialisedCurrentState

      public final boolean initialisedCurrentState()
      Returns true if the required attribute currentState is set.
      Returns:
      true if set
    • initialisedDemographic

      public final boolean initialisedDemographic()
      Returns true if the required attribute demographic is set.
      Returns:
      true if set
    • initialisedNextState

      public final boolean initialisedNextState()
      Returns true if the required attribute nextState is set.
      Returns:
      true if set
    • initialisedNextHistory

      public final boolean initialisedNextHistory()
      Returns true if the required attribute nextHistory is set.
      Returns:
      true if set
    • initialisedStateMachine

      public final boolean initialisedStateMachine()
      Returns true if the required attribute stateMachine is set.
      Returns:
      true if set
    • unsetId

      @CanIgnoreReturnValue public final ModifiablePerson unsetId()
      Reset an attribute to its initial value.
      Returns:
      this for use in a chained invocation
    • unsetOutbreak

      @CanIgnoreReturnValue public final ModifiablePerson unsetOutbreak()
      Reset an attribute to its initial value.
      Returns:
      this for use in a chained invocation
    • unsetBaseline

      @CanIgnoreReturnValue public final ModifiablePerson unsetBaseline()
      Reset an attribute to its initial value.
      Returns:
      this for use in a chained invocation
    • unsetCurrentState

      @CanIgnoreReturnValue public final ModifiablePerson unsetCurrentState()
      Reset an attribute to its initial value.
      Returns:
      this for use in a chained invocation
    • unsetDemographic

      @CanIgnoreReturnValue public final ModifiablePerson unsetDemographic()
      Reset an attribute to its initial value.
      Returns:
      this for use in a chained invocation
    • unsetNextState

      @CanIgnoreReturnValue public final ModifiablePerson unsetNextState()
      Reset an attribute to its initial value.
      Returns:
      this for use in a chained invocation
    • unsetNextHistory

      @CanIgnoreReturnValue public final ModifiablePerson unsetNextHistory()
      Reset an attribute to its initial value.
      Returns:
      this for use in a chained invocation
    • unsetStateMachine

      @CanIgnoreReturnValue public final ModifiablePerson unsetStateMachine()
      Reset an attribute to its initial value.
      Returns:
      this for use in a chained invocation
    • isInitialized

      public final boolean isInitialized()
      Returns true if all required attributes are set, indicating that the object is initialized.
      Returns:
      true if set