public class MasterBoard
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private int |
boardParity
"parity" of the board, so that hexes are displayed the proper way
|
private java.util.Map<java.lang.String,MasterHex> |
hexByLabelCache
A cache for faster lookup of hexes using their labels.
|
private int |
horizSize
The number of hexes in the widest section.
|
private static java.util.logging.Logger |
LOGGER |
private MasterHex[][] |
plainHexArray
TODO do something more OO, don't use arrays, fold
show into
it somehow (even using null seems better than the split). |
private boolean[][] |
show
The hexes in the horizSize*vertSize array that actually exist are
represented by true.
|
private java.util.Set<MasterHex> |
towerSet
A Set of all Tower hexes.
|
private int |
vertSize
The number of hexes in the tallest section.
|
Constructor and Description |
---|
MasterBoard(int horizSize,
int vertSize,
boolean[][] show,
MasterHex[][] plainHexArray) |
Modifier and Type | Method and Description |
---|---|
private int |
computeBoardParity() |
java.util.Collection<MasterHex> |
getAllHexes()
Return a set of all hex labels.
|
java.util.Set<java.lang.String> |
getAllHexLabels()
Return a set of all hex labels.
|
int |
getBoardParity() |
MasterHex |
getHexByLabel(java.lang.String label)
Retrieve a hex by its label.
|
int |
getHorizSize() |
MasterHex[][] |
getPlainHexArray() |
boolean[][] |
getShow() |
java.util.Set<MasterHex> |
getTowerSet() |
int |
getVertSize() |
private void |
initHexByLabelCache() |
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 |
setupTowerSet() |
private static final java.util.logging.Logger LOGGER
private final int horizSize
private final int vertSize
private final int boardParity
private final MasterHex[][] plainHexArray
show
into
it somehow (even using null seems better than the split).private final boolean[][] show
private final java.util.Set<MasterHex> towerSet
private final java.util.Map<java.lang.String,MasterHex> hexByLabelCache
public MasterBoard(int horizSize, int vertSize, boolean[][] show, MasterHex[][] plainHexArray)
public int getBoardParity()
public MasterHex[][] getPlainHexArray()
public boolean[][] getShow()
public int getHorizSize()
public int getVertSize()
private int computeBoardParity()
private void setupExits(MasterHex[][] h)
private void setupOneExit(MasterHex[][] h, int i, int j, int k)
private void setupEntrances(MasterHex[][] h)
private void setupHexLabelSides(MasterHex[][] h)
public boolean isHexInverted(int i, int j)
private void setupNeighbors(MasterHex[][] h)
private void initHexByLabelCache()
public MasterHex getHexByLabel(java.lang.String label)
label
- The label to find the hex for. Valid label, not null.public java.util.Set<MasterHex> getTowerSet()
private void setupTowerSet()
public java.util.Set<java.lang.String> getAllHexLabels()
public java.util.Collection<MasterHex> getAllHexes()