Beispiel #1
0
 public void RegisterAircraftUnderGuidance(Airplane aircraft)
 {
     if (!this.aircraftUnderGuidance.Contains(aircraft))
     {
         this.aircraftUnderGuidance.Add(aircraft);
     }
 }
Beispiel #2
0
        public void ReceiveAircraftLocation(Airplane reportingAircraft)
        {
            foreach (Airplane currentAircraftUnderGuidance in this.aircraftUnderGuidance.Where(x => x != reportingAircraft))
            {
                if (Math.Abs(currentAircraftUnderGuidance.CurrentAltitude - reportingAircraft.CurrentAltitude) < 1000)
                {
                    Console.WriteLine("Air traffic control changed the altitude of {0}", reportingAircraft.CallSign);
                    reportingAircraft.CurrentAltitude += 1000;

                    // Communicate to the class
                    currentAircraftUnderGuidance.WarnOfAirspaceIntrusionBy(reportingAircraft);
                }
            }
        }
 public void WarnOfAirspaceIntrusionBy(Airplane reportingAircraft)
 {
     Console.WriteLine("Airplane {0} has changed his Altitude to avoid Collision", reportingAircraft.CallSign);
 }