|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.columbia.cs.coms4701.agent.environments.simple.AbstractEnvironment<K,P,A>
public abstract class AbstractEnvironment<K extends AgentAction,P extends AgentPercept,A extends Agent<K,P>>
An abstract base Environment to take care of most of the dirty work.
Subclasses must implement:
Field Summary | |
---|---|
protected java.util.Collection<A> |
agents
|
protected Counter |
counter
|
protected java.util.Collection<EnvironmentObject> |
environmentObjects
|
protected java.util.Collection<EnvironmentObserver<K,P,A>> |
environmentObservers
|
Constructor Summary | |
---|---|
AbstractEnvironment()
|
Method Summary | |
---|---|
void |
addAgent(A theAgent)
Adds an Agent to the environment. |
void |
addEnvironmentObject(EnvironmentObject theObject)
Adds an EnvironmentObject to the environment. |
void |
addEnvironmentObserver(EnvironmentObserver<K,P,A> theObserver)
Adds an EnvironmentObserver, which will be spun into a separate thread, and receive messages when events happen in the environment. |
abstract void |
agentDrivenChange(A theAgent,
K theAction)
Changes the state of zero or more environment objects, given an agent and the action that the agent selected. |
void |
dynamicChange()
Considers the current state of the environmentObjects, and changes zero or more objects. |
void |
executeStep()
Performs one step of the simulated environment. |
java.util.Collection<A> |
getAgents()
Returns a collection of all agent objects, which is a (possibly empty) subset of the collection of all objects. |
Counter |
getCounter()
getCounter returns the environment's Counter object, which is included in the EnvironmentObjects collection. |
java.util.Collection<EnvironmentObject> |
getEnvironmentObjects()
Returns a collection of all environment objects. |
void |
initialSetup()
Default initialization. |
boolean |
isDone()
Returns true when the environment state is done changing. |
abstract java.util.Set<P> |
perceptsForAgent(A theAgent)
Returns a set (possibly empty) of percepts for the given agent. |
void |
run()
Repeatedly calls executeStep until isDone is true. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.Collection<EnvironmentObject> environmentObjects
protected java.util.Collection<A extends Agent<K,P>> agents
protected Counter counter
protected java.util.Collection<EnvironmentObserver<K extends AgentAction,P extends AgentPercept,A extends Agent<K,P>>> environmentObservers
Constructor Detail |
---|
public AbstractEnvironment()
Method Detail |
---|
public boolean isDone()
isDone
in interface Environment<K extends AgentAction,P extends AgentPercept,A extends Agent<K,P>>
public abstract java.util.Set<P> perceptsForAgent(A theAgent)
perceptsForAgent
in interface Environment<K extends AgentAction,P extends AgentPercept,A extends Agent<K,P>>
public void addEnvironmentObject(EnvironmentObject theObject)
addEnvironmentObject
in interface Environment<K extends AgentAction,P extends AgentPercept,A extends Agent<K,P>>
theObject
- the EnvironmentObject to addpublic void addEnvironmentObserver(EnvironmentObserver<K,P,A> theObserver)
addEnvironmentObserver
in interface Environment<K extends AgentAction,P extends AgentPercept,A extends Agent<K,P>>
theObserver
- the EnvironmentObserver to add.public void initialSetup()
initialSetup
in interface Environment<K extends AgentAction,P extends AgentPercept,A extends Agent<K,P>>
public void addAgent(A theAgent)
addAgent
in interface Environment<K extends AgentAction,P extends AgentPercept,A extends Agent<K,P>>
public void run()
run
in interface Environment<K extends AgentAction,P extends AgentPercept,A extends Agent<K,P>>
public void executeStep()
executeStep
in interface Environment<K extends AgentAction,P extends AgentPercept,A extends Agent<K,P>>
public void dynamicChange()
dynamicChange
in interface Environment<K extends AgentAction,P extends AgentPercept,A extends Agent<K,P>>
public abstract void agentDrivenChange(A theAgent, K theAction)
agentDrivenChange
in interface Environment<K extends AgentAction,P extends AgentPercept,A extends Agent<K,P>>
theAgent
- the agent that just selected an actiontheAction
- the action selectedpublic java.util.Collection<EnvironmentObject> getEnvironmentObjects()
getEnvironmentObjects
in interface Environment<K extends AgentAction,P extends AgentPercept,A extends Agent<K,P>>
public java.util.Collection<A> getAgents()
getAgents
in interface Environment<K extends AgentAction,P extends AgentPercept,A extends Agent<K,P>>
public Counter getCounter()
getCounter
in interface Environment<K extends AgentAction,P extends AgentPercept,A extends Agent<K,P>>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |