ADDED getLength()
This commit is contained in:
parent
61e29e6787
commit
41a7ead4b5
1 changed files with 9 additions and 3 deletions
|
@ -35,7 +35,7 @@ public class Path {
|
||||||
public static Path createFastestPathFromNodes(Graph graph, List<Node> nodes)
|
public static Path createFastestPathFromNodes(Graph graph, List<Node> nodes)
|
||||||
throws IllegalArgumentException {
|
throws IllegalArgumentException {
|
||||||
List<Arc> arcs = new ArrayList<Arc>();
|
List<Arc> arcs = new ArrayList<Arc>();
|
||||||
// TODO:
|
//TODO
|
||||||
return new Path(graph, arcs);
|
return new Path(graph, arcs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,8 +213,14 @@ public class Path {
|
||||||
* @deprecated Need to be implemented.
|
* @deprecated Need to be implemented.
|
||||||
*/
|
*/
|
||||||
public float getLength() {
|
public float getLength() {
|
||||||
// TODO:
|
// DONE:
|
||||||
return 0;
|
|
||||||
|
float length = 0;
|
||||||
|
for (Arc arc : this.arcs) {
|
||||||
|
length += arc.getLength();
|
||||||
|
}
|
||||||
|
return length;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue