45 lines
900 B
Python
45 lines
900 B
Python
|
"""
|
||
|
Node module
|
||
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||
|
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
||
|
Contributor Milad milad.aghamohamadnia@concordia.ca
|
||
|
"""
|
||
|
import uuid
|
||
|
|
||
|
from city_model_structure.attributes.node import Node
|
||
|
from typing import List
|
||
|
|
||
|
|
||
|
class Edge:
|
||
|
"""
|
||
|
Generic edge class to be used as base for the network edges
|
||
|
"""
|
||
|
def __init__(self, name, nodes=[]):
|
||
|
self._name = name
|
||
|
self._id = None
|
||
|
self._nodes = nodes
|
||
|
|
||
|
@property
|
||
|
def name(self):
|
||
|
"""
|
||
|
Edge name
|
||
|
"""
|
||
|
return self._name
|
||
|
|
||
|
@property
|
||
|
def id(self):
|
||
|
"""
|
||
|
Edge id, an universally unique identifier randomly generated
|
||
|
:return: str
|
||
|
"""
|
||
|
if self._id is None:
|
||
|
self._id = uuid.uuid4()
|
||
|
return self._id
|
||
|
|
||
|
@property
|
||
|
def nodes(self) -> List[Node]:
|
||
|
"""
|
||
|
Delimiting nodes for the edge
|
||
|
"""
|
||
|
return self._nodes
|