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_GroupElement.cpp
91 lines (80 loc) · 1.97 KB
/
FSA_GroupElement.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
/**
* @file FSA_GroupElement.cpp
* Contains the implementation of the GroupElement class.
*/
#include "FSA_GroupElement.hpp"
#include <string>
using namespace std;
/**
* Standard constructor.
*/
GroupElement::GroupElement()
{
stState = NULL;
}
/**
* Creates a new group element and sets the element's state to the given state.
* @param p_stState State to use for the group element.
* @author skowelek, fabiani
*/
GroupElement::GroupElement(State *p_stState)
{
this->stState = p_stState;
}
/**
* Adds a group (name) to the target groups vector of this element.
* @param p_szGroupName Name of the group.
* @author skowelek, fabiani
*/
void GroupElement::addGroupToTargetVector(string p_szGroupName)
{
vecTargetGroups.push_back(p_szGroupName);
}
/**
* Removes a group (name) from the target groups vector of this element.
* @param p_szGroupName Name of the group.
* @author skowelek, fabiani
*/
void GroupElement::removeGroupFromTargetVector(string p_szGroupName)
{
for(std::vector<string>::iterator it = vecTargetGroups.begin(); it != vecTargetGroups.end(); ++it) {
if((*it) == p_szGroupName) {
vecTargetGroups.erase(it);
break;
}
}
}
/**
* Returns the state object of this element.
* @return The state object of this element.
* @author skowelek, fabiani
*/
State* GroupElement::getState()
{
return stState;
}
/**
* Clears the target groups vector of this element.
* @author skowelek, fabiani
*/
void GroupElement::clearTargetGroups() {
vecTargetGroups.clear();
}
/**
* Sets the state object of this element to the given state.
* @param p_stState The state object to set the state to.
* @author skowelek, fabiani
*/
void GroupElement::setState(State* p_stState)
{
stState = p_stState;
}
/**
* Returns the target groups vector.
* @return The target groups vector.
* @author skowelek, fabiani
*/
vector<string>* GroupElement::getTargetGroups()
{
return &vecTargetGroups;
}