Class World

java.lang.Object
  |
  +--World

public class World
extends java.lang.Object

This class is the simulation object; Animal is the root class of the dweller hierarchy provided by the user worldGrid is the representation of the World object there are worldSize*worldSize points in the World current is the encoded direction of the ocean current time is the current time step kint sets the interval of steps on which reproduction is tried timeStep is a static variable to keep track of number of time steps so far in the World simulation.


Method Summary
 char getChar(int row, int col)
          this method returns the character representation of the Animal which is at position
 int getCurrent()
          observer for current
 int getCurrentTimeStep()
          observer for time
 WorldGrid getWorldGrid()
          observer for worldGrid
 int getWorldSize()
          observer for worldSize
 void nextTimeStep()
          This method simply iterates through all objects in the World and calls processTimeStepForObject(obj,loc) on each object Gui.main() calls this nextTimeStep function for each time step in the simulation
 void populate(int numObjects)
          this function places Animals in the World called by Gui.main() needs to be rewritten for every simulation
 Animal whatIs(Location loc)
          function checks location loc in simulation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getWorldGrid

public WorldGrid getWorldGrid()
observer for worldGrid
Returns:
worldGrid object

getWorldSize

public int getWorldSize()
observer for worldSize
Returns:
size of the simulation grid which is size by size

getCurrent

public int getCurrent()
observer for current
Returns:
value of current (+1 or -1)

nextTimeStep

public void nextTimeStep()
This method simply iterates through all objects in the World and calls processTimeStepForObject(obj,loc) on each object Gui.main() calls this nextTimeStep function for each time step in the simulation

getChar

public char getChar(int row,
                    int col)
this method returns the character representation of the Animal which is at position
Parameters:
row - is x co-ordinate
col - is y co-ordinate

populate

public void populate(int numObjects)
this function places Animals in the World called by Gui.main() needs to be rewritten for every simulation
Parameters:
numObjects - is total number of dwellers to be created in the simulation

getCurrentTimeStep

public int getCurrentTimeStep()
observer for time
Returns:
time of simulation

whatIs

public Animal whatIs(Location loc)
function checks location loc in simulation
Parameters:
loc - is location in question
Returns:
Animal at location loc or null