Skip to content
Snippets Groups Projects
Commit f3a04f24 authored by angloth's avatar angloth
Browse files

Add new graph id module

parent 8e231245
No related branches found
No related tags found
1 merge request!2Integrated ID system, traversing and som signal tests
"""
B-ASIC Graph ID module for handling IDs of different objects in a graph.
TODO: More info
"""
class GraphID:
"""
Graph ID class that handles the id of an object in a graph.
"""
graph_id_type: str
graph_id_number: int
def __init__(self, graph_id_type: str, graph_id_number: int):
self.graph_id_type = graph_id_type
self.graph_id_number = graph_id_number
def __str__(self) -> str:
return graph_id_type + str(graph_id_number)
def __repr__(self) -> str:
return str(self)
def __hash__(self) -> int:
return hash(str(self))
def __eq__(self, other: graphID) -> bool:
return self.graph_id_type == other.graph_id_type and \
self.graph_id_number == other.graph_id_number
def get_next_id(self) -> GraphID:
"""
Returns a new GraphID of the same type with an incremented id number.
"""
return GraphID(self.graph_id_type, self.graph_id_number + 1)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment