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

This commit is contained in:
Holt59 2018-03-12 20:43:32 +01:00
parent ec7d18b1b2
commit 95b68f3e31
3 changed files with 7 additions and 9 deletions

View File

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

View File

@ -13,7 +13,7 @@ import java.util.List;
class ArcBackward extends Arc {
// Original arc
private final ArcForward originalArc;
private final Arc originalArc;
/**
* Create a new backward arc which corresponds to the reverse arc of the given
@ -21,9 +21,8 @@ class ArcBackward extends Arc {
*
* @param originalArc Original forwarc arc corresponding to this backward arc.
*/
protected ArcBackward(ArcForward originalArc) {
protected ArcBackward(Arc originalArc) {
this.originalArc = originalArc;
this.originalArc.getDestination().addSuccessor(this);
}
@Override
@ -37,7 +36,7 @@ class ArcBackward extends Arc {
}
@Override
public double getLength() {
public float getLength() {
return this.originalArc.getLength();
}

View File

@ -1,6 +1,5 @@
package org.insa.graph;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@ -21,7 +20,7 @@ class ArcForward extends Arc {
private final RoadInformation info;
// Segments.
private final ArrayList<Point> points;
private final List<Point> points;
/**
* Create a new ArcForward with the given attributes.
@ -33,7 +32,7 @@ class ArcForward extends Arc {
* @param points Points representing this arc.
*/
protected ArcForward(Node origin, Node dest, float length, RoadInformation roadInformation,
ArrayList<Point> points) {
List<Point> points) {
this.origin = origin;
this.destination = dest;
this.length = length;
@ -52,7 +51,7 @@ class ArcForward extends Arc {
}
@Override
public double getLength() {
public float getLength() {
return length;
}