|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuchicago.src.sim.space.Object2DGrid
uchicago.src.sim.space.Object2DHexagonalGrid
uchicago.src.sim.space.Object2DHexagonalTorus
public class Object2DHexagonalTorus
A discrete 2 dimensional hexagonal torus of objects, accessed by x and y coordinates.
The hexagonal cells are referenced by x, y coordinates as follows:
_
_ / 1 \ _
/ 0 \ _ / 2 \
\ _ / 4 \ _ /
/ 3 \ _ / 5 \
\ _ / 7 \ _ /
/ 6 \ _ / 8 \
\ _ / \ _ /
Here we have a 3 x 3 hexagonal grid. The first row of cells is 0,
1, 2 such that 0,0 refers to cell 0, and 0,2 refers to cell 2. The
next row of cells is 3, 4, 5, so 1,0 refers to cell 3 and so
on. The last row of cells is 6, 7, and 8, so 2, 0 refers to cell 6.
The ring of neighbors with radius one that surrounds cell 4 is
composed of 1, 2, 5, 7, 3, and 0. The grid wraps as a toriod such
that cell -1, 0 refers to cell 2 and cell 0, -1 is cell 6.
| Field Summary |
|---|
| Fields inherited from class uchicago.src.sim.space.Object2DGrid |
|---|
matrix, Mneigh, PGM_ASCII, RASTER_ASCII, VNneigh, xSize, ySize |
| Fields inherited from interface uchicago.src.sim.space.Discrete2DSpace |
|---|
MOORE, VON_NEUMANN |
| Constructor Summary | |
|---|---|
Object2DHexagonalTorus(int xSize,
int ySize)
Creates a new torus of the specified size. |
|
| Method Summary | |
|---|---|
java.lang.Object |
getObjectAt(int x,
int y)
Gets the object at the specified coordinate |
double |
getValueAt(int x,
int y)
Gets the value at (x,y) |
void |
putObjectAt(int x,
int y,
java.lang.Object object)
Puts the specified object at (x,y), wrapping the coordinates around the torus if necessary. |
void |
putValueAt(int x,
int y,
double value)
Puts the specified double at (x,y), wrapping the coordinates around the torus if necessary. |
int |
xnorm(int x)
|
int |
ynorm(int y)
Normalize the y value to the toroidal coordinates |
| Methods inherited from class uchicago.src.sim.space.Object2DHexagonalGrid |
|---|
findMaximum, findMinimum, getMooreNeighbors, getMooreNeighbors, getNeighbors, getNeighbors, getVonNeumannNeighbors, getVonNeumannNeighbors |
| Methods inherited from class uchicago.src.sim.space.Object2DGrid |
|---|
findMaximum, findMinimum, getMatrix, getSize, getSizeX, getSizeY, rangeCheck, setComparator |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Object2DHexagonalTorus(int xSize,
int ySize)
xSize - the size of the x dimensionySize - the size of the y dimension| Method Detail |
|---|
public void putObjectAt(int x,
int y,
java.lang.Object object)
putObjectAt in interface Discrete2DSpaceputObjectAt in class Object2DGridx - the x coordinatey - the y coordinateobject - the object to put at (x,y)
public void putValueAt(int x,
int y,
double value)
putValueAt in interface Discrete2DSpaceputValueAt in class Object2DGridx - the x coordinatey - the y coordinatevalue - the value to put at (x,y)
public java.lang.Object getObjectAt(int x,
int y)
getObjectAt in interface Discrete2DSpacegetObjectAt in class Object2DGridx - the x coordinatey - the y coordinate
public double getValueAt(int x,
int y)
getValueAt in interface Discrete2DSpacegetValueAt in class Object2DGridx - the x coordinatey - the y coordinate
public int xnorm(int x)
public int ynorm(int y)
y - the value to normalize
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||