patrick
/
plasp
Archived
1
0
Fork 0

Restructured translated PDDL type output.

This commit is contained in:
Patrick Lühne 2016-06-10 17:48:17 +02:00
parent 8f0f4bfa65
commit 458dbd723c
1 changed files with 4 additions and 9 deletions

View File

@ -40,28 +40,23 @@ void TranslatorASP::translateDomain(std::ostream &ostream) const
const auto &domain = m_description.domain();
// Types
ostream << "% types" << std::endl;
ostream << "% types";
const auto &types = domain.types();
std::for_each(types.cbegin(), types.cend(),
[&](const auto &type)
{
ostream << std::endl;
ostream << "type(" << type->name() << ")." << std::endl;
});
// Type inheritance
ostream << std::endl << "% type inheritance" << std::endl;
std::for_each(types.cbegin(), types.cend(),
[&](const auto &type)
{
const auto &parentTypes = type->parentTypes();
std::for_each(parentTypes.cbegin(), parentTypes.cend(),
[&](const auto &parentType)
{
ostream << "inheritsFrom(type(" << type->name() << "), type(" << parentType->name() << "))." << std::endl;
ostream << "inherits(type(" << type->name() << "), type(" << parentType->name() << "))." << std::endl;
});
});
}