Skip to content

Commit

Permalink
avances humildes
Browse files Browse the repository at this point in the history
  • Loading branch information
ignacioDias committed Apr 4, 2024
1 parent dc517b8 commit 4966a2f
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
10 changes: 5 additions & 5 deletions TP/automata/dfa/DeterministicFiniteAutomata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ DeterministicFiniteAutomata::DeterministicFiniteAutomata() : K(), E(), d(), q0()
void DeterministicFiniteAutomata::setE(set<int> alphabet) {
this->E = alphabet;
}
void DeterministicFiniteAutomata::setQ0(set<int> q0) {
this->q0 = q0;
}

void DeterministicFiniteAutomata :: setK(set<set<int>> states) {
this->K = states;
}
void DeterministicFiniteAutomata :: setInitialState(set<int> q) {
this->q0 = q;
}
set<int> DeterministicFiniteAutomata :: getInitialState() {
return this->q0;
}
void DeterministicFiniteAutomata :: setF(set<set<int>> final) {
this->F = final;
}
Expand Down Expand Up @@ -60,8 +60,8 @@ bool DeterministicFiniteAutomata :: belongs(string numbers) {
}
return isFinalNode(currentNode);
}
bool DeterministicFiniteAutomata :: isFinalNode(set<int> node) {
for(auto currentNode : getF()) {
bool DeterministicFiniteAutomata :: isFinalNode(const set<int>& node) {
for(const auto& currentNode : getF()) {
if(currentNode == node)
return true;
}
Expand Down
5 changes: 3 additions & 2 deletions TP/automata/dfa/DeterministicFiniteAutomata.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ class DeterministicFiniteAutomata {
set<int> calculateDelta(const pair<set<int>,int>& key);
void addPath(set<int> node, int arc, set<int> destination);
bool repOk();
void setQ0(set<int> q0);
bool belongs(string numbers);
set<set<int>> getF();
set<int> getInitialState();
private:
bool isFinalNode(set<int> node);
bool isFinalNode(const set<int>& node);

};
#endif // DETERMINISTICFINITEAUTOMATA_H
6 changes: 6 additions & 0 deletions TP/parser/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,9 @@ void Parser::fileManagement(const string& line) {
} else if(!isRankdirLine(line) || line == "}" && readLastLine)
throw runtime_error("Formato invalido del archivo.");
}
string Parser::dnaToFile(DeterministicFiniteAutomata dfa) {
string ret = "digraph{"
"inic[shape=point];"
"inic->";
return ret;
}
7 changes: 4 additions & 3 deletions TP/parser/Parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,19 @@ class Parser {
void addAutomataInformationFromTransitionLine(string line);
void fileManagement(const string& line);
NotDeterministicFiniteAutomata getNDA();
static bool validateInitialStateLine(string line);
static bool validateInitialStateLine(string line); //priv?
static bool validateFirstLine(const string& line);
static bool validateLastLine(const string& line);
static bool validateTransitionLine(const string& line);
static bool validateFinalStateLine(const string& line);
bool isRankdirLine(const string& line);

string dnaToFile(DeterministicFiniteAutomata dfa);

private:
static bool checkDelta(const string& line);
NotDeterministicFiniteAutomata nda;
bool readLastLine;
bool readLastLine;

};


Expand Down
4 changes: 2 additions & 2 deletions cmake-build-debug/Testing/Temporary/LastTest.log
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Start testing: Apr 03 11:27 -03
Start testing: Apr 04 00:12 -03
----------------------------------------------------------
End testing: Apr 03 11:27 -03
End testing: Apr 04 00:12 -03

0 comments on commit 4966a2f

Please sign in to comment.