mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
54 lines
985 B
Java
54 lines
985 B
Java
package seng302;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
class Marker{
|
|
private String name;
|
|
private ArrayList<Boat> boatOrder;
|
|
|
|
/**
|
|
* Represents the marker at the beginning of a leg
|
|
*
|
|
* @param name, the name of the marker
|
|
*/
|
|
public Marker(String name){
|
|
this.name = name;
|
|
this.boatOrder = new ArrayList<Boat>();
|
|
}
|
|
|
|
/**
|
|
* Set the name of the marker
|
|
*
|
|
* @param name, the name of the marker
|
|
*/
|
|
public void setName(String name){
|
|
this.name = name;
|
|
}
|
|
|
|
/**
|
|
* Get the name of the marker
|
|
*
|
|
* @return the name of the marker
|
|
*/
|
|
public String getName(){
|
|
return this.name;
|
|
}
|
|
|
|
/**
|
|
* Add a boat as they pass the marker
|
|
*
|
|
* @param boat, the boat that passed the marker
|
|
*/
|
|
public void addBoat(Boat boat){
|
|
this.boatOrder.add(boat);
|
|
}
|
|
|
|
/**
|
|
* Get a list of boats in the order they passed the marker
|
|
*
|
|
* @return An array of boats in the order they passed the marker
|
|
*/
|
|
public Boat[] getBoats(){
|
|
return this.boatOrder.toArray(new Boat[this.boatOrder.size()]);
|
|
}
|
|
} |