public AirportController(IAirport airport) { tripRegistrationNumber = 1; this.airport = airport; this.airplaneFactory = new AirplaneFactory(); this.itemFactory = new ItemFactory(); }
// Returns null if the runway or the opposite runway cannot be found. public static double?GetSlopePercent(this IAirport a, string runway) { var rwy = a.FindRwy(runway); if (rwy == null) { return(null); } var oppositeId = RwyIdentConversion.RwyIdentOppositeDir(runway); if (oppositeId == null) { return(null); } var opposite = a.FindRwy(oppositeId); if (opposite == null) { return(null); } return((opposite.ElevationFt - rwy.ElevationFt) * 100.0 / rwy.LengthFt); }
public FlightController(IFlight flightService, IAirport airportService, IAirPlane airPlaneService, IFlightHelpersServices flightHelpersServices) { _airportService = airportService; _airPlaneService = airPlaneService; _flightService = flightService; _flightHelpersServices = flightHelpersServices; }
public AirportController(IAirport airport) { this.airport = airport; this.airplaneFactory = new AirplaneFactory(); this.itemFactory = new ItemFactory(); }
public void AddWaypoint(IAirport airport) { var wps = this.Waypoints.ToList(); wps.Add(airport); this.Waypoints = wps; }
public static double Distance(IAirport a1, IAirport a2) { double x = a1.GetCoordinates().X - a2.GetCoordinates().X; double y = a1.GetCoordinates().Y - a2.GetCoordinates().Y; double distance = Math.Sqrt(x * x + y * y); return(distance); }
public AirportController(IAirport airport) { this.airport = airport; this.airplaneFactory = new AirplaneFactory(); this.itemFactory = new ItemFactory(); this.passengerFactory = new PassengerFactory(); this.tripFactory = new TripFactory(); }
public void Setup() { airport = new Airport(); airplane = new LightAirplane(); fController = new FlightController(airport); trip = new Trip("Sofia", "Vidin", airplane); airport.AddTrip(trip); }
public AirportStatus ConvertAirport(IAirport airport) { IEnumerable <Station> stations = airport.GetStations(); string name = airport.Name; string url = airport.ImageUrl; List <Route> routes = airport.Routes; return(new AirportStatus(stations, name, url, routes)); }
private List <ITicket> SoldTickets; // prodate karte,kad im dodelimo kupca /***************************************/ //Constructor: public Flight(int id, IAirport src, IAirport dst, IPlane plane, double PricePerUnit_) { Unique_ID = id; SrcAirport = src; DestAirport = dst; Plane = plane; PricePerUnit = PricePerUnit_; NewTickets = new List <ITicket>(); SoldTickets = new List <ITicket>(); }
private static void AssertVhhh(IAirport vhhh) { Assert.IsTrue("VHHH" == vhhh.Icao); Assert.IsTrue("Chek Lap Kok International Airport" == vhhh.Name); Assert.AreEqual(22.3089008331, vhhh.Lat, delta); Assert.AreEqual(113.915000916, vhhh.Lon, delta); Assert.AreEqual(28, vhhh.Elevation); Assert.AreEqual(false, vhhh.TransAvail); Assert.AreEqual(12467, vhhh.LongestRwyLengthFt); }
/// <summary>This method will create all airports, cargo, and the relationships there of. It will set the starting airport</summary> private void Setup() { //NOTE Create Airports Airport boi = new Airport("boi", "Boise Airport"); Airport pdx = new Airport("pdx", "Portland Airport"); Airport ord = new Airport("ord", "Chicago O'Hare Airport"); Airport den = new Airport("den", "Denver Airport"); Airport oak = new Airport("oak", "Oakland Airport"); Airport yyz = new Airport("yyz", "Toronto Airport"); Airport hnl = new Airport("hnl", "Honolulu Airport"); //NOTE Create relationships between boi.AddConnection(pdx); pdx.AddConnection(boi); boi.AddConnection(den); den.AddConnection(boi); pdx.AddConnection(den); den.AddConnection(pdx); pdx.AddConnection(oak); oak.AddConnection(pdx); pdx.AddConnection(hnl); hnl.AddConnection(pdx); ord.AddConnection(yyz); yyz.AddConnection(ord); ord.AddConnection(den); den.AddConnection(ord); //NOTE Create Packages Package p1 = new Package(boi, 100); Package p2 = new Package(pdx, 125); Package p3 = new Package(ord, 250); Package p4 = new Package(den, 50); Package p5 = new Package(oak, 300); Package p6 = new Package(yyz, 310); Package p7 = new Package(hnl, 5); //NOTE Add pacakges to Airports hnl.Pickups.Add(p1); yyz.Pickups.Add(p2); oak.Pickups.Add(p3); oak.Pickups.Add(p4); ord.Pickups.Add(p5); pdx.Pickups.Add(p6); boi.Pickups.Add(p7); //NOTE Set your starting point, this creates access to the web of connections that was made CurrentAirport = boi; }
public static bool Connected(IAirport a1, IAirport a2) { bool connected = false; foreach (IAirport airport in a1.GetAirports()) { if (airport == a2) { connected = true; break; } } return(connected); }
public List <IFlight> FindByDestAirport(IAirport dest) { List <IFlight> flights_to_return = new List <IFlight>(); foreach (Flight flight in Flights) { if (flight.GetDestAirport() == dest) { flights_to_return.Add(flight); } } return(flights_to_return); }
public List <IFlight> FindBySrcAirport(IAirport src) { List <IFlight> flights_to_return = new List <IFlight>(); foreach (Flight flight in Flights) { if (flight.GetSrcAirport() == src) { flights_to_return.Add(flight); } } return(flights_to_return); }
public static bool Equals(IAirport x, IAirport y) { return(x != null && y != null && x.Icao == y.Icao && x.Name == y.Name && x.Lat == y.Lat && x.Lon == y.Lon && x.Elevation == y.Elevation && x.TransAvail == y.TransAvail && x.TransAlt == y.TransAlt && x.TransLvl == y.TransLvl && x.LongestRwyLengthFt == y.LongestRwyLengthFt && x.Rwys.SetEquals(y.Rwys)); }
private static void AssertVhhhRwys(IAirport vhhh) { var rwys = vhhh.Rwys; var _7L = rwys.Where(r => r.RwyIdent == "07L").First(); Assert.IsTrue(_7L.Heading == "74"); Assert.AreEqual(12467, _7L.LengthFt); Assert.AreEqual(197, _7L.WidthFt); Assert.AreEqual(false, _7L.HasIlsInfo); Assert.AreEqual(22.3104, _7L.Lat, delta); Assert.AreEqual(113.896, _7L.Lon, delta); Assert.AreEqual(22, _7L.ElevationFt); Assert.IsTrue("ASP" == _7L.SurfaceType); var _7R = rwys.Where(r => r.RwyIdent == "07R").First(); Assert.IsTrue(_7R.Heading == "74"); Assert.AreEqual(12467, _7R.LengthFt); Assert.AreEqual(197, _7R.WidthFt); Assert.AreEqual(false, _7R.HasIlsInfo); Assert.AreEqual(22.2962, _7R.Lat, delta); Assert.AreEqual(113.898, _7R.Lon, delta); Assert.AreEqual(28, _7R.ElevationFt); Assert.IsTrue("ASP" == _7R.SurfaceType); var _25R = rwys.Where(r => r.RwyIdent == "25R").First(); Assert.IsTrue(_25R.Heading == "254"); Assert.AreEqual(12467, _25R.LengthFt); Assert.AreEqual(197, _25R.WidthFt); Assert.AreEqual(false, _25R.HasIlsInfo); Assert.AreEqual(22.3216, _25R.Lat, delta); Assert.AreEqual(113.931, _25R.Lon, delta); Assert.AreEqual(23, _25R.ElevationFt); Assert.IsTrue("ASP" == _25R.SurfaceType); var _25L = rwys.Where(r => r.RwyIdent == "25L").First(); Assert.IsTrue(_25L.Heading == "254"); Assert.AreEqual(12467, _25L.LengthFt); Assert.AreEqual(197, _25L.WidthFt); Assert.AreEqual(false, _25L.HasIlsInfo); Assert.AreEqual(22.3074, _25L.Lat, delta); Assert.AreEqual(113.933, _25L.Lon, delta); Assert.AreEqual(27, _25L.ElevationFt); Assert.IsTrue("ASP" == _25L.SurfaceType); }
public static IAirport ToAirport(this IAirport airport) { return(new Airport { Iata = airport.Iata, Icao = airport.Icao, Elevation = airport.Elevation, Latitude = airport.Latitude, Longitude = airport.Longitude, Name = airport.Name, City = airport.City, State = airport.State, Country = airport.Country, Timezone = airport.Timezone, }); }
public List <IFlight> GetFlightsTo(IAirport dest) { //AllFlights sadrzi sve letove u bazi podataka, //i ispitujemo svaki let da li ima IAirport dest kao svoj odredisni aerodrom IFlightDatabase database = FlightDatabase.Instance; List <IFlight> AllFlights = database.GetFlightsList(); List <IFlight> FlightsToDest = new List <IFlight>(); foreach (IFlight flight in AllFlights) { if ((flight.GetSrcAirport() == this) && (flight.GetDestAirport() == dest)) { FlightsToDest.Add(flight); } } return(FlightsToDest); }
public Presenter(IView view) { _view = view; _airport = AirportDB.Create(); _view.DisplayFlightEventRaise += OnDisplayFlightEventRaise; _view.SearchFlightByNumberEventRaise += OnSearchFlightByNumberEventRaise; _view.SearchFlightByDateTimeEventRaise += OnSearchFlightByDateTimeEventRaise; _view.SearchFlightByCityEventRaise += OnSearchFlightByCityEventRaise; _view.SearchFlightEventRaise += OnSearchFlightEventRaise; _view.DeleteFlightEventRaise += OnDeleteFlightEventRaise; _view.AddFlightEventRaise += OnAddFlightEventRaise; _view.EditFlightEventRaise += OnEditFlightEventRaise; _view.ReturnEditedFlightEventRaise += OnReturnEditedFlightEventRaise; _view.EditePassengerEventRaise += OnEditePassengerEventRaise; _view.AddPassangerEventRaise += OnAddPassangerEventRaise; _view.SearchPassengerByFlightEventRaise += OnSearchPassengerEventRaise; _view.SearchPassengerByNameEventRaise += OnSearchPassengerByNameEventRaise; _view.SearchPassengerByPassportEventRaise += OnSearchPassengerByPassportEventRaise; _view.DeletePassengerEventRaise += OnDeletePassengerEventRaise; }
public virtual void AssignPlaneMakers() { IAirport benGurion = this.airportManager.GetAirport("Ben Gurion"); benGurion.ChangeInState += RaiseChangeInStateEvent; IAirport ovda = this.airportManager.GetAirport("Ovda"); ovda.ChangeInState += RaiseChangeInStateEvent; IdManager.Id = dalService.GetIdCount(); IPlaneMaker planeMaker = new PlaneMaker(benGurion); planeMaker.ConfigureTimer(TimeSpan.FromSeconds(15)); planeMaker.StartTimer(); IPlaneMaker ovdaPlaneMaker = new OvdaPlaneMaker(ovda, ovda.Routes.ToArray()); ovdaPlaneMaker.ConfigureTimer(TimeSpan.FromSeconds(25)); ovdaPlaneMaker.StartTimer(); }
public void InsertFlight(IFlight f) { if (f == null) { return; } //Ako izvorisni i odredisni aerodromi leta nisu povezani baca se izuzetak if (!IAirport.Connected(f.GetDestAirport(), f.GetSrcAirport())) { throw new AirportsNotConnectedException("Aerodromi nisu povezani"); } //proveravamo da li u listi letova postoji vec let sa istim identifikacionim brojem foreach (IFlight flight in Flights) { if (flight.GetUnique_ID() == f.GetUnique_ID()) { throw new IdConflictException("Vec postoji let sa zadatim identifikacionim brojem"); } } Flights.Add(f); }
public Package(IAirport destination, int reward) { Destination = destination; Reward = reward; }
public FlightController(IAirport airport) { this.airport = airport; this.randomGenerator = new Random(EjectionSeed); }
public AirportController(IAirport airportService) { _airportService = airportService; }
public FlightController(IAirport airport) { this.airport = airport; this.randomGenerator = new Random(EJECTION_SEED); }
public IFlight CreateFlight(int id, IAirport src, IAirport dst, IPlane plane, double pricePerUnit) { IFlight f = new Flight(id, src, dst, plane, pricePerUnit); return(f); }
public void AddWaypoint(IAirport airport) { var wps = this.Waypoints.ToList(); wps.Add(airport); this.Waypoints = wps; }
public static void Connect(IAirport a1, IAirport a2) //povezujemo dva aerodroma tako sto ih dodamo medjusobno { //u listu njihovih povezanih aerodroma a1.GetAirports().Add(a2); a2.GetAirports().Add(a1); }
public AirportController(IAirport airport, IAirplaneFactory airplaneFactory, IItemFactory itemFactory) { this.airport = airport; this.airplaneFactory = airplaneFactory; this.itemFactory = itemFactory; }
public void AddAirport(IAirport airport) { this.airports.Add(airport); }