public Route(string id, float durationInDays, Location one, Location two, Moveable move) { locations = new Location[] { one, two }; Id = id; DurationInDays = durationInDays; CurrentMoveable = move; }
public bool setHome(Location loc) { if (Homeless && !(loc is Abroad)) { home = loc; return true; } return false; }
public void clearHome() { home = null; }
public void changeLocation() { currentLocation = (route.Locations[0] == currentLocation) ? route.Locations[1] : route.Locations[0]; }
private float[,] weightedAdjacency(Location[] locations, Route[] routes) { float[,] temp = new float[locations.Length, locations.Length]; for (int i = 0; i < locations.Length; ++i) for (int j = 0; j < locations.Length; ++j) temp[i, j] = float.PositiveInfinity; for (int i = 0; i < locations.Length - 1; ++i) for (int j = i + 1; j < locations.Length; ++j) for (int m = 0; m < routes.Length; ++m) if ((routes[m].Locations[0].Equals(locations[i]) && routes[m].Locations[1].Equals(locations[j])) || (routes[m].Locations[1].Equals(locations[i]) && routes[m].Locations[0].Equals(locations[j]))) temp[j, i] = temp[i, j] = routes[m].DurationInDays; return temp; }
private int determineGroundTravelTime(Location startLocation, Location endLocation) { int start = locations.IndexOf(startLocation); int end = locations.IndexOf(endLocation); return (int)(groundWeightedPathMatrix[start, end] + 0.5); }
public bool movePackageToMoveable(Location location, Moveable moveable, Package package) { if (!moveable.addPackage(package)) return false; StoreFront sf = location as StoreFront; if (sf == null) { (location as Warehouse).removePackage(package); } else { sf.removePackage(package); } package.takeSnapshot("Left from", location); return true; }
public int indexOf(Location location) { return locations.IndexOf(location); }
public bool addWarehouseEmployee(string firstName, string middleName, string lastName, string id, string plainTextPassword, Location l) { WarehouseEmployee a = new WarehouseEmployee(firstName, middleName, lastName, id, plainTextPassword); a.CurrentLocation = l; return addEmployee(a); }
public bool addRoute(String id, float duration, Location one, Location two, Moveable move) { Route r = new Route(id, duration, one, two, move); if (routes.Contains(r)) return false; move.assignRoute(r); routes.Add(r); move.changeLocation(); foreach (Location rLocation in r.Locations) { if (rLocation is StoreFront) (rLocation as StoreFront).addRoute(r); else if (rLocation is Warehouse) (rLocation as Warehouse).addRoute(r); } return true; }
public bool containsLocation(Location location) { return Locations[0].Equals(location) || Locations[1].Equals(location); }
public Snapshot(string message, Location location) { this.message = message; this.location = location; date = DateTime.Now; }
private void locationEditButton_Click(object sender, EventArgs e) { locationTypeComboBox.Enabled = false; locationAddButton.Text = SAVE; addLocation = false; currentLocation = locationsListBox.SelectedItem as Location; locationsListBox.ClearSelected(); locationIdTextBox.Text = currentLocation.Id; locationStreetAddressTextBox.Enabled = locationZipCodetextBox.Enabled = !(currentLocation is Abroad); if (locationStreetAddressTextBox.Enabled) { locationStreetAddressTextBox.Text = currentLocation.StreetAddress; locationZipCodetextBox.Text = currentLocation.Zipcode; if (currentLocation is Warehouse) { locationVolumeCapacityTextBox.Enabled = true; locationVolumeCapacityTextBox.Text = (currentLocation as Warehouse).VolumeCapacity+""; } } else//We have an abroad { locationZipcodesServedTextBox.Enabled = true; locationZipcodesServedTextBox.Text = (currentLocation as Abroad).ZipcodesString; } }
public Route(Location[] locations, float durationInDays) { this.locations = locations; DurationInDays = durationInDays; }