Class ModifiableStateMachineContext

java.lang.Object
io.github.ai4ci.abm.mechanics.ModifiableStateMachineContext
All Implemented Interfaces:
StateMachineContext, Serializable

@ParametersAreNonnullByDefault @Generated({"Modifiables.generator","StateMachineContext"}) @NotThreadSafe public final class ModifiableStateMachineContext extends Object implements StateMachineContext
A modifiable implementation of the StateMachineContext type.

Use the create() static factory methods to create new instances.

ModifiableStateMachineContext is not thread-safe

See Also:
  • Method Details

    • create

      public static ModifiableStateMachineContext create()
      Construct a modifiable instance of StateMachineContext.
      Returns:
      A new modifiable instance
    • getBaselineState

      public final State<?,?,?,?> getBaselineState()
      Specified by:
      getBaselineState in interface StateMachineContext
      Returns:
      value of baselineState attribute
    • getLastState

      public final List<State<?,?,?,?>> getLastState()
      Specified by:
      getLastState in interface StateMachineContext
      Returns:
      modifiable list lastState
    • getFlags

      public final List<Boolean> getFlags()
      Specified by:
      getFlags in interface StateMachineContext
      Returns:
      modifiable list flags
    • clear

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

      Fill this modifiable instance with attribute values from the provided StateMachineContext 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

      Fill this modifiable instance with attribute values from the provided StateMachineContext 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
    • setBaselineState

      @CanIgnoreReturnValue public ModifiableStateMachineContext setBaselineState(State<?,?,?,?> baselineState)
      Assigns a value to the baselineState attribute.
      Parameters:
      baselineState - The value for baselineState
      Returns:
      this for use in a chained invocation
    • addLastState

      @CanIgnoreReturnValue public ModifiableStateMachineContext addLastState(State<?,?,?,?> element)
      Adds one element to lastState list.
      Parameters:
      element - The lastState element
      Returns:
      this for use in a chained invocation
    • addLastState

      @SafeVarargs @CanIgnoreReturnValue public final ModifiableStateMachineContext addLastState(State<?,?,?,?>... elements)
      Adds elements to lastState list.
      Parameters:
      elements - An array of lastState elements
      Returns:
      this for use in a chained invocation
    • setLastState

      @CanIgnoreReturnValue public ModifiableStateMachineContext setLastState(Iterable<? extends State<?,?,?,?>> elements)
      Sets or replaces all elements for lastState list.
      Parameters:
      elements - An iterable of lastState elements
      Returns:
      this for use in a chained invocation
    • addAllLastState

      @CanIgnoreReturnValue public ModifiableStateMachineContext addAllLastState(Iterable<? extends State<?,?,?,?>> elements)
      Adds elements to lastState list.
      Parameters:
      elements - An iterable of lastState elements
      Returns:
      this for use in a chained invocation
    • addFlag

      @CanIgnoreReturnValue public ModifiableStateMachineContext addFlag(boolean element)
      Adds one element to flags list.
      Parameters:
      element - The flags element
      Returns:
      this for use in a chained invocation
    • addFlags

      @CanIgnoreReturnValue public final ModifiableStateMachineContext addFlags(boolean... elements)
      Adds elements to flags list.
      Parameters:
      elements - An array of flags elements
      Returns:
      this for use in a chained invocation
    • setFlags

      @CanIgnoreReturnValue public ModifiableStateMachineContext setFlags(Iterable<Boolean> elements)
      Sets or replaces all elements for flags list.
      Parameters:
      elements - An iterable of flags elements
      Returns:
      this for use in a chained invocation
    • addAllFlags

      @CanIgnoreReturnValue public ModifiableStateMachineContext addAllFlags(Iterable<Boolean> elements)
      Adds elements to flags list.
      Parameters:
      elements - An iterable of flags elements
      Returns:
      this for use in a chained invocation
    • initialisedBaselineState

      public final boolean initialisedBaselineState()
      Returns true if the required attribute baselineState is set.
      Returns:
      true if set
    • unsetBaselineState

      @CanIgnoreReturnValue public final ModifiableStateMachineContext unsetBaselineState()
      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
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ModifiableStateMachineContext that have equal attribute values. An uninitialized instance is equal only to itself.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: baselineState, lastState, flags.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Generates a string representation of this StateMachineContext. If uninitialized, some attribute values may appear as question marks.
      Overrides:
      toString in class Object
      Returns:
      A string representation