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

這個提交存在於:
Holt59 2018-03-12 20:43:32 +01:00
父節點 ec7d18b1b2
當前提交 95b68f3e31
共有 3 個檔案被更改,包括 7 行新增9 行删除

查看文件

@ -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.

查看文件

@ -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();
}

查看文件

@ -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;
}