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
/
Copy pathFSA_State.cpp
114 lines (105 loc) · 2.24 KB
/
FSA_State.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/**
* @file FSA_State.cpp
* Contains the implementation of the State class.
* @author fabiani
*/
#include "FSA_State.hpp"
using namespace std;
/** default Constructor for FSA_State.*/
State::State()
{
}
/**
* Constructor for FSA_State.
* @param p_szName Name of state.
* @return FSA_state.
* @author fabiani, andreasb
*/
State::State(string p_szName)
{
this-> szName = p_szName;
bStartState = false;
bFinalState = false;
}
/**
* Constructor for FSA_State.
* @param p_szName Name of state,
* @param p_bStartState True if State is StartState,
* @param p_bFinalState True if State is FinalState.
* @return FSA_State.
* @author fabiani, andreasb
*/
State::State(string p_szName, bool p_bStartState, bool p_bFinalState)
{
this->szName = p_szName;
this->bStartState = p_bStartState;
this->bFinalState = p_bFinalState;
}
/**
* Sets the startState value of FSA_State
* @param p_bSetStartState Value for the startState.
* @author fabiani, andreasb
*/
void State::setStartState(bool p_bSetStartState)
{
bStartState = p_bSetStartState;
}
/**
* Sets the finalState value of FSA_State
* @param p_bSetFinalState Value for the finalState.
* @author fabiani, andreasb
*/
void State::setFinalState(bool p_bSetFinalState)
{
bFinalState = p_bSetFinalState;
}
/**
* Gives the value of startState attribute.
* @author fabiani, andreasb
*/
bool State::isStartState()
{
return State::bStartState;
}
/**
* Gives the value of finalState attribute.
* @author fabiani, andreasb
*/
bool State::isFinalState()
{
return State::bFinalState;
}
/**
* Output of one state
* @return szName Name of the state.
* @author fabiani, andreasb*/
string State::output()
{
return szName;
}
/**
* @brief gets the name of the State.
* @author Yacine Smaoui
*/
string State::getName()
{
return this->szName ;
}
void State::setName(string name)
{
this->szName = name ;
}
/**
* @brief compares two States.
* @author Yacine Smaoui
*/
int State::compare(State* state)
{
if (this->getName().compare(state->getName())==0
&& this->isFinalState() == state->isFinalState()
&& this->isStartState() == state->isStartState())
{
return 0 ;
}
return 1;
}