introduce formula::is_leaf()

Fixes #307.

* spot/tl/formula.hh: Here.
* tests/python/ltlparse.py: Test it.
* NEWS: Mention it.
This commit is contained in:
Alexandre Duret-Lutz 2017-11-23 11:29:52 +01:00
parent 246b5d8fed
commit 974a4238f6
3 changed files with 28 additions and 2 deletions

View file

@ -231,6 +231,12 @@ namespace spot
return size_;
}
/// \see formula::is_leaf
bool is_leaf() const
{
return size_ == 0;
}
/// \see formula::id
size_t id() const
{
@ -1277,6 +1283,15 @@ namespace spot
return ptr_->size();
}
/// \brief Whether the formula is a leaf.
///
/// Leaves are formulas without children. They are either
/// constants (true, false, empty word) or atomic propositions.
bool is_leaf() const
{
return ptr_->is_leaf();
}
/// \brief Return the id of a formula.
///
/// Can be used as a hash number.