Commit 61b1f200 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

rename tgba_reachable_iterator as twa_reachable_iterator

* spot/twaalgos/reachiter.cc, spot/twaalgos/reachiter.hh: Here.
* spot/twaalgos/stats.cc, spot/twaalgos/lbtt.cc: Adjust.
* doc/org/upgrade2.org, NEWS: Mention the renaming.
parent ad08a585
...@@ -7,6 +7,8 @@ New in spot 1.99.8a (not yet released) ...@@ -7,6 +7,8 @@ New in spot 1.99.8a (not yet released)
emptiness_check_instantiator::max_acceptance_conditions() renamed emptiness_check_instantiator::max_acceptance_conditions() renamed
to emptiness_check_instantiator::min_sets() and to emptiness_check_instantiator::min_sets() and
emptiness_check_instantiator::max_sets(). emptiness_check_instantiator::max_sets().
* tgba_reachable_iterator (and subclasses) was renamed to
twa_reachable_iterator for consistency.
Documentation: Documentation:
......
...@@ -658,6 +658,9 @@ for (auto i: aut->succ(s)) ...@@ -658,6 +658,9 @@ for (auto i: aut->succ(s))
| ~tgba_explicit_number~ | ~twa_graph~ | new implementation | | ~tgba_explicit_number~ | ~twa_graph~ | new implementation |
| ~tgba_explicit_string~ | | deleted | | ~tgba_explicit_string~ | | deleted |
| ~tgba_parse()~ | ~parse_aut()~ | single parser for all automata | | ~tgba_parse()~ | ~parse_aut()~ | single parser for all automata |
| ~tgba_reachable_iterator~ | ~twa_reachable_iterator~ | |
| ~tgba_reachable_iterator_breadth_first~ | ~twa_reachable_iterator_breadth_first~ | |
| ~tgba_reachable_iterator_depth_first~ | ~twa_reachable_iterator_depth_first~ | |
| ~tgba_run_to_tgba()~ | ~twa_run::as_twa()~ | | | ~tgba_run_to_tgba()~ | ~twa_run::as_twa()~ | |
| ~tgba_run~ | ~twa_run~ | | | ~tgba_run~ | ~twa_run~ | |
| ~tgba_save_reachable()~ | ~print_hoa()~ | adhoc output format replaced by HOA | | ~tgba_save_reachable()~ | ~print_hoa()~ | adhoc output format replaced by HOA |
......
...@@ -34,11 +34,11 @@ namespace spot ...@@ -34,11 +34,11 @@ namespace spot
{ {
namespace namespace
{ {
class lbtt_bfs : public tgba_reachable_iterator_breadth_first class lbtt_bfs final : public twa_reachable_iterator_breadth_first
{ {
public: public:
lbtt_bfs(const const_twa_ptr& a, std::ostream& os, bool sba_format) lbtt_bfs(const const_twa_ptr& a, std::ostream& os, bool sba_format)
: tgba_reachable_iterator_breadth_first(a), : twa_reachable_iterator_breadth_first(a),
os_(os), os_(os),
sba_format_(sba_format), sba_format_(sba_format),
sba_(nullptr) sba_(nullptr)
......
...@@ -25,15 +25,15 @@ ...@@ -25,15 +25,15 @@
namespace spot namespace spot
{ {
// tgba_reachable_iterator // twa_reachable_iterator
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
tgba_reachable_iterator::tgba_reachable_iterator(const const_twa_ptr& a) twa_reachable_iterator::twa_reachable_iterator(const const_twa_ptr& a)
: aut_(a) : aut_(a)
{ {
} }
tgba_reachable_iterator::~tgba_reachable_iterator() twa_reachable_iterator::~twa_reachable_iterator()
{ {
auto s = seen.begin(); auto s = seen.begin();
while (s != seen.end()) while (s != seen.end())
...@@ -46,7 +46,7 @@ namespace spot ...@@ -46,7 +46,7 @@ namespace spot
} }
void void
tgba_reachable_iterator::run() twa_reachable_iterator::run()
{ {
int n = 0; int n = 0;
start(); start();
...@@ -90,51 +90,51 @@ namespace spot ...@@ -90,51 +90,51 @@ namespace spot
} }
bool bool
tgba_reachable_iterator::want_state(const state*) const twa_reachable_iterator::want_state(const state*) const
{ {
return true; return true;
} }
void void
tgba_reachable_iterator::start() twa_reachable_iterator::start()
{ {
} }
void void
tgba_reachable_iterator::end() twa_reachable_iterator::end()
{ {
} }
void void
tgba_reachable_iterator::process_state(const state*, int, twa_reachable_iterator::process_state(const state*, int,
twa_succ_iterator*) twa_succ_iterator*)
{ {
} }
void void
tgba_reachable_iterator::process_link(const state*, int, twa_reachable_iterator::process_link(const state*, int,
const state*, int, const state*, int,
const twa_succ_iterator*) const twa_succ_iterator*)
{ {
} }
// tgba_reachable_iterator_breadth_first // twa_reachable_iterator_breadth_first
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
tgba_reachable_iterator_breadth_first:: twa_reachable_iterator_breadth_first::
tgba_reachable_iterator_breadth_first(const const_twa_ptr& a) twa_reachable_iterator_breadth_first(const const_twa_ptr& a)
: tgba_reachable_iterator(a) : twa_reachable_iterator(a)
{ {
} }
void void
tgba_reachable_iterator_breadth_first::add_state(const state* s) twa_reachable_iterator_breadth_first::add_state(const state* s)
{ {
todo.push_back(s); todo.push_back(s);
} }
const state* const state*
tgba_reachable_iterator_breadth_first::next_state() twa_reachable_iterator_breadth_first::next_state()
{ {
if (todo.empty()) if (todo.empty())
return nullptr; return nullptr;
...@@ -143,16 +143,16 @@ namespace spot ...@@ -143,16 +143,16 @@ namespace spot
return s; return s;
} }
// tgba_reachable_iterator_depth_first // twa_reachable_iterator_depth_first
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
tgba_reachable_iterator_depth_first:: twa_reachable_iterator_depth_first::
tgba_reachable_iterator_depth_first(const const_twa_ptr& a) twa_reachable_iterator_depth_first(const const_twa_ptr& a)
: aut_(a) : aut_(a)
{ {
} }
tgba_reachable_iterator_depth_first::~tgba_reachable_iterator_depth_first() twa_reachable_iterator_depth_first::~twa_reachable_iterator_depth_first()
{ {
auto s = seen.begin(); auto s = seen.begin();
while (s != seen.end()) while (s != seen.end())
...@@ -165,7 +165,7 @@ namespace spot ...@@ -165,7 +165,7 @@ namespace spot
} }
void void
tgba_reachable_iterator_depth_first::push(const state* s, int sn) twa_reachable_iterator_depth_first::push(const state* s, int sn)
{ {
twa_succ_iterator* si = aut_->succ_iter(s); twa_succ_iterator* si = aut_->succ_iter(s);
process_state(s, sn, si); process_state(s, sn, si);
...@@ -175,7 +175,7 @@ namespace spot ...@@ -175,7 +175,7 @@ namespace spot
} }
void void
tgba_reachable_iterator_depth_first::pop() twa_reachable_iterator_depth_first::pop()
{ {
aut_->release_iter(todo.back().it); aut_->release_iter(todo.back().it);
todo.pop_back(); todo.pop_back();
...@@ -184,7 +184,7 @@ namespace spot ...@@ -184,7 +184,7 @@ namespace spot
} }
void void
tgba_reachable_iterator_depth_first::run() twa_reachable_iterator_depth_first::run()
{ {
int n = 1; int n = 1;
start(); start();
...@@ -240,60 +240,60 @@ namespace spot ...@@ -240,60 +240,60 @@ namespace spot
} }
bool bool
tgba_reachable_iterator_depth_first::want_state(const state*) const twa_reachable_iterator_depth_first::want_state(const state*) const
{ {
return true; return true;
} }
void void
tgba_reachable_iterator_depth_first::start() twa_reachable_iterator_depth_first::start()
{ {
} }
void void
tgba_reachable_iterator_depth_first::end() twa_reachable_iterator_depth_first::end()
{ {
} }
void void
tgba_reachable_iterator_depth_first::process_state(const state*, int, twa_reachable_iterator_depth_first::process_state(const state*, int,
twa_succ_iterator*) twa_succ_iterator*)
{ {
} }
void void
tgba_reachable_iterator_depth_first::process_link(const state*, int, twa_reachable_iterator_depth_first::process_link(const state*, int,
const state*, int, const state*, int,
const twa_succ_iterator*) const twa_succ_iterator*)
{ {
} }
// tgba_reachable_iterator_depth_first_stack // twa_reachable_iterator_depth_first_stack
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
tgba_reachable_iterator_depth_first_stack:: twa_reachable_iterator_depth_first_stack::
tgba_reachable_iterator_depth_first_stack(const const_twa_ptr& a) twa_reachable_iterator_depth_first_stack(const const_twa_ptr& a)
: tgba_reachable_iterator_depth_first(a) : twa_reachable_iterator_depth_first(a)
{ {
} }
void void
tgba_reachable_iterator_depth_first_stack::push(const state* s, int sn) twa_reachable_iterator_depth_first_stack::push(const state* s, int sn)
{ {
stack_.insert(sn); stack_.insert(sn);
this->tgba_reachable_iterator_depth_first::push(s, sn); this->twa_reachable_iterator_depth_first::push(s, sn);
} }
void void
tgba_reachable_iterator_depth_first_stack::pop() twa_reachable_iterator_depth_first_stack::pop()
{ {
stack_.erase(todo.back().src_n); stack_.erase(todo.back().src_n);
this->tgba_reachable_iterator_depth_first::pop(); this->twa_reachable_iterator_depth_first::pop();
} }
bool bool
tgba_reachable_iterator_depth_first_stack::on_stack(int sn) const twa_reachable_iterator_depth_first_stack::on_stack(int sn) const
{ {
return stack_.find(sn) != stack_.end(); return stack_.find(sn) != stack_.end();
} }
......
...@@ -31,11 +31,11 @@ namespace spot ...@@ -31,11 +31,11 @@ namespace spot
{ {
/// \ingroup twa_generic /// \ingroup twa_generic
/// \brief Iterate over all reachable states of a spot::tgba. /// \brief Iterate over all reachable states of a spot::tgba.
class SPOT_API tgba_reachable_iterator class SPOT_API twa_reachable_iterator
{ {
public: public:
tgba_reachable_iterator(const const_twa_ptr& a); twa_reachable_iterator(const const_twa_ptr& a);
virtual ~tgba_reachable_iterator(); virtual ~twa_reachable_iterator();
/// \brief Iterate over all reachable states of a spot::tgba. /// \brief Iterate over all reachable states of a spot::tgba.
/// ///
...@@ -47,7 +47,7 @@ namespace spot ...@@ -47,7 +47,7 @@ namespace spot
/// \name Todo list management. /// \name Todo list management.
/// ///
/// See e.g. /// See e.g.
/// spot::tgba_reachable_iterator_breadth_first for precanned /// spot::twa_reachable_iterator_breadth_first for precanned
/// implementations for these functions. /// implementations for these functions.
/// \{ /// \{
/// \brief Called by run() to register newly discovered states. /// \brief Called by run() to register newly discovered states.
...@@ -81,7 +81,7 @@ namespace spot ...@@ -81,7 +81,7 @@ namespace spot
/// transition. /// transition.
/// ///
/// The in_s and out_s states are owned by the /// The in_s and out_s states are owned by the
/// spot::tgba_reachable_iterator instance and destroyed when the /// spot::twa_reachable_iterator instance and destroyed when the
/// instance is destroyed. /// instance is destroyed.
virtual void process_link(const state* in_s, int in, virtual void process_link(const state* in_s, int in,
const state* out_s, int out, const state* out_s, int out,
...@@ -94,13 +94,13 @@ namespace spot ...@@ -94,13 +94,13 @@ namespace spot
}; };
/// \ingroup twa_generic /// \ingroup twa_generic
/// \brief An implementation of spot::tgba_reachable_iterator that browses /// \brief An implementation of spot::twa_reachable_iterator that browses
/// states breadth first. /// states breadth first.
class SPOT_API tgba_reachable_iterator_breadth_first : class SPOT_API twa_reachable_iterator_breadth_first :
public tgba_reachable_iterator public twa_reachable_iterator
{ {
public: public:
tgba_reachable_iterator_breadth_first(const const_twa_ptr& a); twa_reachable_iterator_breadth_first(const const_twa_ptr& a);
virtual void add_state(const state* s) override; virtual void add_state(const state* s) override;
virtual const state* next_state() override; virtual const state* next_state() override;
...@@ -111,11 +111,11 @@ namespace spot ...@@ -111,11 +111,11 @@ namespace spot
/// \ingroup twa_generic /// \ingroup twa_generic
/// \brief Iterate over all states of an automaton using a DFS. /// \brief Iterate over all states of an automaton using a DFS.
class SPOT_API tgba_reachable_iterator_depth_first class SPOT_API twa_reachable_iterator_depth_first
{ {
public: public:
tgba_reachable_iterator_depth_first(const const_twa_ptr& a); twa_reachable_iterator_depth_first(const const_twa_ptr& a);
virtual ~tgba_reachable_iterator_depth_first(); virtual ~twa_reachable_iterator_depth_first();
/// \brief Iterate over all reachable states of a spot::tgba. /// \brief Iterate over all reachable states of a spot::tgba.
/// ///
...@@ -149,7 +149,7 @@ namespace spot ...@@ -149,7 +149,7 @@ namespace spot
/// transition. /// transition.
/// ///
/// The in_s and out_s states are owned by the /// The in_s and out_s states are owned by the
/// spot::tgba_reachable_iterator instance and destroyed when the /// spot::twa_reachable_iterator instance and destroyed when the
/// instance is destroyed. /// instance is destroyed.
virtual void process_link(const state* in_s, int in, virtual void process_link(const state* in_s, int in,
const state* out_s, int out, const state* out_s, int out,
...@@ -178,11 +178,11 @@ namespace spot ...@@ -178,11 +178,11 @@ namespace spot
/// ///
/// This variant also maintains a set of states that are on the DFS /// This variant also maintains a set of states that are on the DFS
/// stack. It can be checked using the on_stack() method. /// stack. It can be checked using the on_stack() method.
class tgba_reachable_iterator_depth_first_stack class twa_reachable_iterator_depth_first_stack
: public tgba_reachable_iterator_depth_first : public twa_reachable_iterator_depth_first
{ {
public: public:
tgba_reachable_iterator_depth_first_stack(const const_twa_ptr& a); twa_reachable_iterator_depth_first_stack(const const_twa_ptr& a);
/// \brief Whether state sn is on the DFS stack. /// \brief Whether state sn is on the DFS stack.
/// ///
/// Note the destination state of a transition is only pushed to /// Note the destination state of a transition is only pushed to
......
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2008, 2011, 2012, 2013, 2014, 2015 Laboratoire de // Copyright (C) 2008, 2011, 2012, 2013, 2014, 2015, 2016 Laboratoire
// Recherche et Développement de l'Epita (LRDE). // de Recherche et Développement de l'Epita (LRDE).
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6), // Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre // département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie. // et Marie Curie.
...@@ -33,23 +33,23 @@ namespace spot ...@@ -33,23 +33,23 @@ namespace spot
{ {
namespace namespace
{ {
class stats_bfs: public tgba_reachable_iterator_breadth_first class stats_bfs: public twa_reachable_iterator_breadth_first
{ {
public: public:
stats_bfs(const const_twa_ptr& a, twa_statistics& s) stats_bfs(const const_twa_ptr& a, twa_statistics& s)
: tgba_reachable_iterator_breadth_first(a), s_(s) : twa_reachable_iterator_breadth_first(a), s_(s)
{ {
} }
void void
process_state(const state*, int, twa_succ_iterator*) process_state(const state*, int, twa_succ_iterator*) override final
{ {
++s_.states; ++s_.states;
} }
void void
process_link(const state*, int, const state*, int, process_link(const state*, int, const state*, int,
const twa_succ_iterator*) const twa_succ_iterator*) override
{ {
++s_.edges; ++s_.edges;
} }
...@@ -58,7 +58,7 @@ namespace spot ...@@ -58,7 +58,7 @@ namespace spot
twa_statistics& s_; twa_statistics& s_;
}; };
class sub_stats_bfs: public stats_bfs class sub_stats_bfs final: public stats_bfs
{ {
public: public:
sub_stats_bfs(const const_twa_ptr& a, twa_sub_statistics& s) sub_stats_bfs(const const_twa_ptr& a, twa_sub_statistics& s)
...@@ -68,7 +68,7 @@ namespace spot ...@@ -68,7 +68,7 @@ namespace spot
void void
process_link(const state*, int, const state*, int, process_link(const state*, int, const state*, int,
const twa_succ_iterator* it) const twa_succ_iterator* it) override
{ {
++s_.edges; ++s_.edges;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment