Small speedup in sba_explicit::state_is_accepting().

* src/tgba/tgbaexplicit.hh (state_is_accepting): Implement without
creating then deleting an iterator.
This commit is contained in:
Alexandre Duret-Lutz 2012-06-14 17:15:31 +02:00
parent 09864a9d3c
commit 7ceca326ad

View file

@ -221,13 +221,9 @@ namespace spot
virtual State* current_state() const virtual State* current_state() const
{ {
assert(!done()); assert(!done());
//ugly but I can't see any other wayout
const State* res = down_cast<const State*>(it_->dest); const State* res = down_cast<const State*>(it_->dest);
assert(res); assert(res);
return const_cast<State*>(res);
return
const_cast<State*>(res);
} }
virtual bdd current_condition() const virtual bdd current_condition() const
@ -695,22 +691,12 @@ namespace spot
virtual bool state_is_accepting(const spot::state* s) const virtual bool state_is_accepting(const spot::state* s) const
{ {
const State* st = down_cast<const State*>(s);
// Assume that an accepting state has only accepting output transitions // Assume that an accepting state has only accepting output transitions
// So we need only to check one to decide // So we need only to check one to decide
tgba_explicit_succ_iterator<State>* it = this->succ_iter(s); if (st->successors.empty())
it->first();
// no transition
if (it->done())
{
delete it;
return false; return false;
} return st->successors.front().acceptance_conditions != bddfalse;
bool res = it->current_acceptance_conditions() != bddfalse;
delete it;
return res;
} }
private: private: