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 intThe number of hexes in the widest section.private static final Loggerprivate final MasterHex[][]TODO do something more OO, don't use arrays, foldshowinto 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 intThe number of hexes in the tallest section. -
Constructor Summary
ConstructorsConstructorDescriptionMasterBoard(int horizSize, int vertSize, boolean[][] show, MasterHex[][] plainHexArray) -
Method Summary
Modifier and TypeMethodDescriptionprivate intReturn a set of all hex labels.Return a set of all hex labels.intgetHexByLabel(String label) Retrieve a hex by its label.intMasterHex[][]boolean[][]getShow()intprivate voidbooleanisHexInverted(int i, int j) private voidsetupEntrances(MasterHex[][] h) private voidsetupExits(MasterHex[][] h) private voidsetupHexLabelSides(MasterHex[][] h) If the shortest hexside closest to the center of the board is a short hexside, set the label side to it.private voidsetupNeighbors(MasterHex[][] h) private voidsetupOneExit(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
-
show
private final boolean[][] showThe hexes in the horizSize*vertSize array that actually exist are represented by true. -
towerSet
-
hexByLabelCache
-
-
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
-
getTowerSet
-
setupTowerSet
private void setupTowerSet() -
getAllHexLabels
-
getAllHexes
Return a set of all hex labels.
-