Moved util predicates to separate section.

This commit is contained in:
Patrick Lühne 2017-06-28 01:00:36 +02:00
parent 95c03396d0
commit b282225363
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
2 changed files with 18 additions and 7 deletions

View File

@ -26,6 +26,7 @@ class TranslatorASP
private:
void translateDomain() const;
void translateUtils() const;
void translateTypes() const;
void translatePredicates() const;
void translateDerivedPredicates() const;

View File

@ -55,6 +55,10 @@ void TranslatorASP::translateDomain() const
const auto &domain = m_description.domain;
// Utils
m_outputStream << std::endl;
translateUtils();
// Types
m_outputStream << std::endl;
translateTypes();
@ -89,6 +93,18 @@ void TranslatorASP::translateDomain() const
////////////////////////////////////////////////////////////////////////////////////////////////////
void TranslatorASP::translateUtils() const
{
m_outputStream << colorlog::Heading2("utils");
m_outputStream
<< std::endl
<< colorlog::Function("boolean") << "(" << colorlog::Boolean("true") << ")." << std::endl
<< colorlog::Function("boolean") << "(" << colorlog::Boolean("false") << ")." << std::endl;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
void TranslatorASP::translateTypes() const
{
m_outputStream << colorlog::Heading2("types");
@ -167,9 +183,6 @@ void TranslatorASP::translatePredicates() const
m_outputStream
<< std::endl << std::endl
<< colorlog::Function("boolean") << "(" << colorlog::Boolean("true") << ")." << std::endl
<< colorlog::Function("boolean") << "(" << colorlog::Boolean("false") << ")." << std::endl
<< std::endl
<< colorlog::Function("contains") << "("
<< colorlog::Keyword("variable") << "(" << colorlog::Variable("X") << "), "
<< colorlog::Keyword("value") << "(" << colorlog::Variable("X") << ", " << colorlog::Variable("B") << ")) :- "
@ -205,15 +218,12 @@ void TranslatorASP::translateDerivedPredicates() const
m_outputStream
<< std::endl << std::endl
<< colorlog::Function("boolean") << "(" << colorlog::Boolean("true") << ")." << std::endl
<< colorlog::Function("boolean") << "(" << colorlog::Boolean("false") << ")." << std::endl
<< std::endl
<< colorlog::Function("contains") << "("
<< colorlog::Keyword("derivedVariable") << "(" << colorlog::Variable("X") << "), "
<< colorlog::Keyword("value") << "(" << colorlog::Variable("X") << ", " << colorlog::Variable("B") << ")) :- "
<< colorlog::Function("derivedVariable") << "(" << colorlog::Keyword("derivedVariable") << "(" << colorlog::Variable("X") << ")), "
<< colorlog::Function("boolean") << "(" << colorlog::Variable("B") << ")."
<< std::endl << std::endl;
<< std::endl;
for (const auto &derivedPredicate : derivedPredicates)
{