* src/tgbaalgos/emptinesscheck.cc (emptiness_check::remove_component):
Rewrite.
This commit is contained in:
parent
071cb5d62c
commit
549c31605d
2 changed files with 42 additions and 21 deletions
|
|
@ -1,3 +1,8 @@
|
||||||
|
2003-10-24 Alexandre Duret-Lutz <adl@src.lip6.fr>
|
||||||
|
|
||||||
|
* src/tgbaalgos/emptinesscheck.cc (emptiness_check::remove_component):
|
||||||
|
Rewrite.
|
||||||
|
|
||||||
2003-10-23 Alexandre Duret-Lutz <adl@src.lip6.fr>
|
2003-10-23 Alexandre Duret-Lutz <adl@src.lip6.fr>
|
||||||
|
|
||||||
* src/tgbaalgos/emptinesscheck.cc (emptiness_check::check,
|
* src/tgbaalgos/emptinesscheck.cc (emptiness_check::check,
|
||||||
|
|
|
||||||
|
|
@ -29,30 +29,43 @@ namespace spot
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
emptiness_check::remove_component(const state* start_delete)
|
emptiness_check::remove_component(const state* from)
|
||||||
{
|
{
|
||||||
|
// Remove from H all states which are reachable from state FROM.
|
||||||
|
|
||||||
|
// Stack of iterators towards states to remove.
|
||||||
std::stack<tgba_succ_iterator*> to_remove;
|
std::stack<tgba_succ_iterator*> to_remove;
|
||||||
h[start_delete] = -1;
|
|
||||||
tgba_succ_iterator* iter_delete = aut_->succ_iter(start_delete);
|
// Remove FROM itself, and prepare to remove its successors.
|
||||||
iter_delete->first();
|
// (FROM should be in H, otherwise it means all reachable
|
||||||
to_remove.push(iter_delete);
|
// states from FROM have already been removed and there is no
|
||||||
while (!to_remove.empty())
|
// point in calling remove_component.)
|
||||||
|
hash_type::iterator hi = h.find(from);
|
||||||
|
assert(hi->second != -1);
|
||||||
|
hi->second = -1;
|
||||||
|
tgba_succ_iterator* i = aut_->succ_iter(from);
|
||||||
|
|
||||||
|
for (;;)
|
||||||
{
|
{
|
||||||
tgba_succ_iterator* succ_delete = to_remove.top();
|
// Remove each destination of this iterator.
|
||||||
to_remove.pop();
|
for (i->first(); !i->done(); i->next())
|
||||||
if (!succ_delete->done())
|
|
||||||
{
|
{
|
||||||
to_remove.push(succ_delete);
|
state* s = i->current_state();
|
||||||
state* curr_state = succ_delete->current_state();
|
hash_type::iterator hi = h.find(s);
|
||||||
succ_delete->next();
|
assert(hi != h.end());
|
||||||
if (h[curr_state] != -1)
|
|
||||||
|
if (hi->second != -1)
|
||||||
{
|
{
|
||||||
h[curr_state] = -1;
|
hi->second = -1;
|
||||||
tgba_succ_iterator* succ_delete2 = aut_->succ_iter(curr_state);
|
to_remove.push(aut_->succ_iter(s));
|
||||||
succ_delete2->first();
|
|
||||||
to_remove.push(succ_delete2);
|
|
||||||
}
|
}
|
||||||
|
delete s;
|
||||||
}
|
}
|
||||||
|
delete i;
|
||||||
|
if (to_remove.empty())
|
||||||
|
break;
|
||||||
|
i = to_remove.top();
|
||||||
|
to_remove.pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -252,7 +265,6 @@ namespace spot
|
||||||
{
|
{
|
||||||
pair_state_iter started_from = todo_trace.front();
|
pair_state_iter started_from = todo_trace.front();
|
||||||
todo_trace.pop_front();
|
todo_trace.pop_front();
|
||||||
started_from.second->first();
|
|
||||||
|
|
||||||
for (started_from.second->first();
|
for (started_from.second->first();
|
||||||
!started_from.second->done();
|
!started_from.second->done();
|
||||||
|
|
@ -270,9 +282,13 @@ namespace spot
|
||||||
while (vec_component[k].index < i_2->second)
|
while (vec_component[k].index < i_2->second)
|
||||||
{
|
{
|
||||||
assert(i_2->second != 1);
|
assert(i_2->second != 1);
|
||||||
seq.push_front(path_map[curr_father]);
|
assert(path_map.find(curr_father)
|
||||||
curr_father = path_map[curr_father];
|
!= path_map.end());
|
||||||
assert(h.find(curr_father) != h.end());
|
const state* f = path_map[curr_father];
|
||||||
|
seq.push_front(f);
|
||||||
|
curr_father = f;
|
||||||
|
i_2 = h.find(curr_father);
|
||||||
|
assert(i_2 != h.end());
|
||||||
}
|
}
|
||||||
vec_sequence[k] = seq;
|
vec_sequence[k] = seq;
|
||||||
seq.clear();
|
seq.clear();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue