aima.gui.framework
Class AgentAppModel

java.lang.Object
  extended by aima.basic.BasicEnvironmentView
      extended by aima.gui.framework.AgentAppModel
Direct Known Subclasses:
MapAgentModel, VacuumAppDemo.VacuumModel

public class AgentAppModel
extends BasicEnvironmentView

Facade hiding application specific design decisions from the AgentAppFrame. Subclasses should add methods to access informations about the environment's and the agent's state. Note that any data shown by an agent view must be provided by a corresponding model. The model-view-controller architecture forbids any component of the application except the controller to directly access the view components and it forbids the views to access information without consulting the model.


Nested Class Summary
static interface AgentAppModel.ModelChangedListener
          Observer interface for views which need to be informed about model state changes and log messages to be printed out.
 
Field Summary
protected  java.util.List<AgentAppModel.ModelChangedListener> listeners
          Maintains all views.
 
Constructor Summary
AgentAppModel()
           
 
Method Summary
 void addModelChangedListener(AgentAppModel.ModelChangedListener listener)
          Adds a new view to the model.
 void envChanged(java.lang.String command)
          Reacts on environment changes.
 void fireModelChanged()
          Signals to all registered listeners that the model has changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listeners

protected java.util.List<AgentAppModel.ModelChangedListener> listeners
Maintains all views. Typically, just one agent view is maintained here.

Constructor Detail

AgentAppModel

public AgentAppModel()
Method Detail

addModelChangedListener

public void addModelChangedListener(AgentAppModel.ModelChangedListener listener)
Adds a new view to the model.


fireModelChanged

public void fireModelChanged()
Signals to all registered listeners that the model has changed.


envChanged

public void envChanged(java.lang.String command)
Reacts on environment changes. This implementation informs all registered model change listeners and provides their log with the given command.

Overrides:
envChanged in class BasicEnvironmentView