/// <summary> /// Removes an EV from the list with the matching ID /// </summary> /// <param name="targetID"> ID to delete from list</param> public void removeEV(int targetID) { foreach (EmergencyVehicle o in EVList) { if (o.getID() == targetID) { EVList.Remove(o); removeID(targetID); break; } } }
/// <summary> /// Adds an Emergency Vehicle into the List /// </summary> /// <param name="newCar">Emergency Vehicle to be added</param> public void registerEV(EmergencyVehicle newCar) { //generates a newID until there is one that isn't one the list. int newID; if (size + 1 < ID_MAX) { do { newID = generateID(); } while (registerID(newID) == false); newCar.setID(newID); EVList.Add(newCar); } else { System.Diagnostics.Debug.WriteLine("EVLIST is full"); } }