Class games.Battle.shared.sys.Cell
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class games.Battle.shared.sys.Cell

java.lang.Object
   |
   +----games.Battle.shared.sys.Cell

public class Cell
extends Object
A base class for an individual cell (square) in the game board. Both the client and server derive more specialized versions of cell to store the infomration that is of interest to them.

Constructor Index

 o Cell(int, int)
construct a general battle game cell

Method Index

 o clearModified()
clear the contents modified flag
 o clearPipes()
clear all the pipes in this cell.
 o clearTerrainModified()
clear the terrain modified flag
 o getCity()
return the city amount
 o getCol()
return the column that this cell is in
 o getOccupancy()
return the occupancy
 o getPipe(int)
return the state of the pipe in the direction given
 o getPipeMask()
build a pipe mask from the current pipe state.
 o getPipes()
return the array of pipes.
 o getRow()
return the row that this cell is in
 o getTerrain()
return the level of the terrain in this cell.
 o getTroops()
return the number of troops in this cell
 o isModified()
return true if this cell's contents have been modified
 o isTerrainModified()
return true if this cell's terrain has been modified
 o isVisible(int)
return whether or not this cell is visible to a particuler player.
 o setCity(int)
set the city construction amount
 o setCity()
Make this cell a functioning city (i.e.
 o setModified()
set the content modified flag
 o setOccupancy(int)
set the occupancy
 o setPipe(int, boolean)
set or clear a pipe in the given direction.
 o setPipes(int)
special method for setting pipes.
 o setTerrain(int)
set the height of the terrain in this cell.
 o setTerrainModified()
set the terrain modified flag
 o setTroops(int)
set how many troops are in this cell.

Constructors

 o Cell
  public Cell(int r,
              int c)
construct a general battle game cell
Parameters:
r - the row
c - the column

Methods

 o setOccupancy
  public final void setOccupancy(int occ)
set the occupancy
 o setCity
  public final void setCity(int amt)
set the city construction amount
Parameters:
amt - the amount of city that is here. Always complete cities for now.
 o setPipe
  public final void setPipe(int dir,
                            boolean state)
set or clear a pipe in the given direction.
Parameters:
dir - the direction; 0 is north. defines are in Symbols
state - the state of the pipe, on or off.
 o clearPipes
  public final void clearPipes()
clear all the pipes in this cell.
 o setTerrain
  public final void setTerrain(int level)
set the height of the terrain in this cell.
Parameters:
level - the height of the land.
 o setTroops
  public final void setTroops(int num)
set how many troops are in this cell.
Parameters:
num - the number of troops.
 o setPipes
  public final void setPipes(int mask)
special method for setting pipes. the lower four bits in mask indicate which pipes are on and which are off. bits 3, 2, 1, and 0 represent the north, east, south and west pipes, respectively

This method is convenient because of the way data is transmitted between client and server.

Parameters:
mask - the bitmask of pipes.
 o getOccupancy
  public final int getOccupancy()
return the occupancy
 o getCity
  public final int getCity()
return the city amount
 o getPipes
  public final boolean[] getPipes()
return the array of pipes.
 o getPipe
  public final boolean getPipe(int dir)
return the state of the pipe in the direction given
Parameters:
dir - the direction
 o getPipeMask
  public final int getPipeMask()
build a pipe mask from the current pipe state. The lower four bits of the returned int represent the state of each pipe.
 o getTerrain
  public final int getTerrain()
return the level of the terrain in this cell.
 o getTroops
  public final int getTroops()
return the number of troops in this cell
 o getRow
  public final int getRow()
return the row that this cell is in
 o getCol
  public final int getCol()
return the column that this cell is in
 o isModified
  public final boolean isModified()
return true if this cell's contents have been modified
 o isTerrainModified
  public final boolean isTerrainModified()
return true if this cell's terrain has been modified
 o clearModified
  public void clearModified()
clear the contents modified flag
 o clearTerrainModified
  public void clearTerrainModified()
clear the terrain modified flag
 o setModified
  public final void setModified()
set the content modified flag
 o setTerrainModified
  public final void setTerrainModified()
set the terrain modified flag
 o isVisible
  public boolean isVisible(int player)
return whether or not this cell is visible to a particuler player. this method should be overridden to create the effect of invisible cells.
 o setCity
  public void setCity()
Make this cell a functioning city (i.e. a city with the maximum number of city segments.

All Packages  Class Hierarchy  This Package  Previous  Next  Index