Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content
Snippets Groups Projects
Commit 529108af authored by Christof Metzger-Kraus's avatar Christof Metzger-Kraus
Browse files

reduce duplicate code

parent 7b62728b
No related branches found
No related tags found
No related merge requests found
......@@ -237,22 +237,12 @@ void OptimizeCmd::execute() {
}
} else if (type == "real") {
if (itsAttr[i]) {
if (i == EPSILON ||
i == EXPECTEDHYPERVOL ||
i == CONVHVOLPROG ||
i == GENEMUTATIONPROBABILITY ||
i == MUTATIONPROBABILITY ||
i == RECOMBINATIONPROBABILITY ||
i == SIMBINCROSSOVERNU) { // float
std::string val = std::to_string (Attributes::getReal(itsAttr[i]));
val.erase ( val.find_last_not_of('0') + 1, std::string::npos );
std::string argument = "--" + (*it).second + "=" + val;
arguments.push_back(argument);
} else { // integer
int val = Attributes::getReal(itsAttr[i]);
std::string argument = "--" + (*it).second + "=" + std::to_string(val);
arguments.push_back(argument);
}
std::string val = std::to_string (Attributes::getReal(itsAttr[i]));
size_t last = val.find_last_not_of('0');
if (val[last] != '.') ++ last;
val.erase (last, std::string::npos );
std::string argument = "--" + (*it).second + "=" + val;
arguments.push_back(argument);
}
} else if (type == "logical") {
if (itsAttr[i]) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment