Sort comutative binops like we sort multops.

* src/ltlast/formula.hh (is_literal): Rename as...
(get_literal): ... this.
(is_literal): New method.
(formula_ptr_less_than_multop): Rename as...
(formula_ptr_less_than_bool_first): ... this.
* src/ltlast/binop.cc: Use formula_ptr_less_than_bool_first.
* src/ltlast/multop.cc, src/ltlast/formula.cc: Adjust
to renamings.
This commit is contained in:
Alexandre Duret-Lutz 2013-09-29 20:58:19 +02:00
parent 228121c963
commit c01909e3ff
4 changed files with 45 additions and 22 deletions

View file

@ -167,6 +167,8 @@ namespace spot
*width = s;
if (!s)
return 0;
if (s == 1)
return nth(0)->clone();
vec* v = new vec(children_->begin(),
children_->begin() + s);
for (unsigned n = 0; n < s; ++n)
@ -277,7 +279,7 @@ namespace spot
i = v->erase(i);
continue;
}
// All operator except "Concat" and "Fusion" are
// All operators except "Concat" and "Fusion" are
// commutative, so we just keep a list of the inlined
// arguments that should later be added to the vector.
// For concat we have to keep track of the order of
@ -293,7 +295,7 @@ namespace spot
}
if (op != Concat && op != Fusion)
std::sort(v->begin(), v->end(), formula_ptr_less_than_multop());
std::sort(v->begin(), v->end(), formula_ptr_less_than_bool_first());
unsigned orig_size = v->size();