Ejemplo n.º 1
0
s2 = State(2, False, True)
t1 = Transition(s1, "a", s1)
t2 = Transition(s1, "a", s2)
t3 = Transition(s1, "b", s2)
t4 = Transition(s2, "a", s2)
t5 = Transition(s2, "b", s2)
liste = [t1, t2, t3, t4, t5]
a = Automate(listStates=[], label="a", listTransitions=liste)

print("a : ")
print(a)
print(a.listStates)
#print a.getListStates()
#print a.getSetStates()
print(a.getListInitialStates())
print(a.getListFinalStates())
print(a.getListTransitionsFrom(s1))
#a.show("nouvela")
a.prefixStates(0)
a.show("prefixe")

a.removeTransition(t5)
print(a)
a.removeTransition(t5)
print(a)

a.addTransition(t5)
print(a)

a.addTransition(Transition(s2, "c", s1))
print(a)
Ejemplo n.º 2
0
s2 = State(2, False, True)
t1 = Transition(s1, "a", s1)
t2 = Transition(s1, "a", s2)
t3 = Transition(s1, "b", s2)
t4 = Transition(s2, "a", s2)
t5 = Transition(s2, "b", s2)
liste = [t1, t2, t3, t4, t5]
a = Automate(listStates=[], label="a", listTransitions=liste)

print "a : "
print a
print a.listStates
#print a.getListStates()
#print a.getSetStates()
print a.getListInitialStates()
print a.getListFinalStates()
print a.getListTransitionsFrom(s1)
#a.show("nouvela")
a.prefixStates(0)
a.show("prefixe")

a.removeTransition(t5)
print a
a.removeTransition(t5)
print a

a.addTransition(t5)
print a

a.addTransition(Transition(s2, "c", s1))
print a