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

Remove setter for signals source and destination since they shouldn't be modified.

parent aec6d3e0
No related branches found
No related tags found
1 merge request!9Resolve #1 "Port Interface", #8 "Port Coupling"
......@@ -99,6 +99,9 @@ class InputPort(Port):
return 0 if self._signal is None else 1
def connect(self, port: "OutputPort") -> sig.Signal:
# Remove previously connected signal if there is one
if self._signal is not None:
self.disconnect()
self._signal = sig.Signal(port, self)
return self._signal
......
......@@ -32,42 +32,20 @@ class Signal(AbstractGraphComponent):
"""Returns the destination InputPort of the signal."""
return self._destination
@source.setter
def source(self, src: OutputPort) -> None:
"""Sets the value of the source OutputPort of the signal.
Note: Does not connect the src OutputPort to the signal.
Keyword arguments:
- src: OutPort to connect as source to the signal.
"""
self._source = src
@destination.setter
def destination(self, dest: InputPort) -> None:
"""Sets the value of the destination InputPort of the signal.
Note: Does not connect the destination InputPort to the signal.
Keywords argments:
- dest: InputPort to connect as destination to the signal.
"""
self._destination = dest
@property
def type_name(self) -> TypeName:
return "s"
def disconnect_source(self) -> None:
"""Disconnects the source OutputPort of the signal.
Note: Does not disconnect the source OutputPort from the signal.
"""
self._source = None
def disconnect_destination(self) -> None:
"""Disconnects the destination InputPort of the signal.
Note: Does not disconnect the destination OutputPort from the signal.
"""
self._destination = None
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