From 79d449d0df52cb8751bb1654c25e78c6510d22bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Mon, 5 Sep 2016 00:06:09 +0200 Subject: [PATCH] Renaming to not confuse expression simplification and reduction. --- include/plasp/pddl/Expression.h | 2 +- include/plasp/pddl/expressions/At.h | 2 +- include/plasp/pddl/expressions/Binary.h | 6 +++--- include/plasp/pddl/expressions/Imply.h | 2 +- include/plasp/pddl/expressions/NAry.h | 6 +++--- include/plasp/pddl/expressions/Not.h | 2 +- src/plasp/pddl/Expression.cpp | 4 ++-- src/plasp/pddl/expressions/At.cpp | 4 ++-- src/plasp/pddl/expressions/Imply.cpp | 8 ++++---- src/plasp/pddl/expressions/Not.cpp | 4 ++-- tests/TestPDDLNormalization.cpp | 4 ++-- 11 files changed, 22 insertions(+), 22 deletions(-) diff --git a/include/plasp/pddl/Expression.h b/include/plasp/pddl/Expression.h index 49079f1..5da342f 100644 --- a/include/plasp/pddl/Expression.h +++ b/include/plasp/pddl/Expression.h @@ -110,7 +110,7 @@ class Expression virtual Type expressionType() const = 0; ExpressionPointer normalized(); - virtual ExpressionPointer simplified(); + virtual ExpressionPointer reduced(); virtual ExpressionPointer negationNormalized(); ExpressionPointer negated(); diff --git a/include/plasp/pddl/expressions/At.h b/include/plasp/pddl/expressions/At.h index e76fc91..9113afe 100644 --- a/include/plasp/pddl/expressions/At.h +++ b/include/plasp/pddl/expressions/At.h @@ -37,7 +37,7 @@ class At: public ExpressionCRTP void setArgument(ExpressionPointer argument); ExpressionPointer argument() const; - ExpressionPointer simplified() override; + ExpressionPointer reduced() override; ExpressionPointer negationNormalized() override; void print(std::ostream &ostream) const override; diff --git a/include/plasp/pddl/expressions/Binary.h b/include/plasp/pddl/expressions/Binary.h index e7e3af2..32b2c73 100644 --- a/include/plasp/pddl/expressions/Binary.h +++ b/include/plasp/pddl/expressions/Binary.h @@ -31,7 +31,7 @@ class Binary: public ExpressionCRTP void setArgument(size_t i, ExpressionPointer argument); const std::array &arguments() const; - ExpressionPointer simplified() override; + ExpressionPointer reduced() override; ExpressionPointer negationNormalized() override; void print(std::ostream &ostream) const override; @@ -91,13 +91,13 @@ const std::array &Binary::arguments() const //////////////////////////////////////////////////////////////////////////////////////////////////// template -inline ExpressionPointer Binary::simplified() +inline ExpressionPointer Binary::reduced() { for (size_t i = 0; i < m_arguments.size(); i++) { BOOST_ASSERT(m_arguments[i]); - m_arguments[i] = m_arguments[i]->simplified(); + m_arguments[i] = m_arguments[i]->reduced(); } return this; diff --git a/include/plasp/pddl/expressions/Imply.h b/include/plasp/pddl/expressions/Imply.h index 61e4ebb..b8c2f1a 100644 --- a/include/plasp/pddl/expressions/Imply.h +++ b/include/plasp/pddl/expressions/Imply.h @@ -24,7 +24,7 @@ class Imply: public Binary static const std::string Identifier; public: - ExpressionPointer simplified() override; + ExpressionPointer reduced() override; }; //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/include/plasp/pddl/expressions/NAry.h b/include/plasp/pddl/expressions/NAry.h index 5d26d98..66760c6 100644 --- a/include/plasp/pddl/expressions/NAry.h +++ b/include/plasp/pddl/expressions/NAry.h @@ -33,7 +33,7 @@ class NAry: public ExpressionCRTP Expressions &arguments(); const Expressions &arguments() const; - ExpressionPointer simplified() override; + ExpressionPointer reduced() override; ExpressionPointer negationNormalized() override; void print(std::ostream &ostream) const override; @@ -121,13 +121,13 @@ Expressions &NAry::arguments() //////////////////////////////////////////////////////////////////////////////////////////////////// template -inline ExpressionPointer NAry::simplified() +inline ExpressionPointer NAry::reduced() { for (size_t i = 0; i < m_arguments.size(); i++) { BOOST_ASSERT(m_arguments[i]); - m_arguments[i] = m_arguments[i]->simplified(); + m_arguments[i] = m_arguments[i]->reduced(); } return this; diff --git a/include/plasp/pddl/expressions/Not.h b/include/plasp/pddl/expressions/Not.h index 23427c6..dce88ce 100644 --- a/include/plasp/pddl/expressions/Not.h +++ b/include/plasp/pddl/expressions/Not.h @@ -32,7 +32,7 @@ class Not: public ExpressionCRTP void setArgument(ExpressionPointer argument); ExpressionPointer argument() const; - ExpressionPointer simplified() override; + ExpressionPointer reduced() override; ExpressionPointer negationNormalized() override; void print(std::ostream &ostream) const override; diff --git a/src/plasp/pddl/Expression.cpp b/src/plasp/pddl/Expression.cpp index ac69918..2d2a5e2 100644 --- a/src/plasp/pddl/Expression.cpp +++ b/src/plasp/pddl/Expression.cpp @@ -26,12 +26,12 @@ namespace pddl ExpressionPointer Expression::normalized() { - return simplified()->negationNormalized(); + return reduced()->negationNormalized(); } //////////////////////////////////////////////////////////////////////////////////////////////////// -ExpressionPointer Expression::simplified() +ExpressionPointer Expression::reduced() { return this; } diff --git a/src/plasp/pddl/expressions/At.cpp b/src/plasp/pddl/expressions/At.cpp index e4ee339..168d7a8 100644 --- a/src/plasp/pddl/expressions/At.cpp +++ b/src/plasp/pddl/expressions/At.cpp @@ -36,9 +36,9 @@ ExpressionPointer At::argument() const //////////////////////////////////////////////////////////////////////////////////////////////////// -ExpressionPointer At::simplified() +ExpressionPointer At::reduced() { - throw utils::TranslatorException("“at” predicates currently not supported"); + throw utils::TranslatorException("reducing “at” predicates currently not supported"); } //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/plasp/pddl/expressions/Imply.cpp b/src/plasp/pddl/expressions/Imply.cpp index b99a99c..0e55591 100644 --- a/src/plasp/pddl/expressions/Imply.cpp +++ b/src/plasp/pddl/expressions/Imply.cpp @@ -21,13 +21,13 @@ const std::string Imply::Identifier = "imply"; //////////////////////////////////////////////////////////////////////////////////////////////////// -ExpressionPointer Imply::simplified() +ExpressionPointer Imply::reduced() { BOOST_ASSERT(m_arguments[0]); BOOST_ASSERT(m_arguments[1]); - m_arguments[0] = m_arguments[0]->simplified(); - m_arguments[1] = m_arguments[1]->simplified(); + m_arguments[0] = m_arguments[0]->reduced(); + m_arguments[1] = m_arguments[1]->reduced(); auto notArgument0 = NotPointer(new Not); notArgument0->setArgument(m_arguments[0]); @@ -36,7 +36,7 @@ ExpressionPointer Imply::simplified() orExpression->addArgument(notArgument0); orExpression->addArgument(m_arguments[1]); - return orExpression->simplified(); + return orExpression; } //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/plasp/pddl/expressions/Not.cpp b/src/plasp/pddl/expressions/Not.cpp index 34e85a5..ded0f77 100644 --- a/src/plasp/pddl/expressions/Not.cpp +++ b/src/plasp/pddl/expressions/Not.cpp @@ -37,11 +37,11 @@ ExpressionPointer Not::argument() const //////////////////////////////////////////////////////////////////////////////////////////////////// -ExpressionPointer Not::simplified() +ExpressionPointer Not::reduced() { BOOST_ASSERT(m_argument); - m_argument = m_argument->simplified(); + m_argument = m_argument->reduced(); return this; } diff --git a/tests/TestPDDLNormalization.cpp b/tests/TestPDDLNormalization.cpp index bf01878..a05c0cc 100644 --- a/tests/TestPDDLNormalization.cpp +++ b/tests/TestPDDLNormalization.cpp @@ -10,7 +10,7 @@ using namespace plasp::pddl; //////////////////////////////////////////////////////////////////////////////////////////////////// -TEST(PDDLNormalizationTests, Simplify) +TEST(PDDLNormalizationTests, Reduced) { auto n1 = expressions::NotPointer(new expressions::Not); auto n2 = expressions::NotPointer(new expressions::Not); @@ -31,7 +31,7 @@ TEST(PDDLNormalizationTests, Simplify) n1->setArgument(n2); std::stringstream output; - n1->simplified()->print(output); + n1->reduced()->print(output); ASSERT_EQ(output.str(), "(not (not (and (or (or (not (a)) (b)) (c)) (d))))"); }