Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 95b3642

Browse files
committed
Automata v.1.2.1
[Set] and [List] data type compatibility error corrected; It still allows to enter to automata attributes as sets data type, to respect the mathematical notation, but it internally manage it as list data type, with no apparent compatibility errors for the moment :3
1 parent 0ff60b6 commit 95b3642

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

‎dfa.py‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
class DFA:
66

77
#/ Attributes #
8-
States: set = {}
9-
Alphabet: set = {}
8+
States: list = []
9+
Alphabet: list = []
1010
Transitions: list = []
1111
Initial: str = ""
12-
Finals: set = {}
12+
Finals: list = []
1313

1414
#/ Variables #
1515
actual: str = ""
@@ -61,11 +61,11 @@ def __init__(self, states: set={}, alphabet: set={}, transitions: list=[], initi
6161
'''
6262

6363
# The values of the automata #
64-
self.States = states
65-
self.Alphabet = alphabet
66-
self.Transitions = transitions
64+
self.States = list(states)
65+
self.Alphabet = list(alphabet)
66+
self.Transitions = list(transitions)
6767
self.Initial = initial
68-
self.Finals = finals
68+
self.Finals = list(finals)
6969
self.actual = initial
7070

7171
#* Getter:
@@ -77,13 +77,13 @@ def __getattribute__(self, __name: str):
7777
def addState(self, state: str):
7878
self.States.append(state)
7979
def setStates(self, states: set):
80-
self.States = states
80+
self.States = list(states)
8181

8282
#/ For Automata Alphabet:
8383
def addSymbol(self, symbol: str):
8484
self.Alphabet.append(symbol)
8585
def setAlphabet(self, alphabet: set):
86-
self.Alphabet = alphabet
86+
self.Alphabet = list(alphabet)
8787

8888
#/ For Automata Transitions:
8989
def addTransition(self, transition: tuple):
@@ -102,7 +102,7 @@ def setInitial(self, initial: str):
102102
def addFinal(self, final: str):
103103
self.Finals.append(final)
104104
def setFinals(self, finals: set):
105-
self.Finals = finals
105+
self.Finals = list(finals)
106106

107107

108108
#? Methods:

‎nfa.py‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
class NFA:
66

77
#/ Attributes #
8-
States: set = {}
9-
Alphabet: set = {}
8+
States: list = []
9+
Alphabet: list = []
1010
Transitions: list = []
1111
Initial: str = ""
12-
Finals: set = {}
12+
Finals: list = []
1313

1414
#/ Variables #
1515
currents: list = []
@@ -65,12 +65,12 @@ def __init__(self, states: set={}, alphabet: set={}, transitions: list=[], initi
6565
'''
6666

6767
# The values of the automata #
68-
self.States = states
69-
self.Alphabet = alphabet
70-
self.Transitions = transitions
68+
self.States = list(states)
69+
self.Alphabet = list(alphabet)
70+
self.Transitions = list(transitions)
7171
self.Initial = initial
72-
self.Finals = finals
73-
self.currents = [initial]
72+
self.Finals = list(finals)
73+
self.currents = list([initial])
7474

7575
#* Getter:
7676
def __getattribute__(self, __name: str):
@@ -81,13 +81,13 @@ def __getattribute__(self, __name: str):
8181
def addState(self, state: str):
8282
self.States.append(state)
8383
def setStates(self, states: set):
84-
self.States = states
84+
self.States = list(states)
8585

8686
#/ For Automata Alphabet:
8787
def addSymbol(self, symbol: str):
8888
self.Alphabet.append(symbol)
8989
def setAlphabet(self, alphabet: set):
90-
self.Alphabet = alphabet
90+
self.Alphabet = list(alphabet)
9191

9292
#/ For Automata Transitions:
9393
def addTransition(self, transition: tuple):
@@ -106,7 +106,7 @@ def setInitial(self, initial: str):
106106
def addFinal(self, final: str):
107107
self.Finals.append(final)
108108
def setFinals(self, finals: set):
109-
self.Finals = finals
109+
self.Finals = list(finals)
110110

111111

112112
#? Methods:

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /