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