Added unique ID to derived predicates for easier translation.
This commit is contained in:
parent
a62cc8b3b9
commit
0ca51236bd
@ -24,12 +24,18 @@ class DerivedPredicate: public ExpressionCRTP<DerivedPredicate>
|
||||
// TODO: consider implementing parsing functions for compatibility with older PDDL versions
|
||||
|
||||
public:
|
||||
explicit DerivedPredicate(size_t id);
|
||||
|
||||
size_t id() const;
|
||||
|
||||
void setArgument(ExpressionPointer argument);
|
||||
ExpressionPointer argument() const;
|
||||
|
||||
void print(std::ostream &ostream) const override;
|
||||
|
||||
private:
|
||||
size_t m_id;
|
||||
|
||||
ExpressionPointer m_argument;
|
||||
};
|
||||
|
||||
|
@ -16,6 +16,20 @@ namespace expressions
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DerivedPredicate::DerivedPredicate(size_t id)
|
||||
: m_id{id}
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
size_t DerivedPredicate::id() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void DerivedPredicate::setArgument(ExpressionPointer argument)
|
||||
{
|
||||
m_argument = argument;
|
||||
|
@ -24,7 +24,7 @@ const std::string ForAll::Identifier = "forall";
|
||||
|
||||
ExpressionPointer ForAll::decomposed(DerivedPredicates &derivedPredicates)
|
||||
{
|
||||
auto derivedPredicate = DerivedPredicatePointer(new DerivedPredicate);
|
||||
auto derivedPredicate = DerivedPredicatePointer(new DerivedPredicate(derivedPredicates.size()));
|
||||
derivedPredicates.push_back(derivedPredicate);
|
||||
|
||||
derivedPredicate->setArgument(this);
|
||||
|
@ -28,7 +28,7 @@ ExpressionPointer Or::decomposed(DerivedPredicates &derivedPredicates)
|
||||
argument = argument->decomposed(derivedPredicates);
|
||||
});
|
||||
|
||||
auto derivedPredicate = DerivedPredicatePointer(new DerivedPredicate);
|
||||
auto derivedPredicate = DerivedPredicatePointer(new DerivedPredicate(derivedPredicates.size()));
|
||||
derivedPredicates.push_back(derivedPredicate);
|
||||
|
||||
derivedPredicate->setArgument(this);
|
||||
|
Reference in New Issue
Block a user