Merge branch anton with master for v2.0.
[ailab2.git] / src / Road.java
blob12eacc8130782458bcac3e59d76f7989a412b710
1 /**
2 * This class is used to store as edges in a graph.
4 * @author Anton Johansson <anton.johansson@gmail.com>
5 * @version 1.0
6 */
7 public class Road {
8 private int speed;
9 private double distance;
10 private double travelTime;
12 /**
13 * Creates a new Road instance.
15 * @param speed The speed of this Road.
16 * @param distance The distance of this Road.
18 public Road(int speed, double distance) {
19 this.speed = speed;
20 this.distance = distance;
21 this.travelTime = distance / (speed /* 3.6*/);
24 /**
25 * Gets the value of speed
27 * @return the value of speed
29 public final int getSpeed() {
30 return this.speed;
33 /**
34 * Gets the value of distance
36 * @return the value of distance
38 public final double getDistance() {
39 return this.distance;
42 /**
43 * Gets the value of travelTime
45 * @return the value of travelTime
47 public final double getTravelTime() {
48 return this.travelTime;
51 /**
52 * Returns a String-representation of this Road. The String value
53 * of travelTime is returned.
55 * @return The String value of this Road.
57 public String toString() {
58 return new Double(this.travelTime).toString();