hub/city_model_structure/transport/traffic_light_logic.py

106 lines
1.9 KiB
Python
Raw Normal View History

"""
Traffic light Logic module
These network elements are used to connect multiple side walks and pedestrian crossings
(typically one in each corner of an intersection).
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
Contributor Milad milad.aghamohamadnia@concordia.ca
"""
from typing import List, TypeVar
Phase = TypeVar['Phase']
class TrafficLightLogic:
"""
TrafficLightLogic class
"""
def __init__(self):
self._id = None
self._type = None
self._program_id = None
self._offset = None
self._phases = None
@property
def id(self):
"""
Traffic light's id
:return: str
"""
return self._id
@id.setter
def id(self, value):
"""
Traffic light's id setter
:param value: str
"""
self._id = value
@property
def type(self):
"""
enum (static, actuated, delay_based)
:return:
"""
return self._type
@type.setter
def type(self, value):
"""
Type setter
:param value:
"""
self._type = value
@property
def program_id(self):
"""
Traffic light program's id
:return: str
"""
return self._program_id
@program_id.setter
def program_id(self, value):
"""
Traffic light program's id setter
:param value: str
"""
self._program_id = value
@property
def offset(self):
"""
The initial time offset of the program
:return: int
"""
return self._offset
@offset.setter
def offset(self, value):
"""
The initial time offset of the program setter
:param value: int
"""
self._offset = value
@property
def phases(self) -> List[Phase]:
"""
Phases of the traffic light logic
:return: [Phase]
"""
return self._phases
@phases.setter
def phases(self, value):
"""
Phases setter
:param value: [Phase]
"""
self._phases = value