darwin.domain
Class MyWorld

java.lang.Object
  extended bydarwin.domain.MyWorld
All Implemented Interfaces:
World

public class MyWorld
extends java.lang.Object
implements World

This class includes the functions necessary to keep track of the creatures in a two-dimensional world. In order for the design to be general, the class adopts the following design:

1. The contents are unspecified objects.

2. The dimensions of the world array are specified by the client.

There are many ways to implement this class. You should need to add no more than about ten lines of code to this file.


Constructor Summary
MyWorld(int aWidth, int aHeight)
          Create a new World consisting of aWidth columns and aHeight rows, each of which is numbered beginning at 0.
 
Method Summary
 java.lang.String toString()
          Return a String representation of this World.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface darwin.domain.World
get, getHeight, getWidth, inRange, set
 

Constructor Detail

MyWorld

public MyWorld(int aWidth,
               int aHeight)
Create a new World consisting of aWidth columns and aHeight rows, each of which is numbered beginning at 0. A newly created World contains no objects.

Parameters:
aWidth - the number of columns for this World.
aHeight - the number of rows for this World.
Method Detail

toString

public java.lang.String toString()
Return a String representation of this World.

Returns:
a String representation of this World.