Browse Source

Length -> Float. Fix issue with duplicated backward arcs.

Holt59 3 years ago
parent
commit
95b68f3e31

+ 1
- 1
src/main/org/insa/graph/Arc.java View File

@@ -31,7 +31,7 @@ public abstract class Arc {
31 31
     /**
32 32
      * @return Length of this arc, in meters.
33 33
      */
34
-    public abstract double getLength();
34
+    public abstract float getLength();
35 35
 
36 36
     /**
37 37
      * Compute the time required to travel this arc if moving at the given speed.

+ 3
- 4
src/main/org/insa/graph/ArcBackward.java View File

@@ -13,7 +13,7 @@ import java.util.List;
13 13
 class ArcBackward extends Arc {
14 14
 
15 15
     // Original arc
16
-    private final ArcForward originalArc;
16
+    private final Arc originalArc;
17 17
 
18 18
     /**
19 19
      * Create a new backward arc which corresponds to the reverse arc of the given
@@ -21,9 +21,8 @@ class ArcBackward extends Arc {
21 21
      * 
22 22
      * @param originalArc Original forwarc arc corresponding to this backward arc.
23 23
      */
24
-    protected ArcBackward(ArcForward originalArc) {
24
+    protected ArcBackward(Arc originalArc) {
25 25
         this.originalArc = originalArc;
26
-        this.originalArc.getDestination().addSuccessor(this);
27 26
     }
28 27
 
29 28
     @Override
@@ -37,7 +36,7 @@ class ArcBackward extends Arc {
37 36
     }
38 37
 
39 38
     @Override
40
-    public double getLength() {
39
+    public float getLength() {
41 40
         return this.originalArc.getLength();
42 41
     }
43 42
 

+ 3
- 4
src/main/org/insa/graph/ArcForward.java View File

@@ -1,6 +1,5 @@
1 1
 package org.insa.graph;
2 2
 
3
-import java.util.ArrayList;
4 3
 import java.util.Collections;
5 4
 import java.util.List;
6 5
 
@@ -21,7 +20,7 @@ class ArcForward extends Arc {
21 20
     private final RoadInformation info;
22 21
 
23 22
     // Segments.
24
-    private final ArrayList<Point> points;
23
+    private final List<Point> points;
25 24
 
26 25
     /**
27 26
      * Create a new ArcForward with the given attributes.
@@ -33,7 +32,7 @@ class ArcForward extends Arc {
33 32
      * @param points Points representing this arc.
34 33
      */
35 34
     protected ArcForward(Node origin, Node dest, float length, RoadInformation roadInformation,
36
-            ArrayList<Point> points) {
35
+            List<Point> points) {
37 36
         this.origin = origin;
38 37
         this.destination = dest;
39 38
         this.length = length;
@@ -52,7 +51,7 @@ class ArcForward extends Arc {
52 51
     }
53 52
 
54 53
     @Override
55
-    public double getLength() {
54
+    public float getLength() {
56 55
         return length;
57 56
     }
58 57
 

Loading…
Cancel
Save