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

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2012 Laboratoire de Recherche et Developpement
// Copyright (C) 2012, 2014 Laboratoire de Recherche et Développement
// de l Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -173,19 +173,16 @@ namespace spot
}
void
bool
tgta_succ_iterator_product::first()
{
next_kripke_dest();
trace
<< "*** first() .... if(done()) = ***" << done() << std::endl;
if (!done())
find_next_succ_();
trace << "*** first() .... if(done()) = ***" << done() << std::endl;
return find_next_succ_();
}
void
bool
tgta_succ_iterator_product::next()
{
current_state_->destroy();
@ -193,18 +190,14 @@ namespace spot
step_();
trace
<< "*** next() .... if(done()) = ***" << done() << std::endl;
if (!done())
find_next_succ_();
trace << "*** next() .... if(done()) = ***" << done() << std::endl;
return find_next_succ_();
}
void
bool
tgta_succ_iterator_product::find_next_succ_()
{
while (!done())
{
if (!tgta_succ_it_->done())
@ -214,11 +207,12 @@ namespace spot
tgta_succ_it_->current_state(), pool_);
current_acceptance_conditions_
= tgta_succ_it_->current_acceptance_conditions();
return;
return true;
}
step_();
}
return false;
}
bool