twa: get rid of set_num_sets_()

* spot/twa/twa.hh (set_num_sets_): Remove, and adjust all uses.
This fixes #414.
This commit is contained in:
Alexandre Duret-Lutz 2020-05-25 10:51:44 +02:00
parent 37d0b0d045
commit 9e075e7312

View file

@ -929,16 +929,6 @@ namespace spot
private: private:
acc_cond acc_; acc_cond acc_;
void set_num_sets_(unsigned num)
{
if (num < acc_.num_sets())
{
acc_.~acc_cond();
new (&acc_) acc_cond;
}
acc_.add_sets(num - acc_.num_sets());
}
public: public:
/// Number of acceptance sets used by the automaton. /// Number of acceptance sets used by the automaton.
unsigned num_sets() const unsigned num_sets() const
@ -958,8 +948,7 @@ namespace spot
/// \param c the acceptance formula /// \param c the acceptance formula
void set_acceptance(unsigned num, const acc_cond::acc_code& c) void set_acceptance(unsigned num, const acc_cond::acc_code& c)
{ {
set_num_sets_(num); acc_ = acc_cond(num, c);
acc_.set_acceptance(c);
} }
/// \brief Set the acceptance condition of the automaton. /// \brief Set the acceptance condition of the automaton.
@ -997,8 +986,7 @@ namespace spot
/// property is automatically turned on. /// property is automatically turned on.
void set_generalized_buchi(unsigned num) void set_generalized_buchi(unsigned num)
{ {
set_num_sets_(num); acc_ = acc_cond(num, acc_cond::acc_code::generalized_buchi(num));
acc_.set_generalized_buchi();
} }
/// \brief Set generalized co-Büchi acceptance /// \brief Set generalized co-Büchi acceptance
@ -1015,8 +1003,7 @@ namespace spot
/// property is automatically turned on. /// property is automatically turned on.
void set_generalized_co_buchi(unsigned num) void set_generalized_co_buchi(unsigned num)
{ {
set_num_sets_(num); acc_ = acc_cond(num, acc_cond::acc_code::generalized_co_buchi(num));
acc_.set_generalized_co_buchi();
} }
/// \brief Set Büchi acceptance. /// \brief Set Büchi acceptance.
@ -1036,8 +1023,8 @@ namespace spot
/// \see prop_state_acc /// \see prop_state_acc
acc_cond::mark_t set_buchi() acc_cond::mark_t set_buchi()
{ {
set_generalized_buchi(1); acc_ = acc_cond(1, acc_cond::acc_code::buchi());
return acc_.mark(0); return {0};
} }
/// \brief Set co-Büchi acceptance. /// \brief Set co-Büchi acceptance.
@ -1057,8 +1044,8 @@ namespace spot
/// \see prop_state_acc /// \see prop_state_acc
acc_cond::mark_t set_co_buchi() acc_cond::mark_t set_co_buchi()
{ {
set_generalized_co_buchi(1); acc_ = acc_cond(1, acc_cond::acc_code::cobuchi());
return acc_.mark(0); return {0};
} }
private: private: