Make sure we can multiply two tgba_explicit.

* tgba/state.hh (state::translate, state::clone, state::as_bdd):
New virtual methods.
* tgba/stataebdd.cc (state::translate, state::clone): New methods.
* tgba/stataebdd.hh (state::translate, state::clone): New methods.
* tgba/tgbabddprod.cc (state_bdd_product::clone,
tgba_bdd_product_succ_iterator::~tgba_bdd_product_succ_iterator):
New methods.
(tgba_bdd_product_succ_iterator::first): Reset right_
if any of left_ or right_ is already done (i.e., is empty).
(tgba_bdd_product_succ_iterator::done): Return true
if right_ is NULL.
(tgba_bdd_product_succ_iterator::current_state,
tgba_bdd_product::get_init_state): Work	directory with `state's.
* tgba/tgbabddprod.hh (state_bdd_product::clone,
tgba_bdd_product_succ_iterator::~tgba_bdd_product_succ_iterator):
New methods.
* tgba/tgbabddtranslateproxy.cc
(tgba_bdd_translate_proxy_succ_iterator::
tgba_bdd_translate_proxy_succ_iterator): Work on any kind of iteraator.
(tgba_bdd_translate_proxy_succ_iterator::
~tgba_bdd_translate_proxy_succ_iterator): New method.
(tgba_bdd_translate_proxy_succ_iterator::current_state,
tgba_bdd_translate_proxy::get_init_state,
tgba_bdd_translate_proxy::succ_iter): Work on `state's and
`tgba_succ_iterator's directlry.
(tgba_bdd_translate_proxy::format_state): Delegate formating
to the proxied automata.
* tgba/tgbaexplicit.cc (state_explicit::clone): New method.
* src/tgba/tgbaexplicit.cc (tgba_explicit::get_condition,
tgba_explicit::get_promise): Call ltl::destroy on existing formulae.
* tgbatest/Makefile.am (check_PROGRAMS): Add explprod.
(explprod_SOURCES): New variable.
(TESTS): Add explprod.test.
(CLEANFILES): Add input1 and input2.
This commit is contained in:
Alexandre Duret-Lutz 2003-06-16 15:18:20 +00:00
parent 5d2e0a4224
commit ab09c18597
16 changed files with 275 additions and 85 deletions

View file

@ -26,6 +26,12 @@ namespace spot
return right_->compare(o->right());
}
state_bdd_product*
state_bdd_product::clone() const
{
return new state_bdd_product(*this);
}
////////////////////////////////////////////////////////////
// tgba_bdd_product_succ_iterator
@ -35,6 +41,13 @@ namespace spot
{
}
tgba_bdd_product_succ_iterator::~tgba_bdd_product_succ_iterator()
{
delete left_;
if (right_)
delete right_;
}
void
tgba_bdd_product_succ_iterator::step_()
{
@ -67,8 +80,20 @@ namespace spot
void
tgba_bdd_product_succ_iterator::first()
{
if (!right_)
return;
left_->first();
right_->first();
// If one of the two successor set is empty initially, we reset
// right_, so that done() can detect this situation easily. (We
// choose to reset right_ because this variable is already used by
// done().)
if (left_->done() || right_->done())
{
delete right_;
right_ = 0;
}
next_non_false_();
}
@ -82,18 +107,15 @@ namespace spot
bool
tgba_bdd_product_succ_iterator::done()
{
return right_->done();
return !right_ || right_->done();
}
state_bdd*
state_bdd_product*
tgba_bdd_product_succ_iterator::current_state()
{
state_bdd* ls = dynamic_cast<state_bdd*>(left_->current_state());
state_bdd* rs = dynamic_cast<state_bdd*>(right_->current_state());
assert(ls);
assert(rs);
return new state_bdd_product(ls, rs);
return new state_bdd_product(left_->current_state(),
right_->current_state());
}
bdd
@ -149,11 +171,8 @@ namespace spot
state*
tgba_bdd_product::get_init_state() const
{
state_bdd* ls = dynamic_cast<state_bdd*>(left_->get_init_state());
state_bdd* rs = dynamic_cast<state_bdd*>(right_->get_init_state());
assert(ls);
assert(rs);
return new state_bdd_product(ls, rs);
return new state_bdd_product(left_->get_init_state(),
right_->get_init_state());
}
tgba_bdd_product_succ_iterator*