Compare commits
2 commits
3bba019763
...
52df139bd8
| Author | SHA1 | Date | |
|---|---|---|---|
| 52df139bd8 | |||
| b070983a49 |
2 changed files with 27 additions and 14 deletions
|
|
@ -201,8 +201,15 @@ public class Path {
|
||||||
* @deprecated Need to be implemented.
|
* @deprecated Need to be implemented.
|
||||||
*/
|
*/
|
||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
// TODO:
|
boolean valid = isEmpty() || (this.arcs.size() == 0 && this.origin != null);
|
||||||
return false;
|
if (!valid) {
|
||||||
|
valid = this.arcs.get(0).getOrigin().equals(this.origin);
|
||||||
|
for (int i = 1; i < 3; i++) {
|
||||||
|
if (this.arcs.size() > i)
|
||||||
|
valid = valid && (this.arcs.get(i).getOrigin().equals(this.arcs.get(i-1).getDestination()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -210,11 +217,13 @@ public class Path {
|
||||||
*
|
*
|
||||||
* @return Total length of the path (in meters).
|
* @return Total length of the path (in meters).
|
||||||
*
|
*
|
||||||
* @deprecated Need to be implemented.
|
|
||||||
*/
|
*/
|
||||||
public float getLength() {
|
public float getLength() {
|
||||||
// TODO:
|
float length = 0;
|
||||||
return 0;
|
for (Arc a : this.arcs) {
|
||||||
|
length += a.getLength();
|
||||||
|
}
|
||||||
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -225,11 +234,13 @@ public class Path {
|
||||||
* @return Time (in seconds) required to travel this path at the given speed (in
|
* @return Time (in seconds) required to travel this path at the given speed (in
|
||||||
* kilometers-per-hour).
|
* kilometers-per-hour).
|
||||||
*
|
*
|
||||||
* @deprecated Need to be implemented.
|
|
||||||
*/
|
*/
|
||||||
public double getTravelTime(double speed) {
|
public double getTravelTime(double speed) {
|
||||||
// TODO:
|
float time = 0;
|
||||||
return 0;
|
for (Arc a : this.arcs) {
|
||||||
|
time += a.getTravelTime(speed);
|
||||||
|
}
|
||||||
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -238,11 +249,13 @@ public class Path {
|
||||||
*
|
*
|
||||||
* @return Minimum travel time to travel this path (in seconds).
|
* @return Minimum travel time to travel this path (in seconds).
|
||||||
*
|
*
|
||||||
* @deprecated Need to be implemented.
|
|
||||||
*/
|
*/
|
||||||
public double getMinimumTravelTime() {
|
public double getMinimumTravelTime() {
|
||||||
// TODO:
|
float time = 0;
|
||||||
return 0;
|
for (Arc a : this.arcs) {
|
||||||
|
time += a.getMinimumTravelTime();
|
||||||
|
}
|
||||||
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
BIN
uml.dia
BIN
uml.dia
Binary file not shown.
Loading…
Reference in a new issue