|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuchicago.src.sim.space.AbsMulti2DGrid
uchicago.src.sim.space.AbsMulti2DHexagonalGrid
public abstract class AbsMulti2DHexagonalGrid
Base class for hexagonal grids whose cells can hold more that one occupant. The actual object held in the grid cell is a Cell object.
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.AbsMulti2DGrid |
|---|
matrix, roIter, roList, xSize, ySize |
| Fields inherited from interface uchicago.src.sim.space.Discrete2DSpace |
|---|
MOORE, VON_NEUMANN |
| Constructor Summary | |
|---|---|
AbsMulti2DHexagonalGrid(int xSize,
int ySize,
boolean sparse)
Creates this AbsMulti2DHexagonalGrid with the specified dimensions. |
|
| Method Summary | |
|---|---|
java.util.ArrayList |
getMooreNeighbors(int x,
int y,
boolean returnNulls)
The notion of Moore neighbors is incoherent on a Hexagonal grid. |
java.util.ArrayList |
getMooreNeighbors(int x,
int y,
int xExtent,
int yExtent,
boolean returnNulls)
The notion of Moore neighbors is incoherent on a Hexagonal grid. |
java.util.ArrayList |
getMooreNeighborsLoc(int x,
int y,
boolean returnNulls)
The notion of Moore neighbors is incoherent on a Hexagonal grid. |
java.util.ArrayList |
getMooreNeighborsLoc(int x,
int y,
int xExtent,
int yExtent,
boolean returnNulls)
The notion of Moore neighbors is incoherent on a Hexagonal grid. |
java.util.ArrayList |
getNeighbors(int x,
int y,
boolean returnNulls)
Returns the ring of neighbors with a radius of 1 surrounding the object at x, y. |
java.util.ArrayList |
getNeighbors(int x,
int y,
int extent,
boolean returnNulls)
Returns the rings of neighbors surrounding the cell at x, y. |
java.util.ArrayList |
getNeighborsLoc(int x,
int y,
boolean returnNulls)
Returns the ring of neighbors with a radius of 1 surrounding the object at x, y. |
java.util.ArrayList |
getNeighborsLoc(int x,
int y,
int extent,
boolean returnNulls)
Returns the rings of neighbors surrounding the cell at x, y. |
java.util.ArrayList |
getVNNeighbors(int x,
int y,
boolean returnNulls)
The notion of VonNeumann neighbors is incoherent on a Hexagonal grid. |
java.util.ArrayList |
getVNNeighbors(int x,
int y,
int xExtent,
int yExtent,
boolean returnNulls)
The notion of VonNeumann neighbors is incoherent on a Hexagonal grid. |
java.util.ArrayList |
getVNNeighborsLoc(int x,
int y,
boolean returnNulls)
The notion of VonNeumann neighbors is incoherent on a Hexagonal grid. |
java.util.ArrayList |
getVNNeighborsLoc(int x,
int y,
int xExtent,
int yExtent,
boolean returnNulls)
The notion of VonNeumann neighbors is incoherent on a Hexagonal grid. |
| Methods inherited from class uchicago.src.sim.space.AbsMulti2DGrid |
|---|
clear, getCellAt, getCellSizeAt, getIteratorAt, getMatrix, getObjectAt, getObjectsAt, getSize, getSizeX, getSizeY, getValueAt, putObjectAt, putValueAt, rangeCheck, removeObjectAt, trim |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbsMulti2DHexagonalGrid(int xSize,
int ySize,
boolean sparse)
xSize - the number of columns in the gridySize - the number of rows in the gridsparse - whether the grid will be sparsely populated or not| Method Detail |
|---|
public java.util.ArrayList getNeighbors(int x,
int y,
int extent,
boolean returnNulls)
x - the x coordinate of the celly - the y coordinate of the cellextent - the number of neighbor rings to returnreturnNulls - whether or not the returned list should return
null when a neighbor cell is empty
java.lang.IndexOutOfBoundsException - if the given coordinates are out of
range (x < 0 || x >= xSize || y < 0 || y >= ySize)
public java.util.ArrayList getNeighbors(int x,
int y,
boolean returnNulls)
x - the x coordinate of the celly - the y coordinate of the cellreturnNulls - whether or not the returned list should return
null when a neighbor cell is empty
java.lang.IndexOutOfBoundsException - if the given coordinates are out of
range (x < 0 || x >= xSize || y < 0 || y >= ySize)
public java.util.ArrayList getNeighborsLoc(int x,
int y,
int extent,
boolean returnNulls)
x - the x coordinate of the celly - the y coordinate of the cellextent - the number of neighbor rings to returnreturnNulls - whether or not the returned list should return
null when a neighbor cell is empty
java.lang.IndexOutOfBoundsException - if the given coordinates are out of
range (x < 0 || x >= xSize || y < 0 || y >= ySize)
public java.util.ArrayList getNeighborsLoc(int x,
int y,
boolean returnNulls)
x - the x coordinate of the celly - the y coordinate of the cellreturnNulls - whether or not the returned list should return
null when a neighbor cell is empty
java.lang.IndexOutOfBoundsException - if the given coordinates are out of
range (x < 0 || x >= xSize || y < 0 || y >= ySize)
public java.util.ArrayList getVNNeighborsLoc(int x,
int y,
boolean returnNulls)
getNeighborsLoc method.
getVNNeighborsLoc in class AbsMulti2DGridx - the x coordinate of the objecty - the y coordinate of the objectreturnNulls - whether nulls (nothing at x,y) should be returned
java.lang.UnsupportedOperationException - when called.ObjectLocation
public java.util.ArrayList getVNNeighborsLoc(int x,
int y,
int xExtent,
int yExtent,
boolean returnNulls)
getNeighborsLoc method.
getVNNeighborsLoc in class AbsMulti2DGridx - the x coordinate of the objecty - the y coordinate of the objectxExtent - the extension of the neighborhood in the x directionyExtent - the extension of the neighborhood in the y directionreturnNulls - whether nulls should be returned
java.lang.UnsupportedOperationException - when called.ObjectLocation
public java.util.ArrayList getMooreNeighborsLoc(int x,
int y,
boolean returnNulls)
getNeighborsLoc method.
getMooreNeighborsLoc in class AbsMulti2DGridx - the x coordinate of the objecty - the y coordinate of the objectreturnNulls - should the returned Vector contain null objects
java.lang.UnsupportedOperationException - when called.ObjectLocation
public java.util.ArrayList getMooreNeighborsLoc(int x,
int y,
int xExtent,
int yExtent,
boolean returnNulls)
getNeighborsLoc method.
getMooreNeighborsLoc in class AbsMulti2DGridx - the x coordinate of the objecty - the y coordinate of the objectxExtent - the extension of the neighborhood in the x directionyExtent - the extension of the neighborhood in the y directionreturnNulls - should the returned ArrayList contain null objects
java.lang.UnsupportedOperationException - when called.ObjectLocation
public java.util.ArrayList getVNNeighbors(int x,
int y,
boolean returnNulls)
#getNeighborsint, int, int, boolean) getNeighbors method.
getVNNeighbors in class AbsMulti2DGridx - the x coordinate of the objecty - the y coordinate of the objectreturnNulls - whether nulls (nothing at x,y) should be returned
java.lang.UnsupportedOperationException - when called.
public java.util.ArrayList getVNNeighbors(int x,
int y,
int xExtent,
int yExtent,
boolean returnNulls)
#getNeighborsint, int, int, boolean) getNeighbors method.
getVNNeighbors in class AbsMulti2DGridx - the x coordinate of the objecty - the y coordinate of the objectxExtent - the extension of the neighborhood in the x directionyExtent - the extension of the neighborhood in the y directionreturnNulls - whether nulls should be returned
java.lang.UnsupportedOperationException - when called.
public java.util.ArrayList getMooreNeighbors(int x,
int y,
boolean returnNulls)
#getNeighborsint, int, int, boolean) getNeighbors method.
getMooreNeighbors in class AbsMulti2DGridx - the x coordinate of the objecty - the y coordinate of the objectreturnNulls - should the returned ArrayList contain null objects
java.lang.UnsupportedOperationException - when called.
public java.util.ArrayList getMooreNeighbors(int x,
int y,
int xExtent,
int yExtent,
boolean returnNulls)
#getNeighborsint, int, int, boolean) getNeighbors method.
getMooreNeighbors in class AbsMulti2DGridx - the x coordinate of the objecty - the y coordinate of the objectxExtent - the extension of the neighborhood in the x directionyExtent - the extension of the neighborhood in the y directionreturnNulls - should the returned ArrayList contain null objects
java.lang.UnsupportedOperationException - when called.ObjectLocation
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||