infpp.oceanlife
Interface OceanInterface

All Known Implementing Classes:
Ocean

public interface OceanInterface

Implements the following methods: getWidth, setWidth, getDepth, setDepth, getOceanObjects, initialiseOceanObjects, toString, addOceanOceanObject, removeOceanObjetct.

Author:
tdu, akue

Method Summary
 void addOceanObject(OceanObject obj)
           
 int getDepth()
           
 java.util.LinkedList<OceanObject> getOceanObjects()
           
 int getWidth()
           
 void initialiseOceanObjects(java.util.LinkedList<OceanObject> oceanObjects)
           
 void removeOceanObject(int x)
           
 void setDepth(int depth)
           
 void setWidth(int width)
           
 java.lang.String toString()
           
 

Method Detail

getWidth

int getWidth()
Returns:
Returns the width of the ocean.

setWidth

void setWidth(int width)
              throws java.lang.Exception
Parameters:
width - the width to set
Throws:
java.lang.Exception - if the width is negative

getDepth

int getDepth()
Returns:
Returns the depth of the ocean.

setDepth

void setDepth(int depth)
              throws java.lang.Exception
Parameters:
depth - the depth to set
Throws:
java.lang.Exception - if the depth is negative

getOceanObjects

java.util.LinkedList<OceanObject> getOceanObjects()
Returns:
Returns all ocean objects.

initialiseOceanObjects

void initialiseOceanObjects(java.util.LinkedList<OceanObject> oceanObjects)
                            throws java.lang.Exception
Parameters:
oceanObjects - the list of ocean objects to go into the ocean.
Throws:
java.lang.Exception - if something went wrong during the initialisation, such as objects being outside of the ocean.

toString

java.lang.String toString()
Overrides:
toString in class java.lang.Object

addOceanObject

void addOceanObject(OceanObject obj)
                    throws java.lang.Exception
Parameters:
obj - the object to add
Throws:
java.lang.Exception - if the object cannot be added, eg due to a collision with an existing object or it being added outside of the ocean.

removeOceanObject

void removeOceanObject(int x)
                       throws java.lang.Exception
Parameters:
x - the list index of the object in question.
Throws:
java.lang.Exception - if no object exists at the given index.