package seng302.Model; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; /** * Created by fwy13 on 3/03/17. */ public class Boat { private StringProperty name; private double velocity; private StringProperty velocityProp; private String abbrev; /** * Boat initialiser which keeps all of the information of the boat. * * @param name Name of the Boat. * @param velocity Speed in m/s that the boat travels at. */ public Boat(String name, double velocity, String abbrev) { this.velocity = velocity; this.velocityProp = new SimpleStringProperty(String.valueOf(Math.round(velocity))); this.abbrev = abbrev; this.name = new SimpleStringProperty(name); } /** * @return Name of the boat */ public StringProperty getName() { return name; } /** * Sets the boat name * @param name */ public void setName(String name) { this.name.setValue(name); } /** * @return Speed of the boat. */ public double getVelocity() { return velocity; } /** * Sets the speed of the boat in knots. * @param velocity speed in knots */ public void setVelocity(double velocity) { this.velocity = velocity; this.velocityProp.setValue(velocity); } /** * Print method prints the name of the boat * @return Name of the boat. */ public String toString() { return getName().getValue(); } /** * @return Velocity String Property of the boat */ public StringProperty getVelocityProp() { return velocityProp; } /** * @return Abbreviation of the boat */ public String getAbbrev() { return abbrev; } }