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[]baseExitLabelprivate Constants.HexsideGates[]baseExitTypeTODO 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[]entranceTypeprivate Constants.HexsideGates[]exitTypeprivate intlabelSideprivate MasterHex[]neighborsprivate MasterBoardTerrainterrain
-
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 intfindDirectionForEntrySide(EntrySide wantedEntrySide)For a given EntrySide, find out which direction that means.java.lang.StringgetBaseExitLabel(int i)Constants.HexsideGatesgetBaseExitType(int i)Constants.HexsideGatesgetEntranceType(int i)Constants.HexsideGatesgetExitType(int i)intgetLabelSide()MasterHexgetNeighbor(int i)MasterBoardTerraingetTerrain()java.awt.ColorgetTerrainColor()java.lang.StringgetTerrainDisplayName()java.lang.StringgetTerrainName()voidsetBaseExitLabel(int i, java.lang.String label)voidsetBaseExitType(int i, Constants.HexsideGates exitType)voidsetEntranceType(int i, Constants.HexsideGates entranceType)voidsetExitType(int i, Constants.HexsideGates exitType)voidsetLabelSide(int labelSide)(package private) voidsetNeighbor(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:
getTerrainNamein 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)
-
-