|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectShipBoard
Records all the ships of a player
Field Summary | |
private Ship[] |
fleet
All the ships on this ship board |
private int |
size
The number of ships on this ship board |
Constructor Summary | |
(package private) |
ShipBoard()
Builds a standard ship board containing five ships in the order : PatrolBoat,Destroyer,Submarine,BattleShip,Carrier. |
(package private) |
ShipBoard(Ship[] f,
int s)
Builds a Shipboard containing specified ships |
Method Summary | |
int[] |
getFleetStat()
Get the status of all ships on this Shipboard |
boolean |
hitShip(Location l,
int n)
Check if the specified ship is hit in a location |
boolean |
isDestroyed()
Test if all ships on this Shipboard are sunk |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private int size
private Ship[] fleet
Constructor Detail |
ShipBoard(Ship[] f, int s)
f
- the ships to be added to this Shipboards
- the number of ships to be addedShipBoard()
Method Detail |
public boolean hitShip(Location l, int n)
l
- Location to checkn
- index of the ship to check
public boolean isDestroyed()
public int[] getFleetStat()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |