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

public abstract class ReadOnlyAttribute<T extends Attribute> extends Object
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 Details

    • ReadOnlyAttribute

      protected ReadOnlyAttribute(T attribute)
      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

      protected T getMutableAttribute()
      Returns the mutable version of this immutable attribute.
      Returns:
      the mutable Attribute
    • name

      public String 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

      public AttributeAccessLevel accessLevel()
      Returns the access level of this attribute, determining whether other entities may read it.
      Returns:
      the attribute's AttributeAccessLevel