Commit 6f500f3f authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

twa: forward num_sets() to acc_.

* src/twa/twa.hh (num_sets): New method.  Delegating to acc_.
* src/twa/twagraph.hh, src/twa/twaproduct.cc, src/twa/twaproxy.cc,
src/twaalgos/degen.cc, src/twaalgos/dot.cc, src/twaalgos/dtgbacomp.cc,
src/twaalgos/dtgbasat.cc, src/twaalgos/gv04.cc, src/twaalgos/hoa.cc,
src/twaalgos/lbtt.cc, src/twaalgos/magic.cc, src/twaalgos/mask.cc,
src/twaalgos/ndfs_result.hxx, src/twaalgos/postproc.cc,
src/twaalgos/powerset.cc, src/twaalgos/product.cc,
src/twaalgos/remfin.cc, src/twaalgos/se05.cc,
src/twaalgos/simulation.cc, src/twaalgos/stats.cc,
src/twaalgos/stutter.cc, src/twaalgos/tau03.cc,
src/twaalgos/tau03opt.cc, src/twaalgos/totgba.cc: Simplify
acc().num_sets() into num_sets().
parent a86391ab
......@@ -658,6 +658,11 @@ namespace spot
}
public:
unsigned num_sets() const
{
return acc_.num_sets();
}
const acc_cond::acc_code& get_acceptance() const
{
return acc_.get_acceptance();
......
......@@ -438,7 +438,7 @@ namespace spot
acc_cond::mark_t state_acc_sets(unsigned s) const
{
assert(has_state_based_acc() || acc_.num_sets() == 0);
assert(has_state_based_acc() || num_sets() == 0);
for (auto& t: g_.out(s))
// Stop at the first transition, since the remaining should be
// labeled identically.
......@@ -448,7 +448,7 @@ namespace spot
bool state_is_accepting(unsigned s) const
{
assert(has_state_based_acc() || acc_.num_sets() == 0);
assert(has_state_based_acc() || num_sets() == 0);
for (auto& t: g_.out(s))
// Stop at the first transition, since the remaining should be
// labeled identically.
......@@ -465,7 +465,7 @@ namespace spot
{
if (num_states() != aut.num_states() ||
num_transitions() != aut.num_transitions() ||
acc().num_sets() != aut.acc().num_sets())
num_sets() != aut.num_sets())
return false;
auto& trans1 = transition_vector();
auto& trans2 = aut.transition_vector();
......
......@@ -310,12 +310,12 @@ namespace spot
d->register_all_propositions_of(&left_, this);
d->register_all_propositions_of(&right_, this);
assert(acc_.num_sets() == 0);
auto left_num = left->acc().num_sets();
assert(num_sets() == 0);
auto left_num = left->num_sets();
auto right_acc = right->get_acceptance();
right_acc.shift_left(left_num);
right_acc.append_and(left->get_acceptance());
set_acceptance(left_num + right->acc().num_sets(), right_acc);
set_acceptance(left_num + right->num_sets(), right_acc);
}
twa_product::~twa_product()
......
......@@ -25,7 +25,7 @@ namespace spot
: twa(original->get_dict()), original_(original)
{
get_dict()->register_all_variables_of(original, this);
acc_.add_sets(original->acc().num_sets());
acc_.add_sets(original->num_sets());
}
twa_proxy::~twa_proxy()
......
......@@ -226,7 +226,7 @@ namespace spot
// used in the automaton. (This surprising fact is probably
// related to the order in which we declare the BDD variables
// during the translation.)
unsigned n = a->acc().num_sets();
unsigned n = a->num_sets();
for (unsigned i = n; i > 0; --i)
order.push_back(i - 1);
}
......
......@@ -277,7 +277,7 @@ namespace spot
if (opt_html_labels_)
std::tie(inf_sets_, fin_sets_) =
aut_->get_acceptance().used_inf_fin_sets();
if (opt_bullet && aut_->acc().num_sets() <= MAX_BULLET)
if (opt_bullet && aut_->num_sets() <= MAX_BULLET)
opt_all_bullets = true;
os_ << "digraph G {\n";
if (opt_horizontal_)
......@@ -366,7 +366,7 @@ namespace spot
{
if (mark_states_ &&
((opt_bullet && !opt_bullet_but_buchi)
|| aut_->acc().num_sets() != 1))
|| aut_->num_sets() != 1))
{
acc_cond::mark_t acc = 0U;
for (auto& t: aut_->out(s))
......
......@@ -174,7 +174,7 @@ namespace spot
// Simply complete the automaton, and complement its
// acceptance.
auto res = cleanup_acceptance_here(tgba_complete(aut));
res->set_acceptance(res->acc().num_sets(),
res->set_acceptance(res->num_sets(),
res->get_acceptance().complement());
return res;
}
......
......@@ -472,7 +472,7 @@ namespace spot
}
d.all_ref_acc.push_back(0U);
unsigned ref_nacc = aut->acc().num_sets();
unsigned ref_nacc = aut->num_sets();
for (unsigned n = 0; n < ref_nacc; ++n)
{
auto c = aut->acc().mark(n);
......@@ -1233,7 +1233,7 @@ namespace spot
// Assume we are going to use the input automaton acceptance...
bool user_supplied_acc = false;
acc_cond::acc_code target_acc = a->get_acceptance();
int nacc = a->acc().num_sets();
int nacc = a->num_sets();
if (accstr == "same")
accstr.clear();
......
......@@ -70,7 +70,7 @@ namespace spot
gv04(const const_twa_ptr& a, option_map o)
: emptiness_check(a, o)
{
assert(a->acc().num_sets() <= 1);
assert(a->num_sets() <= 1);
}
~gv04()
......@@ -383,7 +383,7 @@ namespace spot
const state* bfs_start = data.stack[scc_root].s;
const state* bfs_end = bfs_start;
if (a_->acc().num_sets() > 0)
if (a_->num_sets() > 0)
{
first_bfs b1(this, scc_root);
bfs_start = b1.search(bfs_start, res->cycle);
......
......@@ -97,7 +97,7 @@ namespace spot
bool complete = true;
bool state_acc = true;
bool nodeadend = true;
bool colored = aut->acc().num_sets() >= 1;
bool colored = aut->num_sets() >= 1;
for (unsigned src = 0; src < ns; ++src)
{
bdd sum = bddfalse;
......@@ -296,7 +296,7 @@ namespace spot
}
os << nl;
unsigned num_acc = aut->acc().num_sets();
unsigned num_acc = aut->num_sets();
acc_cond::acc_code acc_c = aut->acc().get_acceptance();
if (aut->acc().is_generalized_buchi())
{
......
......@@ -115,9 +115,9 @@ namespace spot
{
os_ << seen.size() << ' ';
if (sba_format_)
os_ << aut_->acc().num_sets();
os_ << aut_->num_sets();
else
os_ << aut_->acc().num_sets() << 't';
os_ << aut_->num_sets() << 't';
os_ << '\n' << body_.str() << "-1" << std::endl;
}
......
......@@ -59,7 +59,7 @@ namespace spot
: emptiness_check(a, o),
h(size)
{
assert(a->acc().num_sets() <= 1);
assert(a->num_sets() <= 1);
}
virtual ~magic_search_()
......
......@@ -27,7 +27,7 @@ namespace spot
auto res = make_twa_graph(in->get_dict());
res->copy_ap_of(in);
res->prop_copy(in, { true, true, true, false });
unsigned na = in->acc().num_sets();
unsigned na = in->num_sets();
unsigned tr = to_remove.count();
assert(tr <= na);
res->set_acceptance(na - tr,
......
......@@ -119,7 +119,7 @@ namespace spot
start = stb.front().s->clone();
if (!str.empty())
{
if (a_->acc().num_sets() == 0)
if (a_->num_sets() == 0)
{
// take arbitrarily the last transition on the red stack
stack_type::const_iterator i, j;
......
......@@ -41,7 +41,7 @@ namespace spot
static twa_graph_ptr
ensure_ba(twa_graph_ptr& a)
{
if (a->acc().num_sets() == 0)
if (a->num_sets() == 0)
{
auto m = a->set_buchi();
for (auto& t: a->transitions())
......@@ -153,7 +153,7 @@ namespace spot
if (type_ == Generic
|| type_ == TGBA
|| (type_ == BA && a->is_sba())
|| (type_ == Monitor && a->acc().num_sets() == 0))
|| (type_ == Monitor && a->num_sets() == 0))
{
if (COMP_)
a = tgba_complete(a);
......@@ -171,7 +171,7 @@ namespace spot
if (type_ == BA || SBACC_)
state_based_ = true;
int original_acc = a->acc().num_sets();
int original_acc = a->num_sets();
// Remove useless SCCs.
if (type_ == Monitor)
......@@ -301,7 +301,7 @@ namespace spot
if (PREF_ == Deterministic
&& f
&& f->is_syntactic_recurrence()
&& sim->acc().num_sets() > 1)
&& sim->num_sets() > 1)
tmpd = degeneralize_tba(sim);
auto in = tmpd ? tmpd : sim;
......@@ -370,7 +370,7 @@ namespace spot
// because the input TBA might be smaller.
if (state_based_)
in = degeneralize(dba);
else if (dba->acc().num_sets() != 1)
else if (dba->num_sets() != 1)
in = degeneralize_tba(dba);
else
in = dba;
......@@ -423,7 +423,7 @@ namespace spot
// Degeneralize the dba resulting from tba-determinization or
// sat-minimization (which is a TBA) if requested and needed.
if (dba && !dba_is_wdba && type_ == BA
&& !(dba_is_minimal && state_based_ && dba->acc().num_sets() == 1))
&& !(dba_is_minimal && state_based_ && dba->num_sets() == 1))
dba = degeneralize(dba);
if (dba && sim)
......
......@@ -410,7 +410,7 @@ namespace spot
{
if (f == 0 && neg_aut == 0)
return 0;
if (aut->acc().num_sets() > 1)
if (aut->num_sets() > 1)
return 0;
auto det = tba_determinize(aut, threshold_states, threshold_cycles);
......
......@@ -52,11 +52,11 @@ namespace spot
auto res = make_twa_graph(left->get_dict());
res->copy_ap_of(left);
res->copy_ap_of(right);
auto left_num = left->acc().num_sets();
auto left_num = left->num_sets();
auto right_acc = right->get_acceptance();
right_acc.shift_left(left_num);
right_acc.append_and(left->get_acceptance());
res->set_acceptance(left_num + right->acc().num_sets(), right_acc);
res->set_acceptance(left_num + right->num_sets(), right_acc);
auto v = new product_states;
res->set_named_prop("product-states", v);
......
......@@ -264,7 +264,7 @@ namespace spot
res->copy_ap_of(aut);
res->prop_copy(aut, { false, false, false, true });
res->new_states(nst);
res->set_acceptance(aut->acc().num_sets() + extra_sets, new_code);
res->set_acceptance(aut->num_sets() + extra_sets, new_code);
res->set_init_state(aut->get_init_state_number());
unsigned nscc = si.scc_count();
......
......@@ -59,7 +59,7 @@ namespace spot
: emptiness_check(a, o),
h(size)
{
assert(a->acc().num_sets() <= 1);
assert(a->num_sets() <= 1);
}
virtual ~se05_search()
......
......@@ -258,7 +258,7 @@ namespace spot
unsigned set_num = a_->get_dict()
->register_anonymous_variables(size_a_ + 1, this);
unsigned n_acc = a_->acc().num_sets();
unsigned n_acc = a_->num_sets();
acc_vars = a_->get_dict()
->register_anonymous_variables(n_acc, this);
......
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