twa: get rid of intersecting_run()'s second argument

* spot/twa/twa.cc, spot/twa/twa.hh: Here.
* NEWS: Mention the backward incompatibility.
This commit is contained in:
Alexandre Duret-Lutz 2019-06-21 21:38:05 +02:00
parent f3e57901a4
commit dc34862d3b
3 changed files with 42 additions and 9 deletions

9
NEWS
View file

@ -135,6 +135,15 @@ New in spot 2.7.5.dev (not yet released)
properties. This can be altered with the SPOT_PR_CHECK properties. This can be altered with the SPOT_PR_CHECK
environment variable. environment variable.
Backward incompatibilities:
- The virtual function twa::intersecting_run() no longuer takes a
second "from_other" Boolean argument. This is a backward
incompatibility only for code that overrides this function in a
subclass. For backward compatibility with programs that simply
call this function with two argument, a non-virtual version of the
function has been introduced and marked as deprecated.
Bugs fixed: Bugs fixed:
- The gf_guarantee_to_ba() is relying on an inplace algorithm that - The gf_guarantee_to_ba() is relying on an inplace algorithm that

View file

@ -158,7 +158,7 @@ namespace spot
} }
twa_run_ptr twa_run_ptr
twa::intersecting_run(const_twa_ptr other, bool from_other) const twa::intersecting_run(const_twa_ptr other) const
{ {
auto self = shared_from_this(); auto self = shared_from_this();
if (acc().uses_fin_acceptance() || other->acc().uses_fin_acceptance()) if (acc().uses_fin_acceptance() || other->acc().uses_fin_acceptance())
@ -168,14 +168,14 @@ namespace spot
auto run = generic_accepting_run(product(g1, g2)); auto run = generic_accepting_run(product(g1, g2));
if (!run) if (!run)
return nullptr; return nullptr;
return run->reduce()->project(from_other ? g2 : g1); return run->reduce()->project(g1);
} }
self = remove_fin_maybe(self); // remove alternation, not Fin self = remove_fin_maybe(self); // remove alternation, not Fin
other = remove_fin_maybe(other); other = remove_fin_maybe(other);
auto run = otf_product(self, other)->accepting_run(); auto run = otf_product(self, other)->accepting_run();
if (!run) if (!run)
return nullptr; return nullptr;
return run->reduce()->project(from_other ? other : self); return run->reduce()->project(self);
} }
twa_word_ptr twa_word_ptr

View file

@ -872,18 +872,42 @@ namespace spot
/// \brief Return an accepting run recognizing a word accepted by /// \brief Return an accepting run recognizing a word accepted by
/// two automata. /// two automata.
/// ///
/// If \a from_other is true, the returned run will be over the /// The run returned is a run from automaton this.
/// \a other automaton. Otherwise, the run will be over this
/// automaton. (This argument will be deprecated soon, do not
/// use it.)
/// ///
/// Return nullptr if no accepting run were found. /// Return nullptr if no accepting run were found.
/// ///
/// An emptiness check is performed on a product computed /// An emptiness check is performed on a product computed
/// on-the-fly, unless some of the operands use Fin-acceptance: in /// on-the-fly, unless some of the operands use Fin-acceptance: in
/// this case an explicit product is performed. /// this case an explicit product is performed.
virtual twa_run_ptr intersecting_run(const_twa_ptr other, virtual twa_run_ptr intersecting_run(const_twa_ptr other) const;
bool from_other = false) const;
/// \brief Return an accepting run recognizing a word accepted by
/// two automata.
///
/// If \a from_other is true, the returned run will be over the
/// \a other automaton. Otherwise, the run will be over this
/// automaton.
///
/// This form is deprecated. Replace a->interesecting_run(b, true)
/// by b->intersecting_run(a).
///
/// Return nullptr if no accepting run were found.
///
/// An emptiness check is performed on a product computed
/// on-the-fly, unless some of the operands use Fin-acceptance: in
/// this case an explicit product is performed.
///
/// This function was deprecated in Spot 2.8.
SPOT_DEPRECATED("replace a->intersecting_run(b, true) "
"by b->intersecting_run(a).")
twa_run_ptr intersecting_run(const_twa_ptr other,
bool from_other) const
{
if (from_other)
return other->intersecting_run(shared_from_this());
else
return this->intersecting_run(other);
}
/// \brief Return a word accepted by two automata. /// \brief Return a word accepted by two automata.
/// ///