Package modelarium.attributes
Class Properties
java.lang.Object
modelarium.attributes.Attributes
modelarium.attributes.Properties
- All Implemented Interfaces:
DeepCopyable<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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a list of properties to the collection.<T> voidAdds a single property to the collection.deepCopy()Property<?> get(int index) Retrieves a property by index.Property<?> Retrieves a property by name.voidrun()Executes all properties'run()methods in sequence.Methods inherited from class modelarium.attributes.Attributes
addAttribute, getAssociatedModelElement, getAttribute, getAttribute, setAssociatedModelElement, size
-
Constructor Details
-
Properties
public Properties()
-
-
Method Details
-
add
Adds a single property to the collection.- Type Parameters:
T- the type of the property's value- Parameters:
property- thePropertyto add
-
add
Adds a list of properties to the collection.- Parameters:
properties- a list ofPropertyinstances
-
get
Retrieves a property by name.- Parameters:
name- the name of the property- Returns:
- the matching
Property, or null if not found
-
get
Retrieves a property by index.- Parameters:
index- the position of the property- Returns:
- the
Propertyat the specified index
-
run
public void run()Executes all properties'run()methods in sequence. This is typically called once per simulation tick.- Specified by:
runin classAttributes
-
deepCopy
-