Package modelarium.entities.readonly
Class ReadOnlyAgent
java.lang.Object
modelarium.entities.readonly.ReadOnlyEntity<AgentSimulationContext,AgentContext,AgentAttributeSet,AttributeSetLog<AgentSimulationContext>>
modelarium.entities.readonly.ReadOnlyAgent
public final class ReadOnlyAgent
extends ReadOnlyEntity<AgentSimulationContext,AgentContext,AgentAttributeSet,AttributeSetLog<AgentSimulationContext>>
Class for providing a read-only view of an
Agent.
This class wraps a mutable agent so that other model elements can inspect it without being able to modify it.
-
Constructor Summary
ConstructorsConstructorDescriptionReadOnlyAgent(Agent entity) Constructs a new immutable agent wrapping the specified mutable agent. -
Method Summary
Modifier and TypeMethodDescriptiongetAttributeSet(int attributeSetIndex) Retrieves a read-only view of one of the wrapped agent's attribute sets by index.getAttributeSet(String attributeSetName) Retrieves a read-only view of one of the wrapped agent's attribute sets by name.Retrieves a read-only view of an event attribute from one of the wrapped agent's attribute sets.getProperty(String attributeSetName, String propertyName) Retrieves a read-only view of a property attribute from one of the wrapped agent's attribute sets.getRoutine(String attributeSetName, String routineName) Retrieves a read-only view of a routine attribute from one of the wrapped agent's attribute sets.booleanisDead()Returns whether the agent is dead or not.Methods inherited from class modelarium.entities.readonly.ReadOnlyEntity
attributeCount, attributeSetCount, getLog, getMutableEntity, name
-
Constructor Details
-
ReadOnlyAgent
Constructs a new immutable agent wrapping the specified mutable agent.- Parameters:
entity- the mutable agent to provide a read-only view of
-
-
Method Details
-
getAttributeSet
Retrieves a read-only view of one of the wrapped agent's attribute sets by index.- Specified by:
getAttributeSetin classReadOnlyEntity<AgentSimulationContext,AgentContext, AgentAttributeSet, AttributeSetLog<AgentSimulationContext>> - Parameters:
attributeSetIndex- the index of the attribute set to retrieve- Returns:
- a new
ReadOnlyAgentAttributeSetinstance wrapping the attribute set at the specified index
-
getAttributeSet
Retrieves a read-only view of one of the wrapped agent's attribute sets by name.- Specified by:
getAttributeSetin classReadOnlyEntity<AgentSimulationContext,AgentContext, AgentAttributeSet, AttributeSetLog<AgentSimulationContext>> - Parameters:
attributeSetName- the name of the attribute set to retrieve- Returns:
- a new
ReadOnlyAgentAttributeSetinstance wrapping the attribute set with the specified name
-
getEvent
Retrieves a read-only view of an event attribute from one of the wrapped agent's attribute sets.- Parameters:
attributeSetName- the name of the attribute set containing the eventeventName- the name of the event to retrieve- Returns:
- the
ReadOnlyEventwith the specified name
-
getRoutine
Retrieves a read-only view of a routine attribute from one of the wrapped agent's attribute sets.- Parameters:
attributeSetName- the name of the attribute set containing the routineroutineName- the name of the routine to retrieve- Returns:
- the
ReadOnlyRoutinewith the specified name
-
getProperty
Retrieves a read-only view of a property attribute from one of the wrapped agent's attribute sets.- Parameters:
attributeSetName- the name of the attribute set containing the propertypropertyName- the name of the property to retrieve- Returns:
- the
ReadOnlyPropertywith the specified name
-
isDead
public boolean isDead()Returns whether the agent is dead or not.- Returns:
- the boolean value of whether the agent is dead (true) or not (false)
-