tgba_succ_iterator: have first() and next() return a bool

The returned Boolean indicates whether there is a successor or not.
This way

|  for (i->first(); !i->done(); i->next())
|    {
|       ...
|    }

can be replaced by

| if (i->first()) do
|   {
|      ...
|   }
| while (i->next());

avoiding all the virtual calls to done().

* iface/dve2/dve2.cc, src/kripke/kripkeexplicit.cc,
src/kripke/kripkeexplicit.hh, src/ta/ta.hh, src/ta/taexplicit.cc,
src/ta/taexplicit.hh, src/ta/taproduct.cc, src/ta/taproduct.hh,
src/ta/tgtaproduct.cc, src/ta/tgtaproduct.hh, src/tgba/succiter.hh,
src/tgba/succiterconcrete.cc, src/tgba/succiterconcrete.hh,
src/tgba/taatgba.cc, src/tgba/taatgba.hh, src/tgba/tgba.hh,
src/tgba/tgbaexplicit.hh, src/tgba/tgbakvcomplement.cc,
src/tgba/tgbamask.cc, src/tgba/tgbaproduct.cc,
src/tgba/tgbasafracomplement.cc, src/tgba/tgbasgba.cc,
src/tgba/tgbatba.cc, src/tgba/tgbaunion.cc, src/tgba/tgbaunion.hh,
src/tgba/wdbacomp.cc: Implement and adjust to this new interface.
This commit is contained in:
Alexandre Duret-Lutz 2014-01-26 22:57:14 +01:00
parent 06c69f88ff
commit 1a5c0cb1f3
26 changed files with 256 additions and 206 deletions

View file

@ -29,16 +29,18 @@ namespace spot
{
}
void
bool
tgba_succ_iterator_concrete::first()
{
succ_set_left_ = succ_set_;
current_ = bddfalse;
if (!done())
next();
return next();
else
return false;
}
void
bool
tgba_succ_iterator_concrete::next()
{
assert(!done());
@ -86,7 +88,7 @@ namespace spot
succ_set_left_ -= current_;
if (succ_set_left_ == bddfalse) // No more successors?
return;
return false;
// Pick one transition, and extract its destination.
bdd trans = bdd_satoneset(succ_set_left_, data_.next_set,
@ -157,6 +159,8 @@ namespace spot
current_state_ = bdd_replace(dest, data_.dict->next_to_now);
}
while ((current_state_ & data_.relation) == bddfalse);
return succ_set_left_ != bddfalse;
}
bool