Move helper functions from simplify.cc to the AST files.
* src/ltlvisit/simplify.cc (spot::ltl::is_And, spot::ltl::is_F, spot::ltl::is_FG, spot::ltl::is_G, spot::ltl::is_GF, spot::ltl::is_M, spot::ltl::is_Or, spot::ltl::is_R, spot::ltl::is_U, spot::ltl::is_W, spot::ltl::is_X, spot::ltl::is_binop, spot::ltl::is_constant, spot::ltl::is_multop, spot::ltl::is_unop): Move ... * src/ltlast/binop.hh, src/ltlast/constant.hh, src/ltlast/multop.hh src/ltlast/unop.hh: ... here, as appropriate.
This commit is contained in:
parent
aa4b68fcfc
commit
5e7c0add49
5 changed files with 254 additions and 147 deletions
|
|
@ -664,126 +664,8 @@ namespace spot
|
|||
formula*
|
||||
simplify_recursively(const formula* f, ltl_simplifier_cache* c);
|
||||
|
||||
constant*
|
||||
is_constant(formula* f)
|
||||
{
|
||||
if (f->kind() != formula::Constant)
|
||||
return 0;
|
||||
return static_cast<constant*>(f);
|
||||
}
|
||||
|
||||
|
||||
unop*
|
||||
is_unop(formula* f)
|
||||
{
|
||||
if (f->kind() != formula::UnOp)
|
||||
return 0;
|
||||
return static_cast<unop*>(f);
|
||||
}
|
||||
|
||||
unop*
|
||||
is_unop(formula* f, unop::type op)
|
||||
{
|
||||
if (f->kind() != formula::UnOp)
|
||||
return 0;
|
||||
unop* uo = static_cast<unop*>(f);
|
||||
if (uo->op() != op)
|
||||
return 0;
|
||||
return uo;
|
||||
}
|
||||
|
||||
unop*
|
||||
is_X(formula* f)
|
||||
{
|
||||
return is_unop(f, unop::X);
|
||||
}
|
||||
|
||||
unop*
|
||||
is_F(formula* f)
|
||||
{
|
||||
return is_unop(f, unop::F);
|
||||
}
|
||||
|
||||
unop*
|
||||
is_G(formula* f)
|
||||
{
|
||||
return is_unop(f, unop::G);
|
||||
}
|
||||
|
||||
unop*
|
||||
is_GF(formula* f)
|
||||
{
|
||||
unop* op = is_G(f);
|
||||
if (!op)
|
||||
return 0;
|
||||
return is_F(op->child());
|
||||
}
|
||||
|
||||
unop*
|
||||
is_FG(formula* f)
|
||||
{
|
||||
unop* op = is_F(f);
|
||||
if (!op)
|
||||
return 0;
|
||||
return is_G(op->child());
|
||||
}
|
||||
|
||||
binop*
|
||||
is_binop(formula* f)
|
||||
{
|
||||
if (f->kind() != formula::BinOp)
|
||||
return 0;
|
||||
return static_cast<binop*>(f);
|
||||
}
|
||||
|
||||
binop*
|
||||
is_binop(formula* f, binop::type op)
|
||||
{
|
||||
if (f->kind() != formula::BinOp)
|
||||
return 0;
|
||||
binop* bo = static_cast<binop*>(f);
|
||||
if (bo->op() != op)
|
||||
return 0;
|
||||
return bo;
|
||||
}
|
||||
|
||||
// Same with two choices.
|
||||
binop*
|
||||
is_binop(formula* f, binop::type op1, binop::type op2)
|
||||
{
|
||||
if (f->kind() != formula::BinOp)
|
||||
return 0;
|
||||
binop* bo = static_cast<binop*>(f);
|
||||
binop::type op = bo->op();
|
||||
if (op == op1 || op == op2)
|
||||
return bo;
|
||||
return 0;
|
||||
}
|
||||
|
||||
binop*
|
||||
is_U(formula* f)
|
||||
{
|
||||
return is_binop(f, binop::U);
|
||||
}
|
||||
|
||||
binop*
|
||||
is_M(formula* f)
|
||||
{
|
||||
return is_binop(f, binop::M);
|
||||
}
|
||||
|
||||
binop*
|
||||
is_R(formula* f)
|
||||
{
|
||||
return is_binop(f, binop::R);
|
||||
}
|
||||
|
||||
binop*
|
||||
is_W(formula* f)
|
||||
{
|
||||
return is_binop(f, binop::W);
|
||||
}
|
||||
|
||||
// X(a) R b or X(a) M b
|
||||
// This returns a.
|
||||
formula*
|
||||
|
|
@ -812,29 +694,6 @@ namespace spot
|
|||
return uo->child();
|
||||
}
|
||||
|
||||
multop*
|
||||
is_multop(formula* f, multop::type op)
|
||||
{
|
||||
if (f->kind() != formula::MultOp)
|
||||
return 0;
|
||||
multop* mo = static_cast<multop*>(f);
|
||||
if (mo->op() != op)
|
||||
return 0;
|
||||
return mo;
|
||||
}
|
||||
|
||||
multop*
|
||||
is_And(formula* f)
|
||||
{
|
||||
return is_multop(f, multop::And);
|
||||
}
|
||||
|
||||
multop*
|
||||
is_Or(formula* f)
|
||||
{
|
||||
return is_multop(f, multop::Or);
|
||||
}
|
||||
|
||||
// b & X(b W a) or b & X(b U a)
|
||||
// This returns (b W a) or (b U a).
|
||||
binop*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue