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