From d74550e05059ab840b32d82936b587e26318338b Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Tue, 6 Sep 2016 14:58:09 +0200 Subject: [PATCH] preprocessor: simplify code --- preprocessor/Shocks.cc | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/preprocessor/Shocks.cc b/preprocessor/Shocks.cc index 9cea0e2d8..1216a40b4 100644 --- a/preprocessor/Shocks.cc +++ b/preprocessor/Shocks.cc @@ -389,19 +389,13 @@ ConditionalForecastPathsStatement::writeOutput(ostream &output, const string &ba << "constrained_paths_ = zeros(" << paths.size() << ", " << path_length << ");" << endl; int k = 1; - for (AbstractShocksStatement::det_shocks_t::const_iterator it = paths.begin(); - it != paths.end(); it++) + it != paths.end(); it++, k++) { if (it == paths.begin()) - { - output << "constrained_vars_ = " << symbol_table.getTypeSpecificID(it->first) + 1 << ";" << endl; - } + output << "constrained_vars_ = " << symbol_table.getTypeSpecificID(it->first) + 1 << ";" << endl; else - { - output << "constrained_vars_ = [constrained_vars_; " << symbol_table.getTypeSpecificID(it->first) + 1 << "];" << endl; - } - + output << "constrained_vars_ = [constrained_vars_; " << symbol_table.getTypeSpecificID(it->first) + 1 << "];" << endl; const vector &elems = it->second; for (int i = 0; i < (int) elems.size(); i++) @@ -411,7 +405,6 @@ ConditionalForecastPathsStatement::writeOutput(ostream &output, const string &ba elems[i].value->writeOutput(output); output << ";" << endl; } - k++; } }