|
@@ -16,35 +16,51 @@ import java.util.List;
|
16
|
16
|
* @see ArcBackward
|
17
|
17
|
*
|
18
|
18
|
*/
|
19
|
|
-public interface Arc {
|
|
19
|
+public abstract class Arc {
|
20
|
20
|
|
21
|
21
|
/**
|
22
|
22
|
* @return Origin node of this arc.
|
23
|
23
|
*/
|
24
|
|
- public Node getOrigin();
|
|
24
|
+ public abstract Node getOrigin();
|
25
|
25
|
|
26
|
26
|
/**
|
27
|
27
|
* @return Destination node of this arc.
|
28
|
28
|
*/
|
29
|
|
- public Node getDestination();
|
|
29
|
+ public abstract Node getDestination();
|
30
|
30
|
|
31
|
31
|
/**
|
32
|
32
|
* @return Length of this arc, in meters.
|
33
|
33
|
*/
|
34
|
|
- public float getLength();
|
|
34
|
+ public abstract double getLength();
|
|
35
|
+
|
|
36
|
+ /**
|
|
37
|
+ * Compute the time required to travel this arc if moving at the given speed.
|
|
38
|
+ *
|
|
39
|
+ * @param speed Speed to compute the travel time.
|
|
40
|
+ *
|
|
41
|
+ * @return Time (in seconds) required to travel this arc at the given speed (in
|
|
42
|
+ * kilometers-per-hour).
|
|
43
|
+ */
|
|
44
|
+ public double getTravelTime(double speed) {
|
|
45
|
+ return getLength() * 3600.0 / (speed * 1000.0);
|
|
46
|
+ }
|
35
|
47
|
|
36
|
48
|
/**
|
37
|
49
|
* @return Minimum time required to travel this arc, in seconds.
|
|
50
|
+ *
|
|
51
|
+ * @see Arc#getTravelTime(double)
|
38
|
52
|
*/
|
39
|
|
- public double getMinimumTravelTime();
|
|
53
|
+ public double getMinimumTravelTime() {
|
|
54
|
+ return getTravelTime(getRoadInformation().getMaximumSpeed());
|
|
55
|
+ }
|
40
|
56
|
|
41
|
57
|
/**
|
42
|
58
|
* @return Road information for this arc.
|
43
|
59
|
*/
|
44
|
|
- public RoadInformation getRoadInformation();
|
|
60
|
+ public abstract RoadInformation getRoadInformation();
|
45
|
61
|
|
46
|
62
|
/**
|
47
|
63
|
* @return Points representing segments of this arc.
|
48
|
64
|
*/
|
49
|
|
- public List<Point> getPoints();
|
|
65
|
+ public abstract List<Point> getPoints();
|
50
|
66
|
}
|