Package modelarium.entities.attributes
Class ReadOnlyAttribute<T extends Attribute>
java.lang.Object
modelarium.entities.attributes.ReadOnlyAttribute<T>
- Type Parameters:
T- the type of mutable attribute wrapped by this view
- Direct Known Subclasses:
ReadOnlyEvent,ReadOnlyProperty,ReadOnlyRoutine
Class for providing a read-only view of an
Attribute
This class wraps a mutable attribute so that other model elements can inspect it without being able to modify it.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedReadOnlyAttribute(T attribute) Constructs a new immutable attribute wrapping the specified mutable attribute. -
Method Summary
Modifier and TypeMethodDescriptionReturns the access level of this attribute, determining whether other entities may read it.protected TReturns the mutable version of this immutable attribute.booleanisLogged()Returns whether this attribute's state is logged as the model progresses.name()Returns the name of this attribute.
-
Constructor Details
-
ReadOnlyAttribute
Constructs a new immutable attribute wrapping the specified mutable attribute.- Parameters:
attribute- the mutable attribute to provide a read-only view of
-
-
Method Details
-
getMutableAttribute
Returns the mutable version of this immutable attribute.- Returns:
- the mutable
Attribute
-
name
Returns the name of this attribute.- Returns:
- the attribute's name
-
isLogged
public boolean isLogged()Returns whether this attribute's state is logged as the model progresses.- Returns:
- true if the attribute is logged, false otherwise
-
accessLevel
Returns the access level of this attribute, determining whether other entities may read it.- Returns:
- the attribute's
AttributeAccessLevel
-