This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
FSA_Transition.cpp
84 lines (71 loc) · 1.71 KB
/
FSA_Transition.cpp
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/**
* @file FSA_Transition.cpp
* Contains the implementation of the Transition class.
*/
#include "FSA_Transition.hpp"
#include "FSA_State.hpp"
#include<string>
#include<cstring>
/**Constructor FSA_Transition*/
Transition::Transition(State *p_stBeginning, State *p_stFinish, string p_szEdge)
{
this->stBeginning = p_stBeginning;
this->stFinish = p_stFinish;
this->szEdge = p_szEdge;
}
/**
* Output of one transition.
* @return The transition as string.
* @author fabiani, andreasb
*/
string Transition::output(){
string result;
result = stBeginning->szName + " " + szEdge + " " + stFinish->szName;
return result;
}
/**
* Getter for the BeginningState.
* @return Statepointer to the BeginningState.
* @author skowelek
*/
State* Transition::getBeginningState()
{
return stBeginning;
}
/**
* Getter for the FinishState.
* @return Statepointer to the FinishState.
* @author skowelek
*/
State* Transition::getFinishState()
{
return stFinish;
}
/**
* Getter for the EdgeName.
* @return Name of the edge.
* @author skowelek
*/
string Transition::getEdgeName()
{
return szEdge;
}
void Transition::setBeginningState(State *p_stBeginning) {
this->stBeginning = p_stBeginning;
}
void Transition::setFinishState(State *p_stFinish) {
this->stFinish = p_stFinish;
}
void Transition::setEdgeName(string p_szEdge) {
this->szEdge = p_szEdge;
}
int Transition::compare(Transition* transition)
{
if (this->getBeginningState()->compare(transition->getBeginningState())==0
&& this->getFinishState()->compare(transition->getFinishState())==0
&& this->getEdgeName().compare(transition->getEdgeName()) == 0)
{
return 0 ;
}
return 1;
}