Renamed arguments to parameters in predicate declarations.

This commit is contained in:
Patrick Lühne 2016-12-07 02:55:44 +01:00
parent ebab65e233
commit 2334686c59
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
4 changed files with 20 additions and 20 deletions

View File

@ -25,7 +25,7 @@ class PredicateDeclaration: public ExpressionCRTP<PredicateDeclaration>
public:
const std::string &name() const;
const Variables &arguments() const;
const Variables &parameters() const;
bool isDeclared() const;

View File

@ -154,7 +154,7 @@ void TranslatorASP::translatePredicates() const
const auto printPredicateName =
[&](const auto &predicate)
{
if (predicate->arguments().empty())
if (predicate->parameters().empty())
{
m_outputStream << output::String(predicate->name().c_str());
@ -162,7 +162,7 @@ void TranslatorASP::translatePredicates() const
}
m_outputStream << "(" << output::String(predicate->name().c_str());
translateVariablesHead(m_outputStream, predicate->arguments());
translateVariablesHead(m_outputStream, predicate->parameters());
m_outputStream << ")";
};
@ -178,7 +178,7 @@ void TranslatorASP::translatePredicates() const
m_outputStream << "))";
translateVariablesBody(m_outputStream, predicate->arguments());
translateVariablesBody(m_outputStream, predicate->parameters());
m_outputStream << ".";
});

View File

@ -42,7 +42,7 @@ void PredicateDeclaration::parse(Context &context, Domain &domain)
ExpressionContext expressionContext(domain);
expressionContext.variables.push(&predicate->m_parameters);
// Parse arguments
// Parse parameters
Variable::parseTypedDeclarations(context, expressionContext, predicate->m_parameters);
context.parser.expect<std::string>(")");
@ -73,7 +73,7 @@ const std::string &PredicateDeclaration::name() const
////////////////////////////////////////////////////////////////////////////////////////////////////
const Variables &PredicateDeclaration::arguments() const
const Variables &PredicateDeclaration::parameters() const
{
return m_parameters;
}

View File

@ -50,18 +50,18 @@ TEST_CASE("[PDDL parser] The Blocks World domain is parsed correctly", "[PDDL pa
const auto &on = *domain.predicates()[0];
CHECK(on.name() == "on");
REQUIRE(on.arguments().size() == 2u);
CHECK(on.arguments()[0]->name() == "x");
const auto &onArgument0Type = on.arguments()[0]->type()->as<expressions::PrimitiveType>();
REQUIRE(on.parameters().size() == 2u);
CHECK(on.parameters()[0]->name() == "x");
const auto &onArgument0Type = on.parameters()[0]->type()->as<expressions::PrimitiveType>();
CHECK(&onArgument0Type == &block);
CHECK(on.arguments()[1]->name() == "y");
const auto &onArgument1Type = on.arguments()[1]->type()->as<expressions::PrimitiveType>();
CHECK(on.parameters()[1]->name() == "y");
const auto &onArgument1Type = on.parameters()[1]->type()->as<expressions::PrimitiveType>();
CHECK(&onArgument1Type == &block);
const auto &handempty = *domain.predicates()[3];
CHECK(handempty.name() == "handempty");
CHECK(handempty.arguments().empty());
CHECK(handempty.parameters().empty());
// Actions
REQUIRE(domain.actions().size() == 4u);
@ -207,19 +207,19 @@ TEST_CASE("[PDDL parser] The Storage domain is parsed correctly", "[PDDL parser]
const auto &on = *domain.predicates()[5];
CHECK(on.name() == "on");
REQUIRE(on.arguments().size() == 2u);
CHECK(on.arguments()[0]->name() == "c");
const auto &onArgument0Type = on.arguments()[0]->type()->as<expressions::PrimitiveType>();
REQUIRE(on.parameters().size() == 2u);
CHECK(on.parameters()[0]->name() == "c");
const auto &onArgument0Type = on.parameters()[0]->type()->as<expressions::PrimitiveType>();
CHECK(&onArgument0Type == &crate);
CHECK(on.arguments()[1]->name() == "s");
const auto &onArgument1Type = on.arguments()[1]->type()->as<expressions::PrimitiveType>();
CHECK(on.parameters()[1]->name() == "s");
const auto &onArgument1Type = on.parameters()[1]->type()->as<expressions::PrimitiveType>();
CHECK(&onArgument1Type == &storearea);
const auto &in = *domain.predicates()[1];
CHECK(in.name() == "in");
REQUIRE(in.arguments().size() == 2u);
CHECK(in.arguments()[0]->name() == "x");
const auto &inArgument0Type = in.arguments()[0]->type()->as<expressions::Either>();
REQUIRE(in.parameters().size() == 2u);
CHECK(in.parameters()[0]->name() == "x");
const auto &inArgument0Type = in.parameters()[0]->type()->as<expressions::Either>();
REQUIRE(inArgument0Type.arguments().size() == 2u);
const auto &inArgument0Type0 = inArgument0Type.arguments()[0]->as<expressions::PrimitiveType>();
CHECK(&inArgument0Type0 == &storearea);