Hiding translated PDDL sections if empty.
This commit is contained in:
parent
979d9509c1
commit
89bb54a3ec
@ -40,47 +40,53 @@ void TranslatorASP::translateDomain(std::ostream &ostream) const
|
|||||||
const auto &domain = m_description.domain();
|
const auto &domain = m_description.domain();
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
ostream << std::endl;
|
if (!domain.types().empty())
|
||||||
ostream << "% types";
|
{
|
||||||
|
ostream << std::endl;
|
||||||
|
ostream << "% types";
|
||||||
|
|
||||||
const auto &types = domain.types();
|
const auto &types = domain.types();
|
||||||
|
|
||||||
std::for_each(types.cbegin(), types.cend(),
|
std::for_each(types.cbegin(), types.cend(),
|
||||||
[&](const auto &type)
|
[&](const auto &type)
|
||||||
{
|
{
|
||||||
ostream << std::endl;
|
ostream << std::endl;
|
||||||
|
|
||||||
ostream << "type(" << type->name() << ")." << std::endl;
|
ostream << "type(" << type->name() << ")." << std::endl;
|
||||||
|
|
||||||
const auto &parentTypes = type->parentTypes();
|
const auto &parentTypes = type->parentTypes();
|
||||||
|
|
||||||
std::for_each(parentTypes.cbegin(), parentTypes.cend(),
|
std::for_each(parentTypes.cbegin(), parentTypes.cend(),
|
||||||
[&](const auto &parentType)
|
[&](const auto &parentType)
|
||||||
{
|
{
|
||||||
ostream << "inherits(type(" << type->name() << "), type(" << parentType->name() << "))." << std::endl;
|
ostream << "inherits(type(" << type->name() << "), type(" << parentType->name() << "))." << std::endl;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
ostream << std::endl;
|
if (!domain.constants().empty())
|
||||||
ostream << "% constants";
|
{
|
||||||
|
ostream << std::endl;
|
||||||
|
ostream << "% constants";
|
||||||
|
|
||||||
const auto &constants = domain.constants();
|
const auto &constants = domain.constants();
|
||||||
|
|
||||||
std::for_each(constants.cbegin(), constants.cend(),
|
std::for_each(constants.cbegin(), constants.cend(),
|
||||||
[&](const auto &constant)
|
[&](const auto &constant)
|
||||||
{
|
{
|
||||||
ostream << std::endl;
|
ostream << std::endl;
|
||||||
|
|
||||||
ostream << "constant(" << constant->name() << ")." << std::endl;
|
ostream << "constant(" << constant->name() << ")." << std::endl;
|
||||||
|
|
||||||
const auto *type = constant->type();
|
const auto *type = constant->type();
|
||||||
|
|
||||||
if (type == nullptr)
|
if (type == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ostream << "hasType(constant(" << constant->name() << "), type(" << type->name() << "))." << std::endl;
|
ostream << "hasType(constant(" << constant->name() << "), type(" << type->name() << "))." << std::endl;
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
Reference in New Issue
Block a user