Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B-ASIC - Better ASIC Toolbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Computer Engineering
B-ASIC - Better ASIC Toolbox
Commits
f3a04f24
Commit
f3a04f24
authored
5 years ago
by
angloth
Browse files
Options
Downloads
Patches
Plain Diff
Add new graph id module
parent
8e231245
No related branches found
Branches containing commit
No related tags found
1 merge request
!2
Integrated ID system, traversing and som signal tests
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
b_asic/graph_id.py
+41
-0
41 additions, 0 deletions
b_asic/graph_id.py
with
41 additions
and
0 deletions
b_asic/graph_id.py
0 → 100644
+
41
−
0
View file @
f3a04f24
"""
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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment