|
@@ -201,20 +201,28 @@ public class Path {
|
201
|
201
|
* @deprecated Need to be implemented.
|
202
|
202
|
*/
|
203
|
203
|
public boolean isValid() {
|
204
|
|
- // TODO:
|
205
|
|
- return false;
|
|
204
|
+ if (!this.isEmpty()) {
|
|
205
|
+ return false;
|
|
206
|
+ }
|
|
207
|
+ if (this.getArcs().size() != 0) {
|
|
208
|
+ return false;
|
|
209
|
+ }
|
|
210
|
+ return true;
|
206
|
211
|
}
|
207
|
212
|
|
208
|
213
|
/**
|
209
|
214
|
* Compute the length of this path (in meters).
|
210
|
215
|
*
|
211
|
|
- * @return Total length of the path (in meters).
|
|
216
|
+ * Total length of the path (in meters).
|
212
|
217
|
*
|
213
|
|
- * @deprecated Need to be implemented.
|
|
218
|
+ * Need to be implemented.
|
214
|
219
|
*/
|
215
|
220
|
public float getLength() {
|
216
|
|
- // TODO:
|
217
|
|
- return 0;
|
|
221
|
+ float totalLength = 0.0f;
|
|
222
|
+ for(Arc arc : this.arcs) {
|
|
223
|
+ totalLength += arc.getLength();
|
|
224
|
+ }
|
|
225
|
+ return totalLength;
|
218
|
226
|
}
|
219
|
227
|
|
220
|
228
|
/**
|
|
@@ -228,8 +236,10 @@ public class Path {
|
228
|
236
|
* @deprecated Need to be implemented.
|
229
|
237
|
*/
|
230
|
238
|
public double getTravelTime(double speed) {
|
231
|
|
- // TODO:
|
232
|
|
- return 0;
|
|
239
|
+ double temps = 0.0;
|
|
240
|
+ float longueur = getLength();
|
|
241
|
+ temps = longueur/(speed*(1000.0/3600.0));
|
|
242
|
+ return temps;
|
233
|
243
|
}
|
234
|
244
|
|
235
|
245
|
/**
|