Changeset View
Changeset View
Standalone View
Standalone View
src/it/reyboz/bustorino/backend/Palina.java
Show First 20 Lines • Show All 345 Lines • ▼ Show 20 Lines | |||||
// * Exactly what it says on the tin. | // * Exactly what it says on the tin. | ||||
// * | // * | ||||
// * @return times from the timetable | // * @return times from the timetable | ||||
// */ | // */ | ||||
// public List<Passaggio> getPassaggi() { | // public List<Passaggio> getPassaggi() { | ||||
// return this.passaggi; | // return this.passaggi; | ||||
// } | // } | ||||
// } | // } | ||||
//remove duplicates | |||||
public void mergeDuplicateRoutes(int startidx){ | |||||
//ArrayList<Route> routesCopy = new ArrayList<>(routes); | |||||
//for | |||||
if(routes.size()<=1|| startidx >= routes.size()) //we have finished | |||||
return; | |||||
Route routeCheck = routes.get(startidx); | |||||
boolean found = false; | |||||
for(int i=startidx+1; i<routes.size(); i++){ | |||||
final Route r = routes.get(i); | |||||
if(routeCheck.equals(r)){ | |||||
//we have found a match, merge | |||||
routes.remove(routeCheck); | |||||
r.mergeRouteWithAnother(routeCheck); | |||||
found=true; | |||||
break; | |||||
} | |||||
} | |||||
if (found) mergeDuplicateRoutes(startidx); | |||||
else mergeDuplicateRoutes(startidx+1); | |||||
} | |||||
//private void mergeRoute | |||||
} | } | ||||
No newline at end of file | No newline at end of file |
Public contents are in Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) or GNU Free Documentation License (at your option) unless otherwise noted. · Contact / Register