Use downcast when appropriate.
* src/taalgos/sba2ta.cc, src/ta/ta.cc, src/ta/taexplicit.cc, src/ta/taproduct.cc, src/taalgos/emptinessta.cc: Use downcast and cleanup whitespace.
This commit is contained in:
parent
bf01501e15
commit
c774ba141d
5 changed files with 684 additions and 678 deletions
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2010 Laboratoire de Recherche et Developpement
|
||||
// Copyright (C) 2010, 2011 Laboratoire de Recherche et Developpement
|
||||
// de l Epita (LRDE).
|
||||
//
|
||||
// This file is part of Spot, a model checking library.
|
||||
|
|
@ -78,5 +78,3 @@ namespace spot
|
|||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2010 Laboratoire de Recherche et Developpement
|
||||
// Copyright (C) 2010, 2011 Laboratoire de Recherche et Developpement
|
||||
// de l Epita (LRDE).
|
||||
//
|
||||
// This file is part of Spot, a model checking library.
|
||||
|
|
@ -188,7 +188,7 @@ namespace spot
|
|||
int
|
||||
state_ta_explicit::compare(const spot::state* other) const
|
||||
{
|
||||
const state_ta_explicit* o = dynamic_cast<const state_ta_explicit*> (other);
|
||||
const state_ta_explicit* o = down_cast<const state_ta_explicit*> (other);
|
||||
assert(o);
|
||||
|
||||
int compare_value = tgba_state_->compare(o->tgba_state_);
|
||||
|
|
@ -293,7 +293,7 @@ namespace spot
|
|||
ta::states_set_t::iterator it;
|
||||
for (it = states_set_.begin(); it != states_set_.end(); it++)
|
||||
{
|
||||
state_ta_explicit* s = dynamic_cast<state_ta_explicit*> (*it);
|
||||
state_ta_explicit* s = down_cast<state_ta_explicit*> (*it);
|
||||
|
||||
s->free_transitions();
|
||||
delete s;
|
||||
|
|
@ -308,15 +308,15 @@ namespace spot
|
|||
std::pair<ta::states_set_t::iterator, bool> add_state_to_ta =
|
||||
states_set_.insert(s);
|
||||
|
||||
return dynamic_cast<state_ta_explicit*> (*add_state_to_ta.first);
|
||||
return static_cast<state_ta_explicit*> (*add_state_to_ta.first);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
ta_explicit::add_to_initial_states_set(state* state)
|
||||
{
|
||||
state_ta_explicit * s = dynamic_cast<state_ta_explicit*> (state);
|
||||
|
||||
state_ta_explicit * s = down_cast<state_ta_explicit*> (state);
|
||||
assert(s);
|
||||
s->set_initial_state(true);
|
||||
|
||||
initial_states_set_.insert(s);
|
||||
|
|
@ -326,7 +326,8 @@ namespace spot
|
|||
void
|
||||
ta_explicit::delete_stuttering_and_hole_successors(spot::state* s)
|
||||
{
|
||||
state_ta_explicit * state = dynamic_cast<state_ta_explicit*> (s);
|
||||
state_ta_explicit * state = down_cast<state_ta_explicit*> (s);
|
||||
assert(state);
|
||||
state->delete_stuttering_and_hole_successors();
|
||||
if (state->is_initial_state()) add_to_initial_states_set(state);
|
||||
|
||||
|
|
@ -354,35 +355,39 @@ namespace spot
|
|||
ta_explicit::get_state_condition(const spot::state* initial_state) const
|
||||
{
|
||||
const state_ta_explicit* sta =
|
||||
dynamic_cast<const state_ta_explicit*> (initial_state);
|
||||
down_cast<const state_ta_explicit*> (initial_state);
|
||||
assert(sta);
|
||||
return sta->get_tgba_condition();
|
||||
}
|
||||
|
||||
bool
|
||||
ta_explicit::is_accepting_state(const spot::state* s) const
|
||||
{
|
||||
const state_ta_explicit* sta = dynamic_cast<const state_ta_explicit*> (s);
|
||||
const state_ta_explicit* sta = down_cast<const state_ta_explicit*> (s);
|
||||
assert(sta);
|
||||
return sta->is_accepting_state();
|
||||
}
|
||||
|
||||
bool
|
||||
ta_explicit::is_initial_state(const spot::state* s) const
|
||||
{
|
||||
const state_ta_explicit* sta = dynamic_cast<const state_ta_explicit*> (s);
|
||||
const state_ta_explicit* sta = down_cast<const state_ta_explicit*> (s);
|
||||
assert(sta);
|
||||
return sta->is_initial_state();
|
||||
}
|
||||
|
||||
bool
|
||||
ta_explicit::is_livelock_accepting_state(const spot::state* s) const
|
||||
{
|
||||
const state_ta_explicit* sta = dynamic_cast<const state_ta_explicit*> (s);
|
||||
const state_ta_explicit* sta = down_cast<const state_ta_explicit*> (s);
|
||||
assert(sta);
|
||||
return sta->is_livelock_accepting_state();
|
||||
}
|
||||
|
||||
ta_succ_iterator*
|
||||
ta_explicit::succ_iter(const spot::state* state) const
|
||||
{
|
||||
const state_ta_explicit* s = dynamic_cast<const state_ta_explicit*> (state);
|
||||
const state_ta_explicit* s = down_cast<const state_ta_explicit*> (state);
|
||||
assert(s);
|
||||
return new ta_explicit_succ_iterator(s);
|
||||
}
|
||||
|
|
@ -390,7 +395,7 @@ namespace spot
|
|||
ta_succ_iterator*
|
||||
ta_explicit::succ_iter(const spot::state* state, bdd condition) const
|
||||
{
|
||||
const state_ta_explicit* s = dynamic_cast<const state_ta_explicit*> (state);
|
||||
const state_ta_explicit* s = down_cast<const state_ta_explicit*> (state);
|
||||
assert(s);
|
||||
return new ta_explicit_succ_iterator(s, condition);
|
||||
}
|
||||
|
|
@ -410,7 +415,7 @@ namespace spot
|
|||
std::string
|
||||
ta_explicit::format_state(const spot::state* s) const
|
||||
{
|
||||
const state_ta_explicit* sta = dynamic_cast<const state_ta_explicit*> (s);
|
||||
const state_ta_explicit* sta = down_cast<const state_ta_explicit*> (s);
|
||||
assert(sta);
|
||||
|
||||
if (sta->get_tgba_condition() == bddtrue)
|
||||
|
|
@ -429,7 +434,7 @@ namespace spot
|
|||
{
|
||||
|
||||
const state_ta_explicit* source =
|
||||
dynamic_cast<const state_ta_explicit*> (*it);
|
||||
static_cast<const state_ta_explicit*> (*it);
|
||||
|
||||
state_ta_explicit::transitions* trans = source->get_transitions();
|
||||
state_ta_explicit::transitions::iterator it_trans;
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ namespace spot
|
|||
int
|
||||
state_ta_product::compare(const state* other) const
|
||||
{
|
||||
const state_ta_product* o = dynamic_cast<const state_ta_product*> (other);
|
||||
const state_ta_product* o = down_cast<const state_ta_product*> (other);
|
||||
assert(o);
|
||||
int res = ta_state_->compare(o->get_ta_state());
|
||||
if (res != 0)
|
||||
|
|
@ -274,7 +274,7 @@ namespace spot
|
|||
ta_succ_iterator_product*
|
||||
ta_product::succ_iter(const state* s) const
|
||||
{
|
||||
const state_ta_product* stp = dynamic_cast<const state_ta_product*> (s);
|
||||
const state_ta_product* stp = down_cast<const state_ta_product*> (s);
|
||||
assert(s);
|
||||
|
||||
return new ta_succ_iterator_product(stp, ta_, kripke_);
|
||||
|
|
@ -289,7 +289,7 @@ namespace spot
|
|||
std::string
|
||||
ta_product::format_state(const state* state) const
|
||||
{
|
||||
const state_ta_product* s = dynamic_cast<const state_ta_product*> (state);
|
||||
const state_ta_product* s = down_cast<const state_ta_product*> (state);
|
||||
assert(s);
|
||||
return kripke_->format_state(s->get_kripke_state()) + " * \n"
|
||||
+ ta_->format_state(s->get_ta_state());
|
||||
|
|
@ -298,7 +298,8 @@ namespace spot
|
|||
bool
|
||||
ta_product::is_accepting_state(const spot::state* s) const
|
||||
{
|
||||
const state_ta_product* stp = dynamic_cast<const state_ta_product*> (s);
|
||||
const state_ta_product* stp = down_cast<const state_ta_product*> (s);
|
||||
assert(stp);
|
||||
|
||||
return ta_->is_accepting_state(stp->get_ta_state());
|
||||
}
|
||||
|
|
@ -306,7 +307,8 @@ namespace spot
|
|||
bool
|
||||
ta_product::is_livelock_accepting_state(const spot::state* s) const
|
||||
{
|
||||
const state_ta_product* stp = dynamic_cast<const state_ta_product*> (s);
|
||||
const state_ta_product* stp = down_cast<const state_ta_product*> (s);
|
||||
assert(stp);
|
||||
|
||||
return ta_->is_livelock_accepting_state(stp->get_ta_state());
|
||||
}
|
||||
|
|
@ -314,7 +316,8 @@ namespace spot
|
|||
bool
|
||||
ta_product::is_initial_state(const spot::state* s) const
|
||||
{
|
||||
const state_ta_product* stp = dynamic_cast<const state_ta_product*> (s);
|
||||
const state_ta_product* stp = down_cast<const state_ta_product*> (s);
|
||||
assert(stp);
|
||||
|
||||
state* ta_s = stp->get_ta_state();
|
||||
state* kr_s = stp->get_kripke_state();
|
||||
|
|
@ -328,7 +331,8 @@ namespace spot
|
|||
bdd
|
||||
ta_product::get_state_condition(const spot::state* s) const
|
||||
{
|
||||
const state_ta_product* stp = dynamic_cast<const state_ta_product*> (s);
|
||||
const state_ta_product* stp = down_cast<const state_ta_product*> (s);
|
||||
assert(stp);
|
||||
state* ta_s = stp->get_ta_state();
|
||||
return ta_->get_state_condition(ta_s);
|
||||
}
|
||||
|
|
@ -337,7 +341,8 @@ namespace spot
|
|||
ta_product::free_state(const spot::state* s) const
|
||||
{
|
||||
|
||||
const state_ta_product* stp = dynamic_cast<const state_ta_product*> (s);
|
||||
const state_ta_product* stp = down_cast<const state_ta_product*> (s);
|
||||
assert(stp);
|
||||
ta_->free_state(stp->get_ta_state());
|
||||
delete stp;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
// Copyright (C) 2008 Laboratoire de Recherche et Développement
|
||||
// Copyright (C) 2010, 2011 Laboratoire de Recherche et Développement
|
||||
// de l'Epita (LRDE).
|
||||
// Copyright (C) 2003, 2004, 2005, 2006 Laboratoire d'Informatique de
|
||||
// Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
|
||||
// Université Pierre et Marie Curie.
|
||||
//
|
||||
// This file is part of Spot, a model checking library.
|
||||
//
|
||||
|
|
@ -103,7 +100,7 @@ namespace spot
|
|||
// Setup depth-first search from initial states.
|
||||
|
||||
{
|
||||
state* init = dynamic_cast<state*> (init_set.top());
|
||||
state* init = init_set.top();
|
||||
init_set.pop();
|
||||
|
||||
numbered_state_heap::state_index_p h_init = h->find(init);
|
||||
|
|
|
|||
|
|
@ -305,7 +305,8 @@ namespace spot
|
|||
if (!curr->compare(dest))
|
||||
{
|
||||
state_ta_explicit * self_loop_state =
|
||||
dynamic_cast<state_ta_explicit*> (curr);
|
||||
down_cast<state_ta_explicit*> (curr);
|
||||
assert(self_loop_state);
|
||||
|
||||
if (testing_automata->is_accepting_state(self_loop_state))
|
||||
self_loop_state->set_livelock_accepting_state(true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue