Commit dc34862d authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz

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

* spot/twa/twa.cc, spot/twa/twa.hh: Here.
* NEWS: Mention the backward incompatibility.
parent f3e57901
...@@ -135,6 +135,15 @@ New in spot 2.7.5.dev (not yet released) ...@@ -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
......
...@@ -158,7 +158,7 @@ namespace spot ...@@ -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 ...@@ -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
......
...@@ -869,21 +869,45 @@ namespace spot ...@@ -869,21 +869,45 @@ namespace spot
/// this case an explicit product is performed. /// this case an explicit product is performed.
virtual bool intersects(const_twa_ptr other) const; virtual bool intersects(const_twa_ptr other) const;
/// \brief Return an accepting run recognizing a word accepted by
/// two automata.
///
/// The run returned is a run from automaton this.
///
/// 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.
virtual twa_run_ptr intersecting_run(const_twa_ptr other) const;
/// \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 /// If \a from_other is true, the returned run will be over the
/// \a other automaton. Otherwise, the run will be over this /// \a other automaton. Otherwise, the run will be over this
/// automaton. (This argument will be deprecated soon, do not /// automaton.
/// use it.) ///
/// This form is deprecated. Replace a->interesecting_run(b, true)
/// by b->intersecting_run(a).
/// ///
/// 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, ///
bool from_other = false) const; /// 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.
/// ///
......
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