Commit 499cdd91 authored by Anonymous's avatar Anonymous

Clang-tidy modification

parent a330df2d
......@@ -23,24 +23,24 @@ CDA::testSub(
for (unsigned int i = 0; i < data.size(); i++) {
bool match = false;
for (unsigned int j = 0; j < data[i].size(); j++) {
for (const auto &instance : data[i]) {
bool val = true;
for (unsigned int x = 0; x < tcs.size() && val; x++) {
if ((values[x].first != NULL && data[i][j][tcs[x]] < *values[x].first) ||
(values[x].second != NULL && data[i][j][tcs[x]] > *values[x].second))
if ((values[x].first != NULL && instance[tcs[x]] < *values[x].first) ||
(values[x].second != NULL && instance[tcs[x]] > *values[x].second))
val = false;
}
if (val) {
match = true;
for (unsigned int k = 0; k < data[i][j].size(); k++) {
for (unsigned int k = 0; k < instance.size(); k++) {
if (bornes.size() <= k)
bornes.push_back({data[i][j][k], data[i][j][k]});
bornes.push_back({instance[k], instance[k]});
else {
if (bornes[k][0] > data[i][j][k])
bornes[k][0] = data[i][j][k];
else if (bornes[k][1] < data[i][j][k])
bornes[k][1] = data[i][j][k];
if (bornes[k][0] > instance[k])
bornes[k][0] = instance[k];
else if (bornes[k][1] < instance[k])
bornes[k][1] = instance[k];
}
}
}
......@@ -86,9 +86,9 @@ CDA::testSub(
std::vector<int> elements = s.getElements();
std::vector<TCIterator> tcis;
for (unsigned i = 0; i < bornes.size(); i++) {
TC *tc = new TC(bornes[i][0], bornes[i][1]);
tcis.push_back(TCIterator(std::shared_ptr<TC>(tc), true));
for (auto &borne : bornes) {
TC *tc = new TC(borne[0], borne[1]);
tcis.emplace_back(std::shared_ptr<TC>(tc), true);
}
if (txt) {
......@@ -172,14 +172,14 @@ CDA::run (
ripper::init(n, data_a, data_b, 1, irep, false);
std::vector<Rule> rules = ripper::run(print, fmin, gmin);
for (unsigned int r = 0; r < rules.size(); r++)
if (rules[r].getClasse() == 0)
testSub(s1, data_a, data_b, rules[r], fmin, gmin, 1);
for (auto &rule : rules)
if (rule.getClasse() == 0)
testSub(s1, data_a, data_b, rule, fmin, gmin, 1);
}
return false;
}
else if (pid > 0)
waitpid(pid,NULL,0);
waitpid(pid, nullptr,0);
else
{
std::cerr << "Fork error" << std::endl;
......@@ -196,15 +196,15 @@ CDA::emergeMSetOcc (
unsigned int nb_se,
std::vector<MSetOcc>& res
) {
for (unsigned int i = 0; i < set.size(); i++) {
for (const auto &i : set) {
// We do not compute emerging multiset occurrences for memory space and computational time
// MSetOcc pat = trace.compileOccurrences(set[i].getSub(), set[i].getMSet(), set[i].getShortMSet(), nb_se);
MSetOcc pat = MSetOcc(set[i].getShortMSet(), std::vector<std::vector<std::pair<int,unsigned int>>>());
MSetOcc pat = MSetOcc(i.getShortMSet(), std::vector<std::vector<std::pair<int,unsigned int>>>());
pat.classe = (unsigned int) trace.classe;
pat.frequency = set[i].getFreq();
pat.ofrequency = set[i].getOFreq();
pat.frequency = i.getFreq();
pat.ofrequency = i.getOFreq();
if (inv_events.size() > 0) {
if (!inv_events.empty()) {
if (txt)
std::cout << pat.txt(inv_events,true) << std::endl;
else
......@@ -225,15 +225,15 @@ CDA::emergeMSet (
) {
std::vector<EMSet> res;
double min = gmin;
for (unsigned int i = 0; i < set1.size(); i++) {
std::vector<int> episode = set1[i].getShortMSet();
for (auto &i : set1) {
std::vector<int> episode = i.getShortMSet();
if (episode.size() >= mincs && (episode.size() <= maxcs || maxcs == 0)) {
if (trace.getFreq(set1[i]) * min <= set1[i].getFreq()) {
set1[i].setOFreq((unsigned int) trace.getFreq(set1[i]));
res.push_back(set1[i]);
if (trace.getFreq(i) * min <= i.getFreq()) {
i.setOFreq((unsigned int) trace.getFreq(i));
res.push_back(i);
}
else if (bset != NULL)
bset->push_back(set1[i]);
else if (bset != nullptr)
bset->push_back(i);
}
}
......@@ -274,7 +274,7 @@ CDA::run (
std::cout << "Intervals graphs number : " << base_itv.size() << std::endl << std::endl;
}
if (init != NULL) extends.push_back(*init);
if (init != nullptr) extends.push_back(*init);
else {
unsigned int nb_itv = (nb_e - nb_se) / 2;
for (unsigned int i = 0; i < nb_e; i++) {
......@@ -298,7 +298,7 @@ CDA::run (
}
}
while (!stop && extends.size() > 0){
while (!stop && !extends.empty()){
Chronicle c (extends.back());
extends.pop_back();
add = true;
......@@ -317,7 +317,7 @@ CDA::run (
}
}
for (Chronicle c : extended) {
for (const Chronicle &c : extended) {
if (stop) break;
run(c,trace,fmin,frequents,p,cwm,close,(close || freq));
}
......@@ -620,7 +620,7 @@ CDA::generateExtendChild(
int ind = indice(e,citv,nb_e);
if (base_pct[ind] != nullptr)
tcs.push_back(TCIterator(base_pct[ind],true));
tcs.emplace_back(base_pct[ind],true);
else {
j = 0;
break;
......@@ -628,7 +628,7 @@ CDA::generateExtendChild(
}
if (j == csize -1) {
tcs.push_back(TCIterator(base_itv[(citv-1-nb_se)/2], false));
tcs.emplace_back(base_itv[(citv-1-nb_se)/2], false);
Chronicle nc = c;
nc.extend(citv,tcs);
......@@ -651,7 +651,7 @@ CDA::generateExtendChild(
else
ind = indice(i,e,nb_e);
if (base_pct[ind] != nullptr)
tcs.push_back(TCIterator(base_pct[ind],true));
tcs.emplace_back(base_pct[ind],true);
else {
j = 0;
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment