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

* src/ltlvisit/length.cc (length_visitor): Rewrite using

postfix_visitor.
parent dd1bc787
2005-02-23 Alexandre Duret-Lutz <adl@src.lip6.fr>
* src/ltlvisit/length.cc (length_visitor): Rewrite using
postfix_visitor.
2005-02-22 Alexandre Duret-Lutz <adl@src.lip6.fr>
* src/tgbaalgos/tau03opt.cc (tau03_opt_search): Add options "weights"
......
......@@ -20,8 +20,7 @@
// 02111-1307, USA.
#include "length.hh"
#include "ltlast/allnodes.hh"
#include "ltlast/visitor.hh"
#include "ltlvisit/postfix.hh"
namespace spot
{
......@@ -29,17 +28,11 @@ namespace spot
{
namespace
{
class length_visitor: public const_visitor
class length_visitor: public postfix_visitor
{
public:
length_visitor()
{
result_ = 0;
}
virtual
~length_visitor()
: result_(0)
{
}
......@@ -49,37 +42,10 @@ namespace spot
return result_;
}
void
visit(const atomic_prop*)
{
result_ = 1;
}
void
visit(const constant*)
{
result_ = 1;
}
void
visit(const unop* uo)
{
result_ = 1 + length(uo->child());
}
void
visit(const binop* bo)
{
result_ = 1 + length(bo->first()) + length(bo->second());
}
void
visit(const multop* mo)
virtual void
doit_default(formula*)
{
unsigned mos = mo->size();
++result_;
for (unsigned i = 0; i < mos; ++i)
result_ += length(mo->nth(i));
}
protected:
......
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