|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Abstract representation of a grid.
Method Summary | |
java.util.Iterator |
adjacentIterator(Coordinate coordinate)
Create an iterator on coordinates around a given coordinate. |
java.util.Iterator |
adjacentTileIterator(Coordinate coordinate)
Create an iterator on tiles around a given coordinate. |
Coordinate |
getAdjacent(Coordinate coordinate,
IDirection direction)
returns the adjacent Coordinate given a Coordinate center and a Direction. |
int |
getHeight()
Retrieve the height. |
ITile |
getTile(Coordinate coordinate)
Retrieve the tile object at the supplied coordinate. |
int |
getWidth()
Retrieve the width. |
boolean |
isValid(Coordinate coordinate)
Checks if the coordinate supplied is valid for this grid. |
java.util.Iterator |
linearIterator()
Create an iterator on coordinates from the top left to the bottom right coordinate. |
java.util.Iterator |
linearTileIterator()
Create an iterator on tiles from the top left to the bottom right coordinate. |
void |
setTile(ITile tile,
Coordinate coordinate)
Assign the supplied tile to this grid. |
int |
size()
Retrieve the maximum number of tiles this hexGrid can hold. |
Method Detail |
public int getWidth()
public int getHeight()
public int size()
public void setTile(ITile tile, Coordinate coordinate)
If a tile is already present at coordinate()
for the current grid it gets replaced.
tile
- the tile to set in this gridcoordinate
- the coordinate to place the tile atpublic ITile getTile(Coordinate coordinate)
coordinate
- the coordinate in the grid you want the tile for
public boolean isValid(Coordinate coordinate)
coordinate
- the coordinate to test
public Coordinate getAdjacent(Coordinate coordinate, IDirection direction)
coordinate
- the coordinate from which the adjacent coordinate is calculated.direction
- the direction from which the adjacent coordinate is calculated.
public java.util.Iterator linearIterator()
public java.util.Iterator linearTileIterator()
public java.util.Iterator adjacentIterator(Coordinate coordinate)
coordinate
- a coordinate
public java.util.Iterator adjacentTileIterator(Coordinate coordinate)
coordinate
- a coordinate
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |