Package net.sf.colossus.variant
Class MasterBoard
java.lang.Object
net.sf.colossus.variant.MasterBoard
The master board as part of a variant.
Instances of this class are immutable.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int
"parity" of the board, so that hexes are displayed the proper wayA cache for faster lookup of hexes using their labels.private final int
The number of hexes in the widest section.private static final Logger
private final MasterHex[][]
TODO do something more OO, don't use arrays, foldshow
into it somehow (even using null seems better than the split).private final boolean[][]
The hexes in the horizSize*vertSize array that actually exist are represented by true.A Set of all Tower hexes.private final int
The number of hexes in the tallest section. -
Constructor Summary
ConstructorsConstructorDescriptionMasterBoard
(int horizSize, int vertSize, boolean[][] show, MasterHex[][] plainHexArray) -
Method Summary
Modifier and TypeMethodDescriptionprivate int
Return a set of all hex labels.Return a set of all hex labels.int
getHexByLabel
(String label) Retrieve a hex by its label.int
MasterHex[][]
boolean[][]
getShow()
int
private void
boolean
isHexInverted
(int i, int j) private void
setupEntrances
(MasterHex[][] h) private void
setupExits
(MasterHex[][] h) private void
setupHexLabelSides
(MasterHex[][] h) If the shortest hexside closest to the center of the board is a short hexside, set the label side to it.private void
setupNeighbors
(MasterHex[][] h) private void
setupOneExit
(MasterHex[][] h, int i, int j, int k) private void
-
Field Details
-
LOGGER
-
horizSize
private final int horizSizeThe number of hexes in the widest section. -
vertSize
private final int vertSizeThe number of hexes in the tallest section. -
boardParity
private final int boardParity"parity" of the board, so that hexes are displayed the proper way -
plainHexArray
TODO do something more OO, don't use arrays, foldshow
into it somehow (even using null seems better than the split). -
show
private final boolean[][] showThe hexes in the horizSize*vertSize array that actually exist are represented by true. -
towerSet
A Set of all Tower hexes. -
hexByLabelCache
A cache for faster lookup of hexes using their labels.
-
-
Constructor Details
-
MasterBoard
-
-
Method Details
-
getBoardParity
public int getBoardParity() -
getPlainHexArray
-
getShow
public boolean[][] getShow() -
getHorizSize
public int getHorizSize() -
getVertSize
public int getVertSize() -
computeBoardParity
private int computeBoardParity() -
setupExits
-
setupOneExit
-
setupEntrances
-
setupHexLabelSides
If the shortest hexside closest to the center of the board is a short hexside, set the label side to it. Else set the label side to the opposite hexside. -
isHexInverted
public boolean isHexInverted(int i, int j) -
setupNeighbors
-
initHexByLabelCache
private void initHexByLabelCache() -
getHexByLabel
Retrieve a hex by its label.- Parameters:
label
- The label to find the hex for. Valid label, not null.- Returns:
- The label found.
-
getTowerSet
-
setupTowerSet
private void setupTowerSet() -
getAllHexLabels
Return a set of all hex labels. -
getAllHexes
Return a set of all hex labels.
-