edu.columbia.cs.coms4701.agent.observer
Class TextEnvironmentObserver<K extends AgentAction,P extends AgentPercept,A extends Agent<K,P>>

java.lang.Object
  extended by edu.columbia.cs.coms4701.agent.observer.TextEnvironmentObserver<K,P,A>
All Implemented Interfaces:
EnvironmentObserver<K,P,A>, AgentAddedListener<K,P,A>, AgentChoseActionListener<K,P,A>, AgentReceivedPerceptsListener<K,P,A>, EnvironmentBeganRunningListener, EnvironmentObjectAddedListener, EnvironmentStoppedRunningListener, java.beans.PropertyChangeListener, java.util.EventListener

public class TextEnvironmentObserver<K extends AgentAction,P extends AgentPercept,A extends Agent<K,P>>
extends java.lang.Object
implements EnvironmentObserver<K,P,A>

A simple EnvironmentObserver that traces all events to stdout. This might be useful for debugging, or as a sample for other EnvironmentObservers.

Version:
0.1

User: aaron Date: Aug 24, 2006 Time: 6:37:57 PM

Author:
aaron@cs

Constructor Summary
TextEnvironmentObserver()
           
 
Method Summary
 void agentAdded(AgentAddedEvent<K,P,A> theEvent)
          Fired when an agent is added to an environment.
 void agentChoseAction(AgentChoseActionEvent<K,P,A> theEvent)
          Fired when an agent in an environment chooses an action (i.e.
 void agentReceivedPercepts(AgentReceivedPerceptsEvent<K,P,A> theEvent)
          Fired when an agent in an environment receives percepts, i.e.
 void environmentBeganRunning(EnvironmentBeganRunningEvent theEvent)
          Fired when an environment has just begun its run() loop.
 void environmentObjectAdded(EnvironmentObjectAddedEvent theEvent)
          Fired when an EnvironmentObject is added to an environment.
 void environmentStoppedRunning(EnvironmentStoppedRunningEvent theEvent)
          Fired when an environment is about to stop its run() loop.
 void propertyChange(java.beans.PropertyChangeEvent propertyChangeEvent)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextEnvironmentObserver

public TextEnvironmentObserver()
Method Detail

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent propertyChangeEvent)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener

environmentBeganRunning

public void environmentBeganRunning(EnvironmentBeganRunningEvent theEvent)
Fired when an environment has just begun its run() loop.

Specified by:
environmentBeganRunning in interface EnvironmentBeganRunningListener
Parameters:
theEvent - event specifying the environment

agentAdded

public void agentAdded(AgentAddedEvent<K,P,A> theEvent)
Fired when an agent is added to an environment.

Specified by:
agentAdded in interface AgentAddedListener<K extends AgentAction,P extends AgentPercept,A extends Agent<K,P>>
Parameters:
theEvent - event specifying the environment and agent

environmentObjectAdded

public void environmentObjectAdded(EnvironmentObjectAddedEvent theEvent)
Fired when an EnvironmentObject is added to an environment.

We should add ourselves as a property-change observer for this object.

Specified by:
environmentObjectAdded in interface EnvironmentObjectAddedListener
Parameters:
theEvent - event specifying the environment and the object.

agentReceivedPercepts

public void agentReceivedPercepts(AgentReceivedPerceptsEvent<K,P,A> theEvent)
Fired when an agent in an environment receives percepts, i.e. immediately *before* the agent's AgentProgram is called.

Specified by:
agentReceivedPercepts in interface AgentReceivedPerceptsListener<K extends AgentAction,P extends AgentPercept,A extends Agent<K,P>>
Parameters:
theEvent - event specifying the environment, agent, and set of percepts

agentChoseAction

public void agentChoseAction(AgentChoseActionEvent<K,P,A> theEvent)
Fired when an agent in an environment chooses an action (i.e. executes its AgentProgram)

Specified by:
agentChoseAction in interface AgentChoseActionListener<K extends AgentAction,P extends AgentPercept,A extends Agent<K,P>>
Parameters:
theEvent - specifies the environment, agent, and action

environmentStoppedRunning

public void environmentStoppedRunning(EnvironmentStoppedRunningEvent theEvent)
Fired when an environment is about to stop its run() loop.

Specified by:
environmentStoppedRunning in interface EnvironmentStoppedRunningListener
Parameters:
theEvent - event specifying the environment.