public abstract class AbstractEnvironment extends java.lang.Object implements Environment, EnvironmentViewNotifier
| Modifier and Type | Field and Description |
|---|---|
protected java.util.Set<Agent> |
agents |
protected java.util.Set<EnvironmentObject> |
envObjects |
protected java.util.Map<Agent,java.lang.Double> |
performanceMeasures |
protected java.util.Set<EnvironmentView> |
views |
| Constructor and Description |
|---|
AbstractEnvironment() |
| Modifier and Type | Method and Description |
|---|---|
void |
addAgent(Agent a)
Add an agent to the Environment.
|
void |
addEnvironmentObject(EnvironmentObject eo)
Add an EnvironmentObject to the Environment.
|
void |
addEnvironmentView(EnvironmentView ev)
Add a view on the Environment.
|
void |
createExogenousChange()
Method for implementing dynamic environments in which not all changes are
directly caused by agent action execution.
|
abstract void |
executeAction(Agent agent,
Action action) |
java.util.List<Agent> |
getAgents()
Returns the Agents belonging to this Environment.
|
java.util.List<EnvironmentObject> |
getEnvironmentObjects()
Returns the EnvironmentObjects that exist in this Environment.
|
abstract Percept |
getPerceptSeenBy(Agent anAgent) |
double |
getPerformanceMeasure(Agent forAgent)
Retrieve the performance measure associated with an Agent.
|
boolean |
isDone()
Returns
true if the Environment is finished with its current
task(s). |
protected void |
notifyEnvironmentViews(Agent agent) |
protected void |
notifyEnvironmentViews(Agent agent,
Action action) |
void |
notifyViews(java.lang.String msg)
Notify all registered EnvironmentViews of a message.
|
void |
removeAgent(Agent a)
Remove an agent from the environment.
|
void |
removeEnvironmentObject(EnvironmentObject eo)
Remove an EnvironmentObject from the Environment.
|
void |
removeEnvironmentView(EnvironmentView ev)
Remove a view on the Environment.
|
void |
step()
Central template method for controlling agent simulation.
|
void |
step(int n)
Move the Environment n time steps forward.
|
void |
stepUntilDone()
Step through time steps until the Environment has no more tasks.
|
protected void |
updatePerformanceMeasure(Agent forAgent,
double addTo) |
protected java.util.Set<EnvironmentObject> envObjects
protected java.util.Set<Agent> agents
protected java.util.Set<EnvironmentView> views
protected java.util.Map<Agent,java.lang.Double> performanceMeasures
public void createExogenousChange()
public java.util.List<Agent> getAgents()
EnvironmentgetAgents in interface Environmentpublic void addAgent(Agent a)
EnvironmentaddAgent in interface Environmenta - the agent to be added.public void removeAgent(Agent a)
EnvironmentremoveAgent in interface Environmenta - the agent to be removed.public java.util.List<EnvironmentObject> getEnvironmentObjects()
EnvironmentgetEnvironmentObjects in interface Environmentpublic void addEnvironmentObject(EnvironmentObject eo)
EnvironmentaddEnvironmentObject in interface Environmenteo - the EnvironmentObject to be added.public void removeEnvironmentObject(EnvironmentObject eo)
EnvironmentremoveEnvironmentObject in interface Environmenteo - the EnvironmentObject to be removed.public void step()
getPerceptSeenBy(Agent), executeAction(Agent, Action),
and createExogenousChange().step in interface Environmentpublic void step(int n)
Environmentstep in interface Environmentn - the number of time steps to move the Environment forward.public void stepUntilDone()
EnvironmentstepUntilDone in interface Environmentpublic boolean isDone()
Environmenttrue if the Environment is finished with its current
task(s).isDone in interface Environmenttrue if the Environment is finished with its current
task(s).public double getPerformanceMeasure(Agent forAgent)
EnvironmentgetPerformanceMeasure in interface EnvironmentforAgent - the Agent for which a performance measure is to be retrieved.public void addEnvironmentView(EnvironmentView ev)
EnvironmentaddEnvironmentView in interface Environmentev - the EnvironmentView to be added.public void removeEnvironmentView(EnvironmentView ev)
EnvironmentremoveEnvironmentView in interface Environmentev - the EnvironmentView to be removed.public void notifyViews(java.lang.String msg)
EnvironmentnotifyViews in interface EnvironmentnotifyViews in interface EnvironmentViewNotifiermsg - the message to notify the registered EnvironmentViews with.protected void updatePerformanceMeasure(Agent forAgent, double addTo)
protected void notifyEnvironmentViews(Agent agent)