Commit f00aa49d authored by Guillaume Sadegh's avatar Guillaume Sadegh
Browse files

Rename the class taa as taa_tgba.

* src/tgba/taa.cc, src/tgba/taa.hh: Rename as ...
* src/tgba/taatgba.cc, src/tgba/taatgba.hh: ... these, and
rename the class taa as taa_tgba.
* src/tgbaalgos/ltl2taa.cc, src/tgbaalgos/ltl2taa.hh,
src/tgbaalgos/Makefile.am: Adjust.
* src/tgbatest/ltl2tgba.cc, src/tgbatest/Makefile.am: Adjust.
* src/tgbatest/taa.test: Rename as ...
* src/tgbatest/taatgba.test ... this.
* src/tgbatest/taa.cc: Rename as ...
* src/tgbatest/taatgba.cc ... this, and adjust.
parent d362e752
2009-11-27 Guillaume Sadegh <sadegh@lrde.epita.fr>
Rename the class taa as taa_tgba.
* src/tgba/taa.cc, src/tgba/taa.hh: Rename as ...
* src/tgba/taatgba.cc, src/tgba/taatgba.hh: ... these, and
rename the class taa as taa_tgba.
* src/tgbaalgos/ltl2taa.cc, src/tgbaalgos/ltl2taa.hh,
src/tgbaalgos/Makefile.am: Adjust.
* src/tgbatest/ltl2tgba.cc, src/tgbatest/Makefile.am: Adjust.
* src/tgbatest/taa.test: Rename as ...
* src/tgbatest/taatgba.test ... this.
* src/tgbatest/taa.cc: Rename as ...
* src/tgbatest/taatgba.cc ... this, and adjust.
2009-11-26 Alexandre Duret-Lutz <adl@lrde.epita.fr> 2009-11-26 Alexandre Duret-Lutz <adl@lrde.epita.fr>
* src/tgbatest/ltl2tgba.cc (main): Fix typo to re-enable * src/tgbatest/ltl2tgba.cc (main): Fix typo to re-enable
......
...@@ -34,7 +34,7 @@ tgba_HEADERS = \ ...@@ -34,7 +34,7 @@ tgba_HEADERS = \
statebdd.hh \ statebdd.hh \
succiter.hh \ succiter.hh \
succiterconcrete.hh \ succiterconcrete.hh \
taa.hh \ taatgba.hh \
tgba.hh \ tgba.hh \
tgbabddconcrete.hh \ tgbabddconcrete.hh \
tgbabddconcretefactory.hh \ tgbabddconcretefactory.hh \
...@@ -60,7 +60,7 @@ libtgba_la_SOURCES = \ ...@@ -60,7 +60,7 @@ libtgba_la_SOURCES = \
futurecondcol.cc \ futurecondcol.cc \
succiterconcrete.cc \ succiterconcrete.cc \
statebdd.cc \ statebdd.cc \
taa.cc \ taatgba.cc \
tgba.cc \ tgba.cc \
tgbabddconcrete.cc \ tgbabddconcrete.cc \
tgbabddconcretefactory.cc \ tgbabddconcretefactory.cc \
......
...@@ -25,15 +25,15 @@ ...@@ -25,15 +25,15 @@
#include <iostream> #include <iostream>
#include "tgba/formula2bdd.hh" #include "tgba/formula2bdd.hh"
#include "misc/bddop.hh" #include "misc/bddop.hh"
#include "taa.hh" #include "taatgba.hh"
namespace spot namespace spot
{ {
/*----. /*--------.
| taa | | taa_tgba |
`----*/ `--------*/
taa::taa(bdd_dict* dict) taa_tgba::taa_tgba(bdd_dict* dict)
: name_state_map_(), state_name_map_(), dict_(dict), : name_state_map_(), state_name_map_(), dict_(dict),
all_acceptance_conditions_(bddfalse), all_acceptance_conditions_(bddfalse),
all_acceptance_conditions_computed_(false), all_acceptance_conditions_computed_(false),
...@@ -42,12 +42,12 @@ namespace spot ...@@ -42,12 +42,12 @@ namespace spot
{ {
} }
taa::~taa() taa_tgba::~taa_tgba()
{ {
ns_map::iterator i; ns_map::iterator i;
for (i = name_state_map_.begin(); i != name_state_map_.end(); ++i) for (i = name_state_map_.begin(); i != name_state_map_.end(); ++i)
{ {
taa::state::iterator i2; taa_tgba::state::iterator i2;
for (i2 = i->second->begin(); i2 != i->second->end(); ++i2) for (i2 = i->second->begin(); i2 != i->second->end(); ++i2)
delete *i2; delete *i2;
delete i->second; delete i->second;
...@@ -59,7 +59,7 @@ namespace spot ...@@ -59,7 +59,7 @@ namespace spot
} }
void void
taa::set_init_state(const std::string& s) taa_tgba::set_init_state(const std::string& s)
{ {
std::vector<std::string> v(1); std::vector<std::string> v(1);
v[0] = s; v[0] = s;
...@@ -67,14 +67,14 @@ namespace spot ...@@ -67,14 +67,14 @@ namespace spot
} }
void void
taa::set_init_state(const std::vector<std::string>& s) taa_tgba::set_init_state(const std::vector<std::string>& s)
{ {
init_ = add_state_set(s); init_ = add_state_set(s);
} }
taa::transition* taa_tgba::transition*
taa::create_transition(const std::string& s, taa_tgba::create_transition(const std::string& s,
const std::vector<std::string>& d) const std::vector<std::string>& d)
{ {
state* src = add_state(s); state* src = add_state(s);
state_set* dst = add_state_set(d); state_set* dst = add_state_set(d);
...@@ -86,8 +86,8 @@ namespace spot ...@@ -86,8 +86,8 @@ namespace spot
return t; return t;
} }
taa::transition* taa_tgba::transition*
taa::create_transition(const std::string& s, const std::string& d) taa_tgba::create_transition(const std::string& s, const std::string& d)
{ {
std::vector<std::string> vec; std::vector<std::string> vec;
vec.push_back(d); vec.push_back(d);
...@@ -95,14 +95,14 @@ namespace spot ...@@ -95,14 +95,14 @@ namespace spot
} }
void void
taa::add_condition(transition* t, const ltl::formula* f) taa_tgba::add_condition(transition* t, const ltl::formula* f)
{ {
t->condition &= formula_to_bdd(f, dict_, this); t->condition &= formula_to_bdd(f, dict_, this);
f->destroy(); f->destroy();
} }
void void
taa::add_acceptance_condition(transition* t, const ltl::formula* f) taa_tgba::add_acceptance_condition(transition* t, const ltl::formula* f)
{ {
if (dict_->acc_map.find(f) == dict_->acc_map.end()) if (dict_->acc_map.find(f) == dict_->acc_map.end())
{ {
...@@ -114,7 +114,7 @@ namespace spot ...@@ -114,7 +114,7 @@ namespace spot
ns_map::iterator i; ns_map::iterator i;
for (i = name_state_map_.begin(); i != name_state_map_.end(); ++i) for (i = name_state_map_.begin(); i != name_state_map_.end(); ++i)
{ {
taa::state::iterator i2; taa_tgba::state::iterator i2;
for (i2 = i->second->begin(); i2 != i->second->end(); ++i2) for (i2 = i->second->begin(); i2 != i->second->end(); ++i2)
(*i2)->acceptance_conditions &= neg; (*i2)->acceptance_conditions &= neg;
} }
...@@ -130,12 +130,12 @@ namespace spot ...@@ -130,12 +130,12 @@ namespace spot
} }
void void
taa::output(std::ostream& os) const taa_tgba::output(std::ostream& os) const
{ {
ns_map::const_iterator i; ns_map::const_iterator i;
for (i = name_state_map_.begin(); i != name_state_map_.end(); ++i) for (i = name_state_map_.begin(); i != name_state_map_.end(); ++i)
{ {
taa::state::const_iterator i2; taa_tgba::state::const_iterator i2;
os << "State: " << i->first << std::endl; os << "State: " << i->first << std::endl;
for (i2 = i->second->begin(); i2 != i->second->end(); ++i2) for (i2 = i->second->begin(); i2 != i->second->end(); ++i2)
{ {
...@@ -147,16 +147,16 @@ namespace spot ...@@ -147,16 +147,16 @@ namespace spot
} }
state* state*
taa::get_init_state() const taa_tgba::get_init_state() const
{ {
assert(init_); assert(init_);
return new spot::state_set(init_); return new spot::state_set(init_);
} }
tgba_succ_iterator* tgba_succ_iterator*
taa::succ_iter(const spot::state* state, taa_tgba::succ_iter(const spot::state* state,
const spot::state* global_state, const spot::state* global_state,
const tgba* global_automaton) const const tgba* global_automaton) const
{ {
const spot::state_set* s = dynamic_cast<const spot::state_set*>(state); const spot::state_set* s = dynamic_cast<const spot::state_set*>(state);
assert(s); assert(s);
...@@ -166,13 +166,13 @@ namespace spot ...@@ -166,13 +166,13 @@ namespace spot
} }
bdd_dict* bdd_dict*
taa::get_dict() const taa_tgba::get_dict() const
{ {
return dict_; return dict_;
} }
std::string std::string
taa::format_state(const spot::state* s) const taa_tgba::format_state(const spot::state* s) const
{ {
const spot::state_set* se = dynamic_cast<const spot::state_set*>(s); const spot::state_set* se = dynamic_cast<const spot::state_set*>(s);
assert(se); assert(se);
...@@ -181,7 +181,7 @@ namespace spot ...@@ -181,7 +181,7 @@ namespace spot
} }
bdd bdd
taa::all_acceptance_conditions() const taa_tgba::all_acceptance_conditions() const
{ {
if (!all_acceptance_conditions_computed_) if (!all_acceptance_conditions_computed_)
{ {
...@@ -193,21 +193,21 @@ namespace spot ...@@ -193,21 +193,21 @@ namespace spot
} }
bdd bdd
taa::neg_acceptance_conditions() const taa_tgba::neg_acceptance_conditions() const
{ {
return neg_acceptance_conditions_; return neg_acceptance_conditions_;
} }
bdd bdd
taa::compute_support_conditions(const spot::state* s) const taa_tgba::compute_support_conditions(const spot::state* s) const
{ {
const spot::state_set* se = dynamic_cast<const spot::state_set*>(s); const spot::state_set* se = dynamic_cast<const spot::state_set*>(s);
assert(se); assert(se);
const state_set* ss = se->get_state(); const state_set* ss = se->get_state();
bdd res = bddtrue; bdd res = bddtrue;
taa::state_set::const_iterator i; taa_tgba::state_set::const_iterator i;
taa::state::const_iterator j; taa_tgba::state::const_iterator j;
for (i = ss->begin(); i != ss->end(); ++i) for (i = ss->begin(); i != ss->end(); ++i)
for (j = (*i)->begin(); j != (*i)->end(); ++j) for (j = (*i)->begin(); j != (*i)->end(); ++j)
res |= (*j)->condition; res |= (*j)->condition;
...@@ -215,28 +215,28 @@ namespace spot ...@@ -215,28 +215,28 @@ namespace spot
} }
bdd bdd
taa::compute_support_variables(const spot::state* s) const taa_tgba::compute_support_variables(const spot::state* s) const
{ {
const spot::state_set* se = dynamic_cast<const spot::state_set*>(s); const spot::state_set* se = dynamic_cast<const spot::state_set*>(s);
assert(se); assert(se);
const state_set* ss = se->get_state(); const state_set* ss = se->get_state();
bdd res = bddtrue; bdd res = bddtrue;
taa::state_set::const_iterator i; taa_tgba::state_set::const_iterator i;
taa::state::const_iterator j; taa_tgba::state::const_iterator j;
for (i = ss->begin(); i != ss->end(); ++i) for (i = ss->begin(); i != ss->end(); ++i)
for (j = (*i)->begin(); j != (*i)->end(); ++j) for (j = (*i)->begin(); j != (*i)->end(); ++j)
res &= bdd_support((*j)->condition); res &= bdd_support((*j)->condition);
return res; return res;
} }
taa::state* taa_tgba::state*
taa::add_state(const std::string& name) taa_tgba::add_state(const std::string& name)
{ {
ns_map::iterator i = name_state_map_.find(name); ns_map::iterator i = name_state_map_.find(name);
if (i == name_state_map_.end()) if (i == name_state_map_.end())
{ {
taa::state* s = new taa::state; taa_tgba::state* s = new taa_tgba::state;
name_state_map_[name] = s; name_state_map_[name] = s;
state_name_map_[s] = name; state_name_map_[s] = name;
return s; return s;
...@@ -244,8 +244,8 @@ namespace spot ...@@ -244,8 +244,8 @@ namespace spot
return i->second; return i->second;
} }
taa::state_set* taa_tgba::state_set*
taa::add_state_set(const std::vector<std::string>& names) taa_tgba::add_state_set(const std::vector<std::string>& names)
{ {
state_set* ss = new state_set; state_set* ss = new state_set;
for (unsigned i = 0; i < names.size(); ++i) for (unsigned i = 0; i < names.size(); ++i)
...@@ -255,7 +255,7 @@ namespace spot ...@@ -255,7 +255,7 @@ namespace spot
} }
std::string std::string
taa::format_state_set(const taa::state_set* ss) const taa_tgba::format_state_set(const taa_tgba::state_set* ss) const
{ {
state_set::const_iterator i1 = ss->begin(); state_set::const_iterator i1 = ss->begin();
sn_map::const_iterator i2; sn_map::const_iterator i2;
...@@ -286,7 +286,7 @@ namespace spot ...@@ -286,7 +286,7 @@ namespace spot
| state_set | | state_set |
`----------*/ `----------*/
const taa::state_set* const taa_tgba::state_set*
state_set::get_state() const state_set::get_state() const
{ {
return s_; return s_;
...@@ -298,14 +298,14 @@ namespace spot ...@@ -298,14 +298,14 @@ namespace spot
const state_set* o = dynamic_cast<const state_set*>(other); const state_set* o = dynamic_cast<const state_set*>(other);
assert(o); assert(o);
const taa::state_set* s1 = get_state(); const taa_tgba::state_set* s1 = get_state();
const taa::state_set* s2 = o->get_state(); const taa_tgba::state_set* s2 = o->get_state();
if (s1->size() != s2->size()) if (s1->size() != s2->size())
return s1->size() - s2->size(); return s1->size() - s2->size();
taa::state_set::const_iterator it1 = s1->begin(); taa_tgba::state_set::const_iterator it1 = s1->begin();
taa::state_set::const_iterator it2 = s2->begin(); taa_tgba::state_set::const_iterator it2 = s2->begin();
while (it2 != s2->end()) while (it2 != s2->end())
{ {
int i = *it1++ - *it2++; int i = *it1++ - *it2++;
...@@ -319,7 +319,7 @@ namespace spot ...@@ -319,7 +319,7 @@ namespace spot
state_set::hash() const state_set::hash() const
{ {
size_t res = 0; size_t res = 0;
taa::state_set::const_iterator it = s_->begin(); taa_tgba::state_set::const_iterator it = s_->begin();
while (it != s_->end()) while (it != s_->end())
{ {
res ^= reinterpret_cast<const char*>(*it++) - static_cast<char*>(0); res ^= reinterpret_cast<const char*>(*it++) - static_cast<char*>(0);
...@@ -332,7 +332,7 @@ namespace spot ...@@ -332,7 +332,7 @@ namespace spot
state_set::clone() const state_set::clone() const
{ {
if (delete_me_ && s_) if (delete_me_ && s_)
return new spot::state_set(new taa::state_set(*s_), true); return new spot::state_set(new taa_tgba::state_set(*s_), true);
else else
return new spot::state_set(s_, false); return new spot::state_set(s_, false);
} }
...@@ -341,21 +341,22 @@ namespace spot ...@@ -341,21 +341,22 @@ namespace spot
| taa_succ_iter | | taa_succ_iter |
`--------------*/ `--------------*/
taa_succ_iterator::taa_succ_iterator(const taa::state_set* s, bdd all_acc) taa_succ_iterator::taa_succ_iterator(const taa_tgba::state_set* s,
bdd all_acc)
: all_acceptance_conditions_(all_acc), seen_() : all_acceptance_conditions_(all_acc), seen_()
{ {
if (s->empty()) if (s->empty())
{ {
taa::transition* t = new taa::transition; taa_tgba::transition* t = new taa_tgba::transition;
t->condition = bddtrue; t->condition = bddtrue;
t->acceptance_conditions = bddfalse; t->acceptance_conditions = bddfalse;
t->dst = new taa::state_set; t->dst = new taa_tgba::state_set;
succ_.push_back(t); succ_.push_back(t);
return; return;
} }
bounds_t bounds; bounds_t bounds;
for (taa::state_set::const_iterator i = s->begin(); i != s->end(); ++i) for (taa_tgba::state_set::const_iterator i = s->begin(); i != s->end(); ++i)
bounds.push_back(std::make_pair((*i)->begin(), (*i)->end())); bounds.push_back(std::make_pair((*i)->begin(), (*i)->end()));
/// Sorting might make the cartesian product faster by not /// Sorting might make the cartesian product faster by not
...@@ -369,15 +370,15 @@ namespace spot ...@@ -369,15 +370,15 @@ namespace spot
while (pos[0] != bounds[0].second) while (pos[0] != bounds[0].second)
{ {
taa::transition* t = new taa::transition; taa_tgba::transition* t = new taa_tgba::transition;
t->condition = bddtrue; t->condition = bddtrue;
t->acceptance_conditions = bddfalse; t->acceptance_conditions = bddfalse;
taa::state_set* ss = new taa::state_set; taa_tgba::state_set* ss = new taa_tgba::state_set;
unsigned p; unsigned p;
for (p = 0; p < pos.size() && t->condition != bddfalse; ++p) for (p = 0; p < pos.size() && t->condition != bddfalse; ++p)
{ {
taa::state_set::const_iterator j; taa_tgba::state_set::const_iterator j;
for (j = (*pos[p])->dst->begin(); j != (*pos[p])->dst->end(); ++j) for (j = (*pos[p])->dst->begin(); j != (*pos[p])->dst->end(); ++j)
if ((*j)->size() > 0) // Remove sink states. if ((*j)->size() > 0) // Remove sink states.
ss->insert(*j); ss->insert(*j);
...@@ -475,7 +476,7 @@ namespace spot ...@@ -475,7 +476,7 @@ namespace spot
taa_succ_iterator::current_state() const taa_succ_iterator::current_state() const
{ {
assert(!done()); assert(!done());
return new spot::state_set(new taa::state_set(*(*i_)->dst), true); return new spot::state_set(new taa_tgba::state_set(*(*i_)->dst), true);
} }
bdd bdd
......
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA. // 02111-1307, USA.
#ifndef SPOT_TGBA_TAA_HH #ifndef SPOT_TGBA_TAATGBA_HH
# define SPOT_TGBA_TAA_HH # define SPOT_TGBA_TAATGBA_HH
#include <set> #include <set>
#include <iosfwd> #include <iosfwd>
...@@ -33,10 +33,10 @@ ...@@ -33,10 +33,10 @@
namespace spot namespace spot
{ {
/// \brief A Transition-based Alternating Automaton (TAA). /// \brief A Transition-based Alternating Automaton (TAA).
class taa : public tgba class taa_tgba : public tgba
{ {
public: public:
taa(bdd_dict* dict); taa_tgba(bdd_dict* dict);
struct transition; struct transition;
typedef std::list<transition*> state; typedef std::list<transition*> state;
...@@ -66,7 +66,7 @@ namespace spot ...@@ -66,7 +66,7 @@ namespace spot
void output(std::ostream& os) const; void output(std::ostream& os) const;
/// TGBA interface. /// TGBA interface.
virtual ~taa(); virtual ~taa_tgba();
virtual spot::state* get_init_state() const; virtual spot::state* get_init_state() const;
virtual tgba_succ_iterator* virtual tgba_succ_iterator*
succ_iter(const spot::state* local_state, succ_iter(const spot::state* local_state,
...@@ -92,14 +92,14 @@ namespace spot ...@@ -92,14 +92,14 @@ namespace spot
virtual bdd compute_support_variables(const spot::state* state) const; virtual bdd compute_support_variables(const spot::state* state) const;
typedef Sgi::hash_map< typedef Sgi::hash_map<
const std::string, taa::state*, string_hash const std::string, taa_tgba::state*, string_hash
> ns_map; > ns_map;
typedef Sgi::hash_map< typedef Sgi::hash_map<
const taa::state*, std::string, ptr_hash<taa::state> const taa_tgba::state*, std::string, ptr_hash<taa_tgba::state>
> sn_map; > sn_map;
typedef std::vector<taa::state_set*> ss_vec; typedef std::vector<taa_tgba::state_set*> ss_vec;
ns_map name_state_map_; ns_map name_state_map_;
sn_map state_name_map_; sn_map state_name_map_;
...@@ -107,31 +107,31 @@ namespace spot ...@@ -107,31 +107,31 @@ namespace spot
mutable bdd all_acceptance_conditions_; mutable bdd all_acceptance_conditions_;
mutable bool all_acceptance_conditions_computed_; mutable bool all_acceptance_conditions_computed_;