|
|
|
@ -101,9 +101,14 @@ class Node:
@@ -101,9 +101,14 @@ class Node:
|
|
|
|
|
|
|
|
|
|
def __eq__(self, other): |
|
|
|
|
"""Checks equality of node name and kind. Does not check pin connections. |
|
|
|
|
|
|
|
|
|
This is ok, because (name, kind) is unique within a circuit. |
|
|
|
|
""" |
|
|
|
|
return self.name == other.name and self.kind == other.kind |
|
|
|
|
|
|
|
|
|
def __hash__(self): |
|
|
|
|
return hash((self.name, self.kind)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Line: |
|
|
|
|
"""A line is a directional 1:1 connection between two nodes. |
|
|
|
@ -181,6 +186,9 @@ class Line:
@@ -181,6 +186,9 @@ class Line:
|
|
|
|
|
return self.driver == other.driver and self.driver_pin == other.driver_pin and \ |
|
|
|
|
self.reader == other.reader and self.reader_pin == other.reader_pin |
|
|
|
|
|
|
|
|
|
def __hash__(self): |
|
|
|
|
return hash((self.driver, self.driver_pin, self.reader, self.reader_pin)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Circuit: |
|
|
|
|
"""A Circuit is a container for interconnected nodes and lines. |
|
|
|
|