122 lines
2.2 KiB
Python
122 lines
2.2 KiB
Python
|
"""
|
||
|
Connection module
|
||
|
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 TypeVar
|
||
|
|
||
|
Edge = TypeVar['Edge']
|
||
|
Lane = TypeVar['Lane']
|
||
|
|
||
|
|
||
|
class Connection:
|
||
|
"""
|
||
|
Connection class
|
||
|
"""
|
||
|
|
||
|
def __init__(self):
|
||
|
self._from_edge = None
|
||
|
self._to_edge = None
|
||
|
self._from_lane = None
|
||
|
self._to_lane = None
|
||
|
self._pass = None
|
||
|
self._keep_clear = None
|
||
|
|
||
|
@property
|
||
|
def from_edge(self) -> Edge:
|
||
|
"""
|
||
|
Edge the vehicle leaves
|
||
|
:return: Edge
|
||
|
"""
|
||
|
return self._from_edge
|
||
|
|
||
|
@from_edge.setter
|
||
|
def from_edge(self, value):
|
||
|
"""
|
||
|
Edge the vehicle leaves setter
|
||
|
:param value: Edge
|
||
|
"""
|
||
|
self._from_edge = value
|
||
|
|
||
|
@property
|
||
|
def to_edge(self) -> Edge:
|
||
|
"""
|
||
|
Edge the vehicle reaches
|
||
|
:return: Edge
|
||
|
"""
|
||
|
return self._to_edge
|
||
|
|
||
|
@to_edge.setter
|
||
|
def to_edge(self, value):
|
||
|
"""
|
||
|
Edge the vehicle reaches setter
|
||
|
:param value: Edge
|
||
|
"""
|
||
|
self._to_edge = value
|
||
|
|
||
|
@property
|
||
|
def from_lane(self) -> Lane:
|
||
|
"""
|
||
|
Incoming lane
|
||
|
:return: Lane
|
||
|
"""
|
||
|
return self._to_lane
|
||
|
|
||
|
@from_lane.setter
|
||
|
def from_lane(self, value):
|
||
|
"""
|
||
|
Incoming lane setter
|
||
|
:param value: Lane
|
||
|
"""
|
||
|
self._from_lane = value
|
||
|
|
||
|
@property
|
||
|
def to_lane(self) -> Lane:
|
||
|
"""
|
||
|
Outgoing lane
|
||
|
:return: Lane
|
||
|
"""
|
||
|
return self._to_lane
|
||
|
|
||
|
@to_lane.setter
|
||
|
def to_lane(self, value):
|
||
|
"""
|
||
|
Outgoing lane setter
|
||
|
:param value: Lane
|
||
|
"""
|
||
|
self._to_lane = value
|
||
|
|
||
|
@property
|
||
|
def pass_not_wait(self):
|
||
|
"""
|
||
|
if set, vehicles which pass this (lane-2-lane) connection will not wait
|
||
|
:return: bool
|
||
|
"""
|
||
|
return self._pass
|
||
|
|
||
|
@pass_not_wait.setter
|
||
|
def pass_not_wait(self, value):
|
||
|
"""
|
||
|
pass_not_wait setter
|
||
|
:param value: bool
|
||
|
"""
|
||
|
self._pass = value
|
||
|
|
||
|
@property
|
||
|
def keep_clear(self):
|
||
|
"""
|
||
|
if set to false, vehicles which pass this (lane-2-lane) connection will not worry about blocking the intersection
|
||
|
:return: bool
|
||
|
"""
|
||
|
return self._keep_clear
|
||
|
|
||
|
@keep_clear.setter
|
||
|
def keep_clear(self, value):
|
||
|
"""
|
||
|
keep_clear setter
|
||
|
:param value: bool
|
||
|
"""
|
||
|
self._keep_clear = value
|