-
Notifications
You must be signed in to change notification settings - Fork 0
/
Transition.h
50 lines (48 loc) · 1.67 KB
/
Transition.h
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
#ifndef TRANSITION_H
#define TRANSITION_H
#pragma once
#include <string>
#include <iostream>
using namespace std;
/**
* Transition class
* this class is only here to describe the each transition in the DFA
* each transtion has its start state, its end state and its token aka(letter)
*
*/
class Transition {
public:
// constractor
/**
* @string StartState: the start state of this transition
* @char Token: the letter that is being taken from state to another
* @string EndState: the end state of this transition
*
*/
Transition(string startState, char token, string endState);
// destructor
~Transition();
// all get functions have the const value for protection
// so no one would be able to change the value
string getStartState() const;
string getEndState() const;
char getToken() const;
// the same as toString function
string toString();
// overloading the cout << operator to work as toString() function
// and since it has been identified as a friend it will have access
// to private members
friend ostream &operator << (ostream &strm, const Transition &obj);
private:
// setting the main variables as private so no one would have access to them
// except from the get functions
string StartState; // the start state of this transition
char Token; // the letter that is being taken from state to another
string EndState; // the end state of this transition
// the set function are also private because we don't want to change any of them
// except inside the class functions
void setStartState(string);
void setEndState(string);
void setToken(char);
};
#endif // !TRANSITION_H