Package modelarium.entities.attributes
Class AttributeBase<C extends Context>
java.lang.Object
modelarium.entities.attributes.AttributeBase<C>
- Type Parameters:
C- the type of context this attribute is given
- All Implemented Interfaces:
Attribute
public abstract non-sealed class AttributeBase<C extends Context>
extends Object
implements Attribute
Abstract class for providing the shared state and behaviour of all attribute types.
This class is responsible for storing an attribute's name, access level and logging flag, along with the
context the attribute uses to interact with the rest of the model. It is extended by Property,
Event and Routine.
-
Constructor Summary
ConstructorsConstructorDescriptionAttributeBase(String name, boolean isLogged, AttributeAccessLevel accessLevel) Constructs a new attribute with the specified name, logging flag and access level. -
Method Summary
Modifier and TypeMethodDescriptionReturns the access level of this attribute, determining whether other entities may read it.protected Ccontext()Returns the context this attribute uses to interact with the rest of the model.booleanisLogged()Returns whether this attribute's state is logged as the model progresses.name()Returns the name of this attribute.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface modelarium.entities.attributes.Attribute
getAsImmutable, run
-
Constructor Details
-
AttributeBase
Constructs a new attribute with the specified name, logging flag and access level.- Parameters:
name- the name of the attribute, used to identify it within its attribute setisLogged- whether the attribute's state is logged as the model progressesaccessLevel- the access level of the attribute, determining whether other entities may read it
-
-
Method Details
-
name
Returns the name of this attribute. -
isLogged
public boolean isLogged()Returns whether this attribute's state is logged as the model progresses. -
context
Returns the context this attribute uses to interact with the rest of the model.- Returns:
- the attribute's context, or null if it has not yet been set
-
accessLevel
Returns the access level of this attribute, determining whether other entities may read it.- Specified by:
accessLevelin interfaceAttribute- Returns:
- the attribute's
AttributeAccessLevel
-