Sfoglia il codice sorgente

update the configuration code

Sven Czarnian 3 anni fa
parent
commit
9bf0600488
1 ha cambiato i file con 14 aggiunte e 1 eliminazioni
  1. 14 1
      aman/config/AirportSequencing.py

+ 14 - 1
aman/config/AirportSequencing.py

@@ -1,5 +1,10 @@
 #!/usr/bin/env python
 
+from datetime import datetime as dt
+
+import pytz
+import time
+
 from aman.config.RunwaySequencing import RunwaySequencing
 
 class AirportSequencing:
@@ -7,6 +12,7 @@ class AirportSequencing:
         self.Airport = icao
         self.ActiveArrivalRunways = []
         self.RunwayDependencies = []
+        self.LastUpdateTimestamp = dt.utcfromtimestamp(int(time.time())).replace(tzinfo = pytz.UTC)
         self.UseMustShallMay = True
 
     def clearData(self):
@@ -20,6 +26,11 @@ class AirportSequencing:
                 return
         self.ActiveArrivalRunways.append(runway)
 
+    def runway(self, index : int):
+        if index >= len(self.ActiveArrivalRunways):
+            return None
+        return self.ActiveArrivalRunways[index].Runway
+
     def runwayIndex(self, identifier : str):
         for i in range(0, len(self.ActiveArrivalRunways)):
             if self.ActiveArrivalRunways[i].Runway.Name == identifier:
@@ -40,7 +51,7 @@ class AirportSequencing:
         idxFirst = self.runwayIndex(first)
         idxSecond = self.runwayIndex(second)
         if 0 > idxFirst or 0 > idxSecond:
-            return
+            return False
 
         foundFirst = False
         foundSecond = False
@@ -55,6 +66,8 @@ class AirportSequencing:
         if False == foundSecond:
             self.RunwayDependencies.append([ idxSecond, idxFirst ])
 
+        return True
+
     def removeDependency(self, first : str, second : str):
         idxFirst = self.runwayIndex(first)
         idxSecond = self.runwayIndex(second)