-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtransition.py
42 lines (29 loc) · 1006 Bytes
/
transition.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# author : Omer Nguena Timo
# version : v0
# use : research only
import random
class Transition :
def __init__(self, src, tgt, input=None, output=None, id=-1) -> None:
self._src = src
self._tgt = tgt
self._input = input
self._output = output
self._id = id
def setID(self, id) :
self._id = id
def getID(self) :
return self._id
def getInput(self) :
return self._input
def getOutput(self) :
return self._output
def __str__(self) -> str:
rst = "\n\t" + f"s_{self._src.getID()} -> s_{self._tgt.getID()} "
rst+= f'[label="{self._input}/{self._output}"]'
return rst
def toDot(self) -> str :
rst = "\n\t" + f"s_{self._src.getID()} -> s_{self._tgt.getID()} "
rst+= f'[label="{self._input}/{self._output}"]'
return rst
def print(self):
print(f'({self._src._label}, {self._input}, {self._output}, {self._tgt._label})')