edu.columbia.cs.coms4701.agent.environments.robot.observer
Class RoombaEnvironmentObserver

java.lang.Object
  extended by edu.columbia.cs.coms4701.agent.observer.GUIEnvironmentObserver
All Implemented Interfaces:
EnvironmentObserver<RobotAction,RobotPercept,RobotAgent>, AgentAddedListener<RobotAction,RobotPercept,RobotAgent>, AgentChoseActionListener<RobotAction,RobotPercept,RobotAgent>, AgentReceivedPerceptsListener<RobotAction,RobotPercept,RobotAgent>, EnvironmentBeganRunningListener, EnvironmentObjectAddedListener, EnvironmentStoppedRunningListener, ObserverPlayingStateChangedListener, java.beans.PropertyChangeListener, java.util.EventListener

public class RoombaEnvironmentObserver
extends java.lang.Object
implements EnvironmentObserver<RobotAction,RobotPercept,RobotAgent>, ObserverPlayingStateChangedListener

Provides a GUI display for observing the progress of a RobotEnvironment.

Your feedback on possible improvements to the GUI code are very welcome.

Version:
0.1

User: aaron Date: Aug 29, 2006 Time: 2:00:38 PM

Author:
aaron@cs

Constructor Summary
RoombaEnvironmentObserver(int delay)
          Constructs a new RoombaEnvironmentObserver, which can then be attached to a (single!) RobotEnvironment to track progress.
 
Method Summary
 void agentAdded(AgentAddedEvent<RobotAction,RobotPercept,RobotAgent> theEvent)
          Fired when an agent is added to an environment.
 void agentChoseAction(AgentChoseActionEvent<RobotAction,RobotPercept,RobotAgent> theEvent)
          Fired when an agent in an environment chooses an action (i.e.
 void agentReceivedPercepts(AgentReceivedPerceptsEvent<RobotAction,RobotPercept,RobotAgent> 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 playingStateChanged(ObserverPlayingStateChangedEvent theEvent)
          Fired when the user clicks one of the buttons to change the playing state.
 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

RoombaEnvironmentObserver

public RoombaEnvironmentObserver(int delay)
Constructs a new RoombaEnvironmentObserver, which can then be attached to a (single!) RobotEnvironment to track progress.

Parameters:
delay - number of milliseconds to pause between each agent action. Something in the range 10-500 is good.
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<RobotAction,RobotPercept,RobotAgent> theEvent)
Fired when an agent is added to an environment.

Specified by:
agentAdded in interface AgentAddedListener<RobotAction,RobotPercept,RobotAgent>
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<RobotAction,RobotPercept,RobotAgent> 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<RobotAction,RobotPercept,RobotAgent>
Parameters:
theEvent - event specifying the environment, agent, and set of percepts

agentChoseAction

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

Specified by:
agentChoseAction in interface AgentChoseActionListener<RobotAction,RobotPercept,RobotAgent>
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.

playingStateChanged

public void playingStateChanged(ObserverPlayingStateChangedEvent theEvent)
Fired when the user clicks one of the buttons to change the playing state.

Specified by:
playingStateChanged in interface ObserverPlayingStateChangedListener
Parameters:
theEvent -