diff --git a/include/plasp/pddl/Domain.h b/include/plasp/pddl/Domain.h index 01b2689..7f4eb46 100644 --- a/include/plasp/pddl/Domain.h +++ b/include/plasp/pddl/Domain.h @@ -28,8 +28,6 @@ class Domain public: void readPDDL(); - bool isDeclared() const; - void setName(std::string name); const std::string &name() const; @@ -65,7 +63,6 @@ class Domain void parseActionSection(); Context &m_context; - bool m_isDeclared; std::string m_name; Requirements m_requirements; diff --git a/src/plasp/pddl/Domain.cpp b/src/plasp/pddl/Domain.cpp index 6f8f764..d52b905 100644 --- a/src/plasp/pddl/Domain.cpp +++ b/src/plasp/pddl/Domain.cpp @@ -24,8 +24,7 @@ namespace pddl //////////////////////////////////////////////////////////////////////////////////////////////////// Domain::Domain(Context &context) -: m_context(context), - m_isDeclared{false} +: m_context(context) { } @@ -38,13 +37,7 @@ void Domain::readPDDL() m_context.parser.expect("("); m_context.parser.expect("domain"); - const auto domainName = m_context.parser.parseIdentifier(isIdentifier); - - if (m_name.empty()) - m_name = domainName; - // If the domain has previously been referenced, check that the name matches - else if (m_name != domainName) - throw utils::ParserException(m_context.parser, "Domains do not match (\"" + domainName + "\" and \"" + m_name + "\")"); + m_name = m_context.parser.parseIdentifier(isIdentifier); std::cout << "Parsing domain " << m_name << std::endl; @@ -61,15 +54,6 @@ void Domain::readPDDL() } computeDerivedRequirements(); - - m_isDeclared = true; -} - -//////////////////////////////////////////////////////////////////////////////////////////////////// - -bool Domain::isDeclared() const -{ - return m_isDeclared; } //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/plasp/pddl/Problem.cpp b/src/plasp/pddl/Problem.cpp index 34b0df4..490b4e4 100644 --- a/src/plasp/pddl/Problem.cpp +++ b/src/plasp/pddl/Problem.cpp @@ -138,12 +138,9 @@ void Problem::parseDomainSection() const auto domainName = m_context.parser.parseIdentifier(isIdentifier); - if (m_domain.isDeclared() && m_domain.name() != domainName) + if (m_domain.name() != domainName) throw utils::ParserException(m_context.parser, "Domains do not match (\"" + m_domain.name() + "\" and \"" + domainName + "\")"); - if (!m_domain.isDeclared()) - m_domain.setName(domainName); - m_context.parser.expect(")"); }