|
||||||||||
| 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
public class Object2DHexagonalGrid
A discrete hexagonal grid 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 | |
|---|---|
Object2DHexagonalGrid(int xSize,
int ySize)
Constructs a grid with the specified size. |
|
Object2DHexagonalGrid(java.lang.String fileName,
int type)
Constructs a grid from a file. |
|
| Method Summary | |
|---|---|
java.util.Vector |
findMaximum(int x,
int y,
int range,
boolean includeOrigin)
Finds the maximum grid cell occupant within a specified range from the specified origin coordinate. |
java.util.Vector |
findMinimum(int x,
int y,
int range,
boolean includeOrigin)
Finds the minimum grid cell occupant within a specified range from the specified origin coordinate. |
java.util.Vector |
getMooreNeighbors(int x,
int y,
boolean returnNulls)
The notion of a Moore neighborhood is incoherent for a hexagonal grid. |
java.util.Vector |
getMooreNeighbors(int x,
int y,
int xExtent,
int yExtent,
boolean returnNulls)
The notion of a Moore neighborhood is incoherent for a hexagonal grid. |
java.util.Vector |
getNeighbors(int x,
int y,
boolean returnNulls)
Gets the neighbors of the object at x, y. |
java.util.Vector |
getNeighbors(int x,
int y,
int extent,
boolean returnNulls)
Gets the rings of neighbors of the object at x, y. |
java.util.Vector |
getVonNeumannNeighbors(int x,
int y,
boolean returnNulls)
The notion of a vonNeumann neighborhood is incoherent for a hexagonal grid. |
java.util.Vector |
getVonNeumannNeighbors(int x,
int y,
int xExtent,
int yExtent,
boolean returnNulls)
The notion of a vonNeumann neighborhood is incoherent for a hexagonal grid. |
| Methods inherited from class uchicago.src.sim.space.Object2DGrid |
|---|
findMaximum, findMinimum, getMatrix, getObjectAt, getSize, getSizeX, getSizeY, getValueAt, putObjectAt, putValueAt, rangeCheck, setComparator |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Object2DHexagonalGrid(int xSize,
int ySize)
xSize - the size of the lattice in the x dimension.ySize - the size of the lattice in the y dimension.
public Object2DHexagonalGrid(java.lang.String fileName,
int type)
| Method Detail |
|---|
public java.util.Vector getNeighbors(int x,
int y,
boolean returnNulls)
x - the x coordinate of the objecty - the y coordinate of the objectreturnNulls - whether nulls (nothing at x,y) should be returned
java.lang.IndexOutOfBoundsException - if the given coordinates are out of
range (x < 0 || x >= xSize || y < 0 || y >= ySize)
public java.util.Vector getNeighbors(int x,
int y,
int extent,
boolean returnNulls)
x - the x coordinate of the objecty - the y coordinate of the objectextent - the extension of the neighborhoodreturnNulls - whether nulls should be returned
java.lang.IndexOutOfBoundsException - if the given coordinates are
out of range (x < 0 || x >= xSize || y < 0 || y >= ySize)
public java.util.Vector getVonNeumannNeighbors(int x,
int y,
boolean returnNulls)
throws java.lang.UnsupportedOperationException
getNeighbors method.
getVonNeumannNeighbors in class Object2DGridx - the x coordinate of the objecty - the y coordinate of the objectreturnNulls - whether nulls (nothing at x,y) should be returned
java.lang.UnsupportedOperationException
public java.util.Vector getVonNeumannNeighbors(int x,
int y,
int xExtent,
int yExtent,
boolean returnNulls)
throws java.lang.UnsupportedOperationException
getNeighbors method.
getVonNeumannNeighbors in class Object2DGridx - 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
public java.util.Vector getMooreNeighbors(int x,
int y,
boolean returnNulls)
throws java.lang.UnsupportedOperationException
getNeighbors method.
getMooreNeighbors in class Object2DGridx - the x coordinate of the objecty - the y coordinate of the objectreturnNulls - should the returned Vector contain null objects
java.lang.UnsupportedOperationException
public java.util.Vector getMooreNeighbors(int x,
int y,
int xExtent,
int yExtent,
boolean returnNulls)
throws java.lang.UnsupportedOperationException
getNeighbors method.
getMooreNeighbors in class Object2DGridx - 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 Vector contain null objects
java.lang.UnsupportedOperationException
public java.util.Vector findMaximum(int x,
int y,
int range,
boolean includeOrigin)
x - the x origin coordinatey - the y origin coordinaterange - the range out from the coordinate to searchincludeOrigin - include object at origin in search
java.lang.IndexOutOfBoundsException - if the given coordinates are out of
range (x < 0 || x >= xSize || y < 0 || y >= ySize)
public java.util.Vector findMinimum(int x,
int y,
int range,
boolean includeOrigin)
x - the x origin coordinatey - the y origin coordinaterange - the range out from the coordinate to searchincludeOrigin - include object at origin in search
java.lang.IndexOutOfBoundsException - if the given coordinates are out of
range (x < 0 || x >= xSize || y < 0 || y >= ySize)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||