Browse Source

Changes to be committed:

	modified:   be-graphes-model/src/main/java/org/insa/graphs/model/Path.java
Jdihadi Ahamdy 3 years ago
parent
commit
3651cfadd2
1 changed files with 23 additions and 9 deletions
  1. 23
    9
      be-graphes-model/src/main/java/org/insa/graphs/model/Path.java

+ 23
- 9
be-graphes-model/src/main/java/org/insa/graphs/model/Path.java View File

@@ -201,15 +201,26 @@ public class Path {
201 201
      * @deprecated Need to be implemented.
202 202
      */
203 203
     public boolean isValid() {
204
-    	   if (!this.isEmpty()) {
205
-               return false;
204
+    	   if (this.isEmpty()) {
205
+               return true;
206 206
            }
207
-           if (this.getArcs().size() != 0) {
208
-               return false;
207
+    	   else if (this.size() == 1) {
208
+               return true;
209 209
            }
210
-           return true;
211
-    }
212
-
210
+	       else {
211
+	    	   Node origine = this.getOrigin();
212
+	    	   for (Arc arc : this.arcs) {
213
+	    		   if (!origine.equals(arc.getOrigin())) {
214
+	    			   return false;
215
+	    		   }
216
+	    		   origine = arc.getDestination();
217
+	    	   } 			
218
+	    	}
219
+    	   
220
+    	   return true;
221
+           }
222
+	       
223
+ 
213 224
     /**
214 225
      * Compute the length of this path (in meters).
215 226
      * 
@@ -251,8 +262,11 @@ public class Path {
251 262
      * @deprecated Need to be implemented.
252 263
      */
253 264
     public double getMinimumTravelTime() {
254
-        // TODO:
255
-        return 0;
265
+        double temps = 0;
266
+        for(Arc myArc : this.arcs) {
267
+        	temps+= myArc.getMinimumTravelTime();
268
+        }
269
+        return temps;
256 270
     }
257 271
 
258 272
 }

Loading…
Cancel
Save