Class ShipList

java.lang.Object
  extended by ShipList

public class ShipList
extends java.lang.Object

Contains the list of ships present in a board. replicates the vector class


Constructor Summary
ShipList()
           
 
Method Summary
 void add(Ship ship)
          Adds a ship to this list.
 boolean allShipsSunk()
           
 Ship containsShip(int x, int y)
          Returns the ship present at the requested co-ordinates.
 Ship getShip(int index)
           
 int getShipCount()
          Returns the number of ships in the list.
 int getShipNumber(Ship ship)
           
 void print()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShipList

public ShipList()
Method Detail

add

public void add(Ship ship)
Adds a ship to this list.

Parameters:
ship - the instance to be added.

containsShip

public Ship containsShip(int x,
                         int y)
Returns the ship present at the requested co-ordinates.

Parameters:
x - the x co-ordinate
y - the y coordinate
Returns:
the ship instance present

getShipCount

public int getShipCount()
Returns the number of ships in the list. returns the ship count


getShip

public Ship getShip(int index)

getShipNumber

public int getShipNumber(Ship ship)

allShipsSunk

public boolean allShipsSunk()

print

public void print()