ArrivalData.py 1.0 KB

123456789101112131415161718192021222324252627282930
  1. #!/usr/bin/env python
  2. from datetime import datetime, timedelta
  3. from aman.types.ArrivalRoute import ArrivalRoute
  4. class ArrivalData:
  5. def __init__(self, **kargs):
  6. self.Star = None
  7. self.InitialArrivalTime = None
  8. self.ArrivalRoute = None
  9. self.Trackmiles = None
  10. for key, value in kargs.items():
  11. if 'star' == key:
  12. if True == isinstance(value, ArrivalRoute):
  13. self.Star = value
  14. else:
  15. raise Exception('Invalid type for star')
  16. elif 'ita' == key:
  17. if True == isinstance(value, datetime):
  18. self.InitialArrivalTime = value
  19. else:
  20. raise Exception('Invalid type for ita')
  21. elif 'route' == key:
  22. self.ArrivalRoute = value
  23. elif 'trackmiles' == key:
  24. self.Trackmiles = value
  25. else:
  26. raise Exception('Unknown key: ' + key)