turtlekit.kernel
Class Observer

java.lang.Object
  extended by madkit.kernel.AbstractAgent
      extended by madkit.kernel.Watcher
          extended by turtlekit.kernel.Observer
All Implemented Interfaces:
java.io.Serializable, ReferenceableAgent
Direct Known Subclasses:
CreationObserver, GasObserver, GridInitializer, GridPlayer, PatchInitializer, SoccerObserver, Viewer, VirusObserver

public abstract class Observer
extends Watcher
implements ReferenceableAgent

Observer is an abstract class that have to be extended in order to initialize patches or make some observations. To observe turtle, create TurtleProbe on a special role and then add it using addProbe(); walkers = new TurtleProbe(getSimulationGroup(),"walker"); addProbe(walkers); You can specially create Turtle[] variables using TurtleProbe's getTurtles() method. This method permits to obtain an array of turtle regarding the role they play. MoreOver this agent has access to the patchGrid variable in order to observe or initialize the patches.

Version:
3.0 20/02/2002
Author:
Fabien MICHEL
See Also:
TurtleProbe, Serialized Form

Field Summary
 int envHeight
           
 int envWidth
           
 Patch[][] patchGrid
           
 
Constructor Summary
Observer()
           
 
Method Summary
 void activate()
          MadKit kernel usage
 java.lang.String getSimulationGroup()
           
 void setup()
          override this method to make other initializations,not in constructor
 void watch()
          override this method to observe the state of the world using turtle tables or/and the patchGrid variable
 
Methods inherited from class madkit.kernel.Watcher
addProbe, addProbe, end, getProbes, removeAllProbes, removeProbe, update
 
Methods inherited from class madkit.kernel.AbstractAgent
broadcastMessage, broadcastMessage, connectedWithCommunity, createGroup, createGroup, debug, disposeMyGUI, foundGroup, getAddress, getAgentInformation, getAgentsWithRole, getAgentsWithRole, getAgentWithRole, getAgentWithRole, getAvailableCommunities, getBean, getController, getCurrentKernelAddress, getDebug, getExistingGroups, getExistingGroups, getExistingRoles, getExistingRoles, getGroups, getGUIObject, getMessageBoxSize, getMyGroups, getMyGroups, getMyRoles, getMyRoles, getName, getRoles, hasGUI, initGUI, isBelongingToGroup, isBelongingToGroup, isCommunity, isGroup, isGroup, isMemberOf, isMemberOf, isMessageBoxEmpty, isRole, isRole, joinGroup, killAgent, launchAgent, launchAgent, leaveGroup, leaveGroup, leaveRole, leaveRole, nextMessage, print, println, receiveMessage, redisplayMyGUI, requestRole, requestRole, requestRole, restoreAgent, sendMessage, sendMessage, sendMessage, setBean, setController, setDebug, setGUIObject, setName, setOutput, setOutputWriter, windowClosing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

patchGrid

public Patch[][] patchGrid

envWidth

public int envWidth

envHeight

public int envHeight
Constructor Detail

Observer

public Observer()
Method Detail

activate

public void activate()
MadKit kernel usage

Overrides:
activate in class AbstractAgent

getSimulationGroup

public final java.lang.String getSimulationGroup()

watch

public void watch()
override this method to observe the state of the world using turtle tables or/and the patchGrid variable


setup

public void setup()
override this method to make other initializations,not in constructor



Copyright © Madkit Team (O. Gutknecht, J. Ferber, F. Michel et al.) All Rights Reserved.