Put PDDL translation sections into separate methods.
This commit is contained in:
parent
49002ac52d
commit
9c2f49e4a0
@ -27,6 +27,10 @@ class TranslatorASP
|
|||||||
void checkSupport() const;
|
void checkSupport() const;
|
||||||
|
|
||||||
void translateDomain() const;
|
void translateDomain() const;
|
||||||
|
void translateTypes() const;
|
||||||
|
void translateConstants() const;
|
||||||
|
void translatePredicates() const;
|
||||||
|
|
||||||
void translateProblem() const;
|
void translateProblem() const;
|
||||||
|
|
||||||
const Description &m_description;
|
const Description &m_description;
|
||||||
|
@ -72,9 +72,31 @@ void TranslatorASP::translateDomain() const
|
|||||||
if (!domain.types().empty())
|
if (!domain.types().empty())
|
||||||
{
|
{
|
||||||
m_ostream << std::endl;
|
m_ostream << std::endl;
|
||||||
|
translateTypes();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Constants
|
||||||
|
if (!domain.constants().empty())
|
||||||
|
{
|
||||||
|
m_ostream << std::endl;
|
||||||
|
translateConstants();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Predicates
|
||||||
|
if (!domain.predicates().empty())
|
||||||
|
{
|
||||||
|
m_ostream << std::endl;
|
||||||
|
translatePredicates();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void TranslatorASP::translateTypes() const
|
||||||
|
{
|
||||||
m_ostream << "% types";
|
m_ostream << "% types";
|
||||||
|
|
||||||
const auto &types = domain.types();
|
const auto &types = m_description.domain().types();
|
||||||
|
|
||||||
std::for_each(types.cbegin(), types.cend(),
|
std::for_each(types.cbegin(), types.cend(),
|
||||||
[&](const auto &type)
|
[&](const auto &type)
|
||||||
@ -93,13 +115,13 @@ void TranslatorASP::translateDomain() const
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constants
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
if (!domain.constants().empty())
|
|
||||||
|
void TranslatorASP::translateConstants() const
|
||||||
{
|
{
|
||||||
m_ostream << std::endl;
|
|
||||||
m_ostream << "% constants";
|
m_ostream << "% constants";
|
||||||
|
|
||||||
const auto &constants = domain.constants();
|
const auto &constants = m_description.domain().constants();
|
||||||
|
|
||||||
std::for_each(constants.cbegin(), constants.cend(),
|
std::for_each(constants.cbegin(), constants.cend(),
|
||||||
[&](const auto &constant)
|
[&](const auto &constant)
|
||||||
@ -117,13 +139,13 @@ void TranslatorASP::translateDomain() const
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Predicates
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
if (!domain.predicates().empty())
|
|
||||||
|
void TranslatorASP::translatePredicates() const
|
||||||
{
|
{
|
||||||
m_ostream << std::endl;
|
|
||||||
m_ostream << "% predicates";
|
m_ostream << "% predicates";
|
||||||
|
|
||||||
const auto &predicates = domain.predicates();
|
const auto &predicates = m_description.domain().predicates();
|
||||||
|
|
||||||
std::for_each(predicates.cbegin(), predicates.cend(),
|
std::for_each(predicates.cbegin(), predicates.cend(),
|
||||||
[&](const auto &predicate)
|
[&](const auto &predicate)
|
||||||
@ -164,7 +186,6 @@ void TranslatorASP::translateDomain() const
|
|||||||
m_ostream << ".";
|
m_ostream << ".";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user