|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.vizzini.game.boardgame.GridBoardSupport
public class GridBoardSupport
Provides support for grid boards in the game framework. Provides methods for converting between grid coordinates and indexes.
| Constructor Summary | |
|---|---|
GridBoardSupport(int fileCount,
int rankCount,
int levelCount)
Construct this object with the given parameters. |
|
| Method Summary | |
|---|---|
boolean |
contains(int index)
Return true if the given position is within the limits of this board. |
boolean |
contains(int file,
int rank,
int level)
Return true if the given position is within the limits of this board. |
int |
coordsToIndex(int file,
int rank,
int level)
Return the index computed from the given parameters. |
int |
getCellCount()
Return the cell count. |
int[] |
getDimensions()
Return the dimensions. |
int |
getFileCount()
Return the file count. |
int |
getLevelCount()
Return the level count. |
int |
getMaxDimension()
Return the maximum of the file, rank, and level counts. |
int |
getRankCount()
Return the rank count. |
int[] |
indexToCoords(int bitIndex)
Return the coordinates computed from the given index. |
int |
indexToFile(int index)
Return the file coordinates computed from the given index. |
int |
indexToLevel(int index)
Return the level coordinates computed from the given index. |
IntegerPosition |
indexToPosition(int index)
Return the position computed from the given index. |
int |
indexToRank(int index)
Return the rank coordinates computed from the given index. |
int |
positionToIndex(IntegerPosition position)
Return the index computed from the given position. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public GridBoardSupport(int fileCount,
int rankCount,
int levelCount)
fileCount - File count.rankCount - Rank count.levelCount - Level count.| Method Detail |
|---|
public boolean contains(int index)
index - Index.
public boolean contains(int file,
int rank,
int level)
file - File.rank - Rank.level - Level.
public int coordsToIndex(int file,
int rank,
int level)
file - File.rank - Rank.level - Level.
public int getCellCount()
public int[] getDimensions()
public int getFileCount()
public int getLevelCount()
public int getMaxDimension()
public int getRankCount()
public int[] indexToCoords(int bitIndex)
indexToFile(),
indexToRank(), and indexToLevel() instead. (Yes,
three method calls are faster than creating an int array.)
public int indexToFile(int index)
index - Index.public int indexToLevel(int index)
index - Index.public IntegerPosition indexToPosition(int index)
index - Index.public int indexToRank(int index)
index - Index.public int positionToIndex(IntegerPosition position)
position - Position.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
| Copyright © 2007 Vizzini.org. All Rights Reserved. | 2007.12.25.03.00.02 |