|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectWorld<E>
public class World<E>
This module includes the functions necessary to keep track of the creatures in a two-dimensional world. In order for the design to be general, the interface adopts the following design:
1. The contents have type E.
2. The dimensions of the world array are specified by the client.
There are many ways to implement this structure. HINT: look at the structure.Matrix class. You should need to add no more than about ten lines of code to this file.
Constructor Summary | |
---|---|
World(int w,
int h)
This function creates a new world consisting of width columns and height rows, each of which is numbered beginning at 0. |
Method Summary | |
---|---|
E |
get(Position pos)
Return the contents of a position on the board. |
int |
height()
Returns the height of the world. |
void |
set(Position pos,
E c)
Set a position on the board to contain c. |
int |
width()
Returns the width of the world. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public World(int w, int h)
Method Detail |
---|
public int height()
public int width()
public void set(Position pos, E c)
public E get(Position pos)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |