public Boolean routeInContainsLocation(Location location) { foreach (Location loc in routeIn) { if (loc.getName().Equals(location.getName())) { return true; } } return false; }
//Add the data into the data structures public static Route processInput(String temp, Route route) { Location location = null; String[] tempLocations = temp.Split(','); //fill the dictionarires for routes and locations foreach (String s in tempLocations) { if (!locations.ContainsKey(s)) { location = new Location(s); route.addLocationToRouteIn(location); locations.Add(s, location); } else { Location value; if (locations.TryGetValue(s, out value)) { route.addLocationToRouteIn(locations[s]); } } } return route; }
public void addLocationToRouteOut(Location location) { routeOut.AddLast(location); location.addRoute(this); }