diff --git a/src/cpp/benders/benders_core/CriterionInputDataReader.cpp b/src/cpp/benders/benders_core/CriterionInputDataReader.cpp index 4820908f0..0fce7710d 100644 --- a/src/cpp/benders/benders_core/CriterionInputDataReader.cpp +++ b/src/cpp/benders/benders_core/CriterionInputDataReader.cpp @@ -13,7 +13,7 @@ using namespace Benders::Criterion; CriterionPattern::CriterionPattern(std::string prefix, std::string body) : prefix_(std::move(prefix)), body_(std::move(body)) {} -std::string CriterionPattern::Pattern() const { +std::string CriterionPattern::Value() const { return prefix_ + "area<" + body_ + ">"; } diff --git a/src/cpp/benders/benders_core/VariablesGroup.cpp b/src/cpp/benders/benders_core/VariablesGroup.cpp index af704cd13..e949467be 100644 --- a/src/cpp/benders/benders_core/VariablesGroup.cpp +++ b/src/cpp/benders/benders_core/VariablesGroup.cpp @@ -27,14 +27,14 @@ void VariablesGroup::Search() { indices_.assign(criterion_single_input_data_.size(), {}); int pattern_index(0); for (const auto& single_input_data : criterion_single_input_data_) { - auto pattern = single_input_data.Pattern().GetPrefix() + "area<" + single_input_data.Pattern().GetBody() + ">"; + auto pattern = single_input_data.Pattern().Value(); int var_index(0); for (const auto& variable : all_variables_) { - if (variable.find(single_input_data.Pattern().GetPrefix()) != std::string::npos) { + if (variable.find(pattern) != std::string::npos) { indices_[pattern_index].push_back(var_index); } - var_index++; + ++var_index; } ++pattern_index; } -} +} \ No newline at end of file diff --git a/src/cpp/benders/benders_core/include/antares-xpansion/benders/benders_core/CriterionInputDataReader.h b/src/cpp/benders/benders_core/include/antares-xpansion/benders/benders_core/CriterionInputDataReader.h index f4462ea93..263742609 100644 --- a/src/cpp/benders/benders_core/include/antares-xpansion/benders/benders_core/CriterionInputDataReader.h +++ b/src/cpp/benders/benders_core/include/antares-xpansion/benders/benders_core/CriterionInputDataReader.h @@ -45,7 +45,7 @@ class CriterionPattern { public: explicit CriterionPattern(std::string prefix, std::string body); CriterionPattern() = default; - [[nodiscard]] std::string Pattern() const; + [[nodiscard]] std::string Value() const; [[nodiscard]] const std::string &GetPrefix() const; void SetPrefix(const std::string &prefix); [[nodiscard]] const std::string &GetBody() const; diff --git a/tests/cpp/outer_loop/outer_loop_test.cpp b/tests/cpp/outer_loop/outer_loop_test.cpp index cad5e4a81..e69cf673a 100644 --- a/tests/cpp/outer_loop/outer_loop_test.cpp +++ b/tests/cpp/outer_loop/outer_loop_test.cpp @@ -181,7 +181,7 @@ TEST_F(OuterLoopPatternTest, RegexGivenPrefixAndBody) { const std::string body = "body"; CriterionPattern o(prefix, body); - auto ret_regex = o.Pattern(); + auto ret_regex = o.Value(); ASSERT_EQ((prefix + body).find(ret_regex) != std::string::npos, false); ASSERT_EQ((prefix + "::" + body + "::suffix").find(ret_regex) != std::string::npos,