Package net.sf.colossus.variant
Class MasterHex
- java.lang.Object
-
- net.sf.colossus.variant.Hex
-
- net.sf.colossus.variant.MasterHex
-
public class MasterHex extends Hex
Class MasterHex describes one Masterboard hex, without GUI info.- Author:
- David Ripton, Romain Dolbeau
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String[]
baseExitLabel
private Constants.HexsideGates[]
baseExitType
TODO these base exit types and labels are somehow used only during setup of the MasterBoard, no real need to keep them around.private Constants.HexsideGates[]
entranceType
private Constants.HexsideGates[]
exitType
private int
labelSide
private MasterHex[]
neighbors
private MasterBoardTerrain
terrain
-
Constructor Summary
Constructors Constructor Description MasterHex(java.lang.String label, MasterBoardTerrain terrain, int xCoord, int yCoord)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
findDirectionForEntrySide(EntrySide wantedEntrySide)
For a given EntrySide, find out which direction that means.java.lang.String
getBaseExitLabel(int i)
Constants.HexsideGates
getBaseExitType(int i)
Constants.HexsideGates
getEntranceType(int i)
Constants.HexsideGates
getExitType(int i)
int
getLabelSide()
MasterHex
getNeighbor(int i)
MasterBoardTerrain
getTerrain()
java.awt.Color
getTerrainColor()
java.lang.String
getTerrainDisplayName()
java.lang.String
getTerrainName()
void
setBaseExitLabel(int i, java.lang.String label)
void
setBaseExitType(int i, Constants.HexsideGates exitType)
void
setEntranceType(int i, Constants.HexsideGates entranceType)
void
setExitType(int i, Constants.HexsideGates exitType)
void
setLabelSide(int labelSide)
(package private) void
setNeighbor(int i, MasterHex hex)
-
-
-
Field Detail
-
neighbors
private final MasterHex[] neighbors
-
labelSide
private int labelSide
-
exitType
private final Constants.HexsideGates[] exitType
-
entranceType
private final Constants.HexsideGates[] entranceType
-
baseExitType
private final Constants.HexsideGates[] baseExitType
TODO these base exit types and labels are somehow used only during setup of the MasterBoard, no real need to keep them around. It seems to be related to the fact that the master board hexes are really triangles and stored as such in the XML files. Maybe they should not be hexes in the code either.
-
baseExitLabel
private final java.lang.String[] baseExitLabel
-
terrain
private final MasterBoardTerrain terrain
-
-
Constructor Detail
-
MasterHex
public MasterHex(java.lang.String label, MasterBoardTerrain terrain, int xCoord, int yCoord)
-
-
Method Detail
-
getTerrain
public MasterBoardTerrain getTerrain()
-
getTerrainName
public java.lang.String getTerrainName()
- Specified by:
getTerrainName
in classHex
-
getTerrainDisplayName
public java.lang.String getTerrainDisplayName()
-
getTerrainColor
public java.awt.Color getTerrainColor()
-
getNeighbor
public MasterHex getNeighbor(int i)
-
setNeighbor
void setNeighbor(int i, MasterHex hex)
-
getLabelSide
public int getLabelSide()
-
findDirectionForEntrySide
public int findDirectionForEntrySide(EntrySide wantedEntrySide)
For a given EntrySide, find out which direction that means. Caller can use that e.g. to figure out what is the neighbor hex from where an attacker is coming TODO should this rather be somewhere else? Since it uses entryside, it makes variant package depending on game package ...- Parameters:
wantedEntrySide
-- Returns:
- The direction towards which that entryside is placed
-
setLabelSide
public void setLabelSide(int labelSide)
-
getExitType
public Constants.HexsideGates getExitType(int i)
-
setExitType
public void setExitType(int i, Constants.HexsideGates exitType)
-
getBaseExitType
public Constants.HexsideGates getBaseExitType(int i)
-
setBaseExitType
public void setBaseExitType(int i, Constants.HexsideGates exitType)
-
getBaseExitLabel
public java.lang.String getBaseExitLabel(int i)
-
setBaseExitLabel
public void setBaseExitLabel(int i, java.lang.String label)
-
getEntranceType
public Constants.HexsideGates getEntranceType(int i)
-
setEntranceType
public void setEntranceType(int i, Constants.HexsideGates entranceType)
-
-