Class Properties

java.lang.Object
modelarium.attributes.Attributes
modelarium.attributes.Properties
All Implemented Interfaces:
DeepCopyable<Attributes>

public class Properties extends Attributes
A concrete collection class for managing Property attributes.

Properties are typed, stateful attributes that expose `get()` and `set()` methods and are evaluated each tick via their Property.run() method.

This class extends Attributes and stores only Property<?> instances.

  • Constructor Details

    • Properties

      public Properties()
  • Method Details

    • add

      public <T> void add(Property<T> property)
      Adds a single property to the collection.
      Type Parameters:
      T - the type of the property's value
      Parameters:
      property - the Property to add
    • add

      public void add(List<Property<?>> properties)
      Adds a list of properties to the collection.
      Parameters:
      properties - a list of Property instances
    • get

      public Property<?> get(String name)
      Retrieves a property by name.
      Parameters:
      name - the name of the property
      Returns:
      the matching Property, or null if not found
    • get

      public Property<?> get(int index)
      Retrieves a property by index.
      Parameters:
      index - the position of the property
      Returns:
      the Property at the specified index
    • run

      public void run()
      Executes all properties' run() methods in sequence. This is typically called once per simulation tick.
      Specified by:
      run in class Attributes
    • deepCopy

      public Properties deepCopy()