|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectmegamek.common.Board
public class Board
| Field Summary | |
|---|---|
static int |
BOARD_MAX_HEIGHT
|
static int |
BOARD_MAX_WIDTH
|
static java.lang.String |
BOARD_REQUEST_ROTATION
|
protected java.util.Vector<BoardListener> |
boardListeners
|
protected int |
height
|
static int |
START_ANY
|
static int |
START_CENTER
|
static int |
START_E
|
static int |
START_EDGE
|
static int |
START_N
|
static int |
START_NE
|
static int |
START_NONE
|
static int |
START_NW
|
static int |
START_S
|
static int |
START_SE
|
static int |
START_SW
|
static int |
START_W
|
static int |
T_ATMOSPHERE
|
static int |
T_GROUND
|
static int |
T_SPACE
|
protected int |
width
|
| Constructor Summary | |
|---|---|
Board()
Creates a new board with zero as its width and height parameters. |
|
Board(int width,
int height)
Creates a new board of the specified dimensions. |
|
Board(int width,
int height,
IHex[] data)
Creates a new board of the specified dimensions and specified hex data. |
|
Board(int width,
int height,
IHex[] hexes,
java.util.Vector<Building> bldgs,
java.util.Hashtable<Coords,InfernoTracker> infMap)
Creates a new board of the specified dimensions, hexes, buildings, and inferno trackers. |
|
| Method Summary | |
|---|---|
void |
addBoardListener(BoardListener listener)
Adds the specified board listener to receive board events from this board. |
void |
addInfernoTo(Coords coords,
InfernoTracker.Inferno round,
int hits)
Record that the given coordinates have recieved a hit from an inferno. |
void |
addSpecialHexDisplay(Coords coords,
SpecialHexDisplay shd)
|
static boolean |
boardIsSize(java.lang.String filename,
int x,
int y)
Checks if a file in data/boards is the specified size |
boolean |
burnInferno(Coords coords)
Record that a new round of burning has passed for the given coordinates. |
void |
collapseBuilding(Building bldg)
The given building has collapsed. |
void |
collapseBuilding(Coords coords)
The given building hex has collapsed. |
void |
collapseBuilding(java.util.Vector<Coords> coords)
Collapse a vector of building hexes. |
boolean |
contains(Coords c)
Determines whether this Board "contains" the specified Coords. |
boolean |
contains(int x,
int y)
Determines whether this Board "contains" the specified Coords. |
Building |
getBuildingAt(Coords coords)
Get the building at the given coordinates. |
java.util.Enumeration<Building> |
getBuildings()
Get an enumeration of all buildings on the board. |
int |
getHeight()
|
IHex |
getHex(Coords c)
Returns the Hex at the specified Coords. |
IHex |
getHex(int x,
int y)
Determines if this Board contains the (x, y) Coords, and if so, returns the Hex at that position. |
java.util.Enumeration<Coords> |
getHexesAtDistance(Coords coords,
int distance)
|
IHex |
getHexInDir(Coords c,
int dir)
Gets the hex in the specified direction from the specified starting coordinates. |
IHex |
getHexInDir(int x,
int y,
int dir)
Gets the hex in the specified direction from the specified starting coordinates. |
java.util.Enumeration<Coords> |
getInfernoBurningCoords()
Get an enumeration of all coordinates with infernos still burning. |
int |
getInfernoBurnTurns(Coords coords)
Determine the remaining number of turns the given coordinates will have a burning inferno. |
int |
getInfernoIVBurnTurns(Coords coords)
Determine the remaining number of turns the given coordinates will have a burning Inferno IV round. |
java.util.Hashtable<Coords,InfernoTracker> |
getInfernos()
returns a hash of the inferno trackers |
protected java.util.Vector<BoardListener> |
getListeners()
|
int |
getMaxElevation()
Returns the highest elevation hex on the board. |
int |
getMinElevation()
Returns the lowest elevation hex on the board. |
boolean |
getRoadsAutoExit()
Get the current value of the "road auto-exit" option. |
java.util.Collection<SpecialHexDisplay> |
getSpecialHexDisplay(Coords coords)
This returns special events that should be makred on hexes, such as artilery fire. |
java.util.Hashtable<Coords,java.util.Collection<SpecialHexDisplay>> |
getSpecialHexDisplayTable()
|
int |
getType()
|
static java.lang.String |
getTypeName(int t)
|
int |
getWidth()
|
boolean |
inAtmosphere()
|
protected void |
initializeAll()
Initialize all hexes |
void |
initializeAround(int x,
int y)
Initialize a hex and the hexes around it |
boolean |
inSpace()
|
boolean |
isInfernoBurning(Coords coords)
Determine if the given coordinates has a burning inferno. |
boolean |
isLegalDeployment(Coords c,
int nDir)
Can the player deploy an entity here? |
void |
load(java.io.InputStream is)
Loads this board from an InputStream |
void |
load(java.lang.String filename)
Loads this board from a filename in data/boards |
void |
newData(int width,
int height)
Creates a new data set for the board, with the specified dimensions; notifies listeners that a new data set has been created. |
void |
newData(int width,
int height,
IHex[] data)
Creates a new data set for the board, with the specified dimensions and data; notifies listeners that a new data set has been created. |
boolean |
onGround()
|
protected void |
processBoardEvent(BoardEvent event)
|
void |
removeBoardListener(BoardListener listener)
Removes the specified board listener. |
void |
removeInfernoFrom(Coords coords)
Extinguish inferno at the target hex. |
void |
resetStoredElevation()
Resets the Min and Max elevations to their default values. |
void |
save(java.io.OutputStream os)
Writes data for the board, as text to the OutputStream |
void |
save2(java.io.OutputStream os)
Writes data for the board, as serialization, to the OutputStream |
void |
setBridgeCF(int value)
Set the CF of bridges |
void |
setHex(Coords c,
IHex hex)
Sets the hex into the location specified by the Coords. |
void |
setHex(int x,
int y,
IHex hex)
Determines if this Board contains the (x, y) Coords, and if so, sets the specified Hex into that position and initializes it. |
void |
setRoadsAutoExit(boolean value)
Set the value of the "road auto-exit" option. |
void |
setSpecialHexDisplayTable(java.util.Hashtable<Coords,java.util.Collection<SpecialHexDisplay>> shd)
|
void |
setType(int t)
|
void |
updateBuildingCF(java.util.Vector<Building> bldgs)
Update the construction factors on an array of buildings. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String BOARD_REQUEST_ROTATION
public static final int BOARD_MAX_WIDTH
public static final int BOARD_MAX_HEIGHT
public static final int START_NONE
public static final int START_ANY
public static final int START_NW
public static final int START_N
public static final int START_NE
public static final int START_E
public static final int START_SE
public static final int START_S
public static final int START_SW
public static final int START_W
public static final int START_EDGE
public static final int START_CENTER
protected int width
protected int height
public static final int T_GROUND
public static final int T_ATMOSPHERE
public static final int T_SPACE
protected transient java.util.Vector<BoardListener> boardListeners
| Constructor Detail |
|---|
public Board()
public Board(int width,
int height)
width - the width dimension.height - the height dimension.
public Board(int width,
int height,
IHex[] data)
width - the width dimension.height - the height dimension.data -
public Board(int width,
int height,
IHex[] hexes,
java.util.Vector<Building> bldgs,
java.util.Hashtable<Coords,InfernoTracker> infMap)
width - The int width dimension in hexes.height - The int height dimension in hexes.hexes - The array of Hexes for this board. This
object is used directly without being copied. This value
should only be null if either
width or height is zero.bldgs - The Vector of Buildings for
this board. This object is used directly without being copied.infMap - The Hashtable that map Coords
to InfernoTrackers for this board. This object
is used directly without being copied.| Method Detail |
|---|
public int getHeight()
getHeight in interface IBoardpublic int getWidth()
getWidth in interface IBoard
public void newData(int width,
int height,
IHex[] data)
IBoard
newData in interface IBoardwidth - the width dimension.height - the height dimension.data - new hex data appropriate for the board.
public void newData(int width,
int height)
IBoard
newData in interface IBoardwidth - the width dimension.height - the height dimension.
public java.util.Enumeration<Coords> getHexesAtDistance(Coords coords,
int distance)
getHexesAtDistance in interface IBoard
public IHex getHex(int x,
int y)
getHex in interface IBoardx - the x Coords.y - the y Coords.
public IHex getHexInDir(Coords c,
int dir)
getHexInDir in interface IBoardc - starting coordinatesdir - direction
public IHex getHexInDir(int x,
int y,
int dir)
getHexInDir in interface IBoardx - starting x coordinatey - starting y coordinatedir - direction
protected void initializeAll()
public void initializeAround(int x,
int y)
initializeAround in interface IBoard
public boolean contains(int x,
int y)
contains in interface IBoardx - the x Coords.y - the y Coords.
true if the board contains the specified coordspublic boolean contains(Coords c)
contains in interface IBoardc - the Coords.
true if the board contains the specified coordspublic IHex getHex(Coords c)
getHex in interface IBoardc - the Coords.
public void setHex(int x,
int y,
IHex hex)
setHex in interface IBoardx - the x Coords.y - the y Coords.hex - the hex to be set into position.
public void setHex(Coords c,
IHex hex)
setHex in interface IBoardc - the Coords.hex - the hex to be set into position.
public static boolean boardIsSize(java.lang.String filename,
int x,
int y)
public boolean isLegalDeployment(Coords c,
int nDir)
isLegalDeployment in interface IBoardpublic void load(java.lang.String filename)
load in interface IBoardfilename - filename to load frompublic void load(java.io.InputStream is)
load in interface IBoardis - input streampublic void save(java.io.OutputStream os)
save in interface IBoardos - output streampublic void save2(java.io.OutputStream os)
public void addInfernoTo(Coords coords,
InfernoTracker.Inferno round,
int hits)
addInfernoTo in interface IBoardcoords - - the Coords of the hit.round - - the kind of round that hit the hex.hits - - the int number of rounds that hit. If a
negative number is passed, then an
IllegalArgumentException will be thrown.public void removeInfernoFrom(Coords coords)
IBoard
removeInfernoFrom in interface IBoardcoords - - the Coords of the hit.public boolean isInfernoBurning(Coords coords)
isInfernoBurning in interface IBoardcoords - - the Coords being checked.
true if those coordinates have a burning inferno
round. false if no inferno has hit those
coordinates or if it has burned out.public boolean burnInferno(Coords coords)
burnInferno in interface IBoardcoords - - the Coords being checked.
true if those coordinates have a burning inferno
round. false if no inferno has hit those
coordinates or if it has burned out.public java.util.Enumeration<Coords> getInfernoBurningCoords()
getInfernoBurningCoords in interface IBoardEnumeration of Coords that have
infernos still burning.public int getInfernoBurnTurns(Coords coords)
getInfernoBurnTurns in interface IBoardcoords - - the Coords being checked. This value must
not be null. Unchecked.
int number of burn turns left for all infernos
This value will be non-negative.public int getInfernoIVBurnTurns(Coords coords)
getInfernoIVBurnTurns in interface IBoardcoords - - the Coords being checked. This value must
not be null. Unchecked.
int number of burn turns left for Arrow IV
infernos. This value will be non-negative.public java.util.Enumeration<Building> getBuildings()
getBuildings in interface IBoardEnumeration of Buildings.public Building getBuildingAt(Coords coords)
getBuildingAt in interface IBoardcoords - - the Coords being examined.
Building object, if there is one at the given
coordinates, otherwise a null will be returned.public void collapseBuilding(java.util.Vector<Coords> coords)
collapseBuilding in interface IBoardbldgs - - the Vector of Coord
objects to be collapsed.public void collapseBuilding(Coords coords)
collapseBuilding in interface IBoardother - - the Building that has collapsed.public void collapseBuilding(Building bldg)
collapseBuilding in interface IBoardother - - the Building that has collapsed.public void updateBuildingCF(java.util.Vector<Building> bldgs)
updateBuildingCF in interface IBoardbldgs - - the Vector of Building
objects to be updated.public boolean getRoadsAutoExit()
getRoadsAutoExit in interface IBoardtrue if roads should automatically exit onto all
adjacent pavement hexes. false otherwise.public void setRoadsAutoExit(boolean value)
setRoadsAutoExit in interface IBoardvalue - - The value to set for the option; true if
roads should automatically exit onto all adjacent pavement
hexes. false otherwise.public void addBoardListener(BoardListener listener)
IBoard
addBoardListener in interface IBoardlistener - the board listener.public void removeBoardListener(BoardListener listener)
IBoard
removeBoardListener in interface IBoardlistener - the board listener.protected void processBoardEvent(BoardEvent event)
protected java.util.Vector<BoardListener> getListeners()
public java.util.Hashtable<Coords,InfernoTracker> getInfernos()
IBoard
getInfernos in interface IBoardHashtableInfernoTrackers on the board.public void setBridgeCF(int value)
IBoard
setBridgeCF in interface IBoardvalue - - The value to set the bridge CF to.public java.util.Collection<SpecialHexDisplay> getSpecialHexDisplay(Coords coords)
IBoard
getSpecialHexDisplay in interface IBoard
public void addSpecialHexDisplay(Coords coords,
SpecialHexDisplay shd)
addSpecialHexDisplay in interface IBoardpublic java.util.Hashtable<Coords,java.util.Collection<SpecialHexDisplay>> getSpecialHexDisplayTable()
getSpecialHexDisplayTable in interface IBoardpublic void setSpecialHexDisplayTable(java.util.Hashtable<Coords,java.util.Collection<SpecialHexDisplay>> shd)
setSpecialHexDisplayTable in interface IBoardpublic void setType(int t)
setType in interface IBoardpublic int getType()
getType in interface IBoardpublic static java.lang.String getTypeName(int t)
public boolean onGround()
onGround in interface IBoardpublic boolean inAtmosphere()
inAtmosphere in interface IBoardpublic boolean inSpace()
inSpace in interface IBoardpublic int getMaxElevation()
IBoard
getMaxElevation in interface IBoardpublic int getMinElevation()
IBoard
getMinElevation in interface IBoardpublic void resetStoredElevation()
IBoard
resetStoredElevation in interface IBoard
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||