# -*- coding: utf-8 -*-
# @Time : 2023/8/4 16:18
# @Author : Ultipa
# @Email : [email protected]
# @File : Node.py
from typing import Dict, List
from ultipa.structs.BaseModel import BaseModel
[docs]
class Node(BaseModel):
'''
Data calss for node.
'''
_index = None
def __init__(self, values: Dict, schema: str = None, id: str = None, uuid: int = None, **kwargs):
self.id = id
if schema is None:
if kwargs.get("schema_name") is not None:
self.schema = kwargs.get("schema_name")
else:
self.schema = None
else:
self.schema = schema
self.values = values
self.uuid = uuid
[docs]
def getID(self):
return self.id
[docs]
def getUUID(self):
return self.uuid
[docs]
def getValues(self):
return self.values
[docs]
def getSchema(self):
return self.schema
[docs]
def get(self, propertyName: str):
return self.values.get(propertyName)
[docs]
def set(self, propertyName: str, value):
self.values.update({propertyName: value})
def _getIndex(self):
return self._index
[docs]
class NodeAlias:
def __init__(self, alias: str, nodes: List[Node] = None):
self.alias = alias
if nodes is None:
nodes = []
self.nodes = nodes