|
||||||||||
| 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.AbsMulti2DTorus
public abstract class AbsMulti2DTorus
Base class for tori whose cells can hold more that one occupant. The actual object held in the grid cell is a Cell object.
| 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 | |
|---|---|
AbsMulti2DTorus(int xSize,
int ySize,
boolean sparse)
Creates this AbsMulti2DGrid with the specified dimensions. |
|
| Method Summary | |
|---|---|
void |
clear(int x,
int y)
Clears the contents the specified cell. |
Cell |
getCellAt(int x,
int y)
Gets the Cell object at the specified coordinates. |
int |
getCellSizeAt(int x,
int y)
Gets the size (number of occupants) of the cell at the specified location. |
java.util.Iterator |
getIteratorAt(int x,
int y)
Gets the iterator for the collection of objects at the specified coordinates. |
BaseMatrix |
getMatrix()
Gets the matrix collection class that contains all the values |
java.util.ArrayList |
getMooreNeighbors(int x,
int y,
boolean returnNulls)
Gets the Moore neighbors of the object(s) at x, y. |
java.util.ArrayList |
getMooreNeighbors(int x,
int y,
int xExtent,
int yExtent,
boolean returnNulls)
Gets the extended Moore neighbors of the object(s) at x, y. |
java.util.ArrayList |
getMooreNeighborsLoc(int x,
int y,
boolean returnNulls)
Gets the Moore neighbors of the object(s) at x, y. |
java.util.ArrayList |
getMooreNeighborsLoc(int x,
int y,
int xExtent,
int yExtent,
boolean returnNulls)
Gets the extended Moore neighbors of the object(s) at x, y. |
java.lang.Object |
getObjectAt(int x,
int y)
Gets the Object at the specified coordinate. |
java.util.List |
getObjectsAt(int x,
int y)
Gets the List of objects at the specified coordinates. |
double |
getValueAt(int x,
int y)
Gets the value at the specified coordinate if appropriate. |
java.util.ArrayList |
getVNNeighbors(int x,
int y,
boolean returnNulls)
Gets the von Neumann neighbors of the object(s) at x, y. |
java.util.ArrayList |
getVNNeighbors(int x,
int y,
int xExtent,
int yExtent,
boolean returnNulls)
Gets the extended von Neumann neighbors of the objects(s) at x, y. |
java.util.ArrayList |
getVNNeighborsLoc(int x,
int y,
boolean returnNulls)
Gets the von Neumann neighbors of the object(s) at x, y. |
java.util.ArrayList |
getVNNeighborsLoc(int x,
int y,
int xExtent,
int yExtent,
boolean returnNulls)
Gets the extended von Neumann neighbors of the objects(s) at x, y. |
abstract void |
putObjectAt(int x,
int y,
java.lang.Object object)
Puts the specified Object at the specified coordinate. |
void |
putValueAt(int x,
int y,
double value)
Puts the specified value at the specified coordinate. |
void |
removeObjectAt(int x,
int y,
java.lang.Object obj)
Removes the specified object from the specified location. |
void |
trim()
Releases any superfluous memory. |
int |
xnorm(int x)
Normalize the x value to the toroidal coordinates |
int |
ynorm(int y)
Normalize the y value to the toroidal coordinates |
| Methods inherited from class uchicago.src.sim.space.AbsMulti2DGrid |
|---|
getSize, getSizeX, getSizeY, rangeCheck |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbsMulti2DTorus(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 void clear(int x,
int y)
clear in class AbsMulti2DGridx - the x coordinate of the cell to cleary - the y coordinate of the cell to clear
public java.util.List getObjectsAt(int x,
int y)
getObjectsAt in interface IMulti2DGridgetObjectsAt in class AbsMulti2DGridx - the x coordinatey - the y coordinate
public java.util.Iterator getIteratorAt(int x,
int y)
getIteratorAt in interface IMulti2DGridgetIteratorAt in class AbsMulti2DGridx - the x coordinatey - the y coordinate
public Cell getCellAt(int x,
int y)
getCellAt in interface IMulti2DGridgetCellAt in class AbsMulti2DGridx - the x coordinatey - the y coordinate
public java.util.ArrayList getVNNeighborsLoc(int x,
int y,
boolean returnNulls)
ObjectLocation objects that can be used to
determined the exact location of the object returned. The coordinates
in the ObjectLocation object will be normalized. The objects at x, y
are not returned.
If the neighboring objects contain their location information,
getVNNeighbors(...) should be used as it is faster.
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
ObjectLocation
public java.util.ArrayList getVNNeighborsLoc(int x,
int y,
int xExtent,
int yExtent,
boolean returnNulls)
ObjectLocation objects
that can be used to determined the exact location of the object returned.
The coordinates in the ObjectLocation object will be normalized.
The objects at x, y are not returned.
If the neighboring objects contain their location information,
getVNNeighbors(...) should be used as it is faster.
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
ObjectLocation
public java.util.ArrayList getMooreNeighborsLoc(int x,
int y,
boolean returnNulls)
ObjectLocation objects that can be used to
determined the exact location of the object returned. The coordinates
in the ObjectLocation object will be normalized. Objects are returned
by row starting with the "NW corner" and ending with the "SE corner."
If the neighboring objects contain their location information,
getMooreNeighbors(...) should be used as it is faster.
getMooreNeighborsLoc in class AbsMulti2DGridx - the x coordinate of the objecty - the y coordinate of the objectreturnNulls - should the returned Vector contain null objects
ObjectLocation
public java.util.ArrayList getMooreNeighborsLoc(int x,
int y,
int xExtent,
int yExtent,
boolean returnNulls)
ObjectLocation objects
that can be used to determined the exact location of the object returned.
The coordinates in the ObjectLocation object will be normalized.
The objects at x, y are not returned. Objects are returned by
row starting with the "NW corner" and ending with the "SE corner."
If the neighboring objects contain their location information,
getMooreNeighbors(...) should be used as it is faster.
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
ObjectLocation
public java.util.ArrayList getVNNeighbors(int x,
int y,
boolean returnNulls)
If the neighboring objects do not contain their location information,
getVNNeighborsLoc(...) can be used, although it is
slower.
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
public java.util.ArrayList getVNNeighbors(int x,
int y,
int xExtent,
int yExtent,
boolean returnNulls)
If the neighboring objects do not contain their location information,
getVNNeighborsLoc(...) can be used, although it is
slower.
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
public java.util.ArrayList getMooreNeighbors(int x,
int y,
boolean returnNulls)
If the neighboring objects do not contain their location information,
getMooreNeighborsLoc(...) can be used although it is
slower.
getMooreNeighbors in class AbsMulti2DGridx - the x coordinate of the objecty - the y coordinate of the objectreturnNulls - should the returned ArrayList contain null objects
public java.util.ArrayList getMooreNeighbors(int x,
int y,
int xExtent,
int yExtent,
boolean returnNulls)
If the neighboring objects do not contain their location information,
getMooreNeighborsLoc(...) can be used although it is
slower.
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
ObjectLocation
public int getCellSizeAt(int x,
int y)
getCellSizeAt in interface IMulti2DGridgetCellSizeAt in class AbsMulti2DGridx - the x coordinatey - the y coordinate
public void removeObjectAt(int x,
int y,
java.lang.Object obj)
removeObjectAt in interface IMulti2DGridremoveObjectAt in class AbsMulti2DGridx - the x coordinatey - the y coordinateobj - the object to remove
public java.lang.Object getObjectAt(int x,
int y)
getObjectAt in interface Discrete2DSpacegetObjectAt in class AbsMulti2DGridx - the x coordinatey - the y coordinate
public double getValueAt(int x,
int y)
getValueAt in interface Discrete2DSpacegetValueAt in class AbsMulti2DGridx - the x coordinatey - the y coordinate
public abstract void putObjectAt(int x,
int y,
java.lang.Object object)
putObjectAt in interface Discrete2DSpaceputObjectAt in class AbsMulti2DGridx - the x coordinatey - the y coordinateobject - the object to put
public void putValueAt(int x,
int y,
double value)
putValueAt in interface Discrete2DSpaceputValueAt in class AbsMulti2DGridx - the x coordinatey - the y coordinatevalue - the value to put at x,ypublic BaseMatrix getMatrix()
getMatrix in interface Discrete2DSpacegetMatrix in class AbsMulti2DGridpublic void trim()
trim in class AbsMulti2DGridpublic int xnorm(int x)
x - the value to normalize
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 | |||||||||