Class Space

java.lang.Object
  extended by Space

public class Space
extends java.lang.Object

George Smith CIS421 - Web Based Java December 7th, 2007 Project: Battleship v2.0 Description: The Space class for the battle ship game that is used to manage the spaces on the grid


Field Summary
private  int col
           
private  int row
           
private  java.lang.String ship
           
private  java.lang.String status
           
 
Constructor Summary
Space(int r, int c)
          Sets up the space class to store grid spot states
 
Method Summary
 int getCol()
          Gets the coumn number for this spot
 int getRow()
          gets the row number for this spot
 java.lang.String getShip()
          Gets the ship symbol for that spot
 java.lang.String getStatus()
          Returns the status of a spot on the grid
 void setCol(int c)
          Sets the column number for this spot
 void setRow(int r)
          sets the row number for that spot
 void setShip(java.lang.String s)
          Sets the ship for this spot
 void setStatus(java.lang.String state)
          The space class is used to setup each space on teh grid and holds attributes such as what ship is on that spot, if its been hit, or a miss
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

status

private java.lang.String status

row

private int row

col

private int col

ship

private java.lang.String ship
Constructor Detail

Space

public Space(int r,
             int c)
Sets up the space class to store grid spot states

Parameters:
r - - the row spot on the grid
c - - the column spot on the grid
Method Detail

setStatus

public void setStatus(java.lang.String state)
The space class is used to setup each space on teh grid and holds attributes such as what ship is on that spot, if its been hit, or a miss

Parameters:
state - - the state of the spot

getStatus

public java.lang.String getStatus()
Returns the status of a spot on the grid

Parameters:
none - - no params
Returns:
returns the status

setRow

public void setRow(int r)
sets the row number for that spot

Parameters:
r - - the row spot on the grid

getRow

public int getRow()
gets the row number for this spot

Parameters:
none - - none
Returns:
returns the row number associated

setCol

public void setCol(int c)
Sets the column number for this spot

Parameters:
c - - the column spot on the grid

getCol

public int getCol()
Gets the coumn number for this spot

Parameters:
none - - no params
Returns:
returns the column number for this row

setShip

public void setShip(java.lang.String s)
Sets the ship for this spot

Parameters:
s - - the ship symbol for this spot

getShip

public java.lang.String getShip()
Gets the ship symbol for that spot

Parameters:
none - - no params
Returns:
returns the ship on the spot