{
if (end ())
{
- multipath_t new_prefix = prefix;
- new_prefix.update (rule);
- permutate_one (input, keys, new_prefix);
+ permutate_one (input, keys, prefix);
}
else if (loop < 2)
{
for (arcs_t::iterator i = arcs.begin (); i != arcs.end (); ++i)
{
multipath_t new_prefix = prefix;
- new_prefix.extend (rule, &i->second);
+ new_prefix.extend (i->first->rule, &i->second);
i->first->permutate (new_prefix, input, keys);
}
}
for (arcs_t::iterator i = arcs.begin (); i != arcs.end (); ++i)
{
multipath_t new_prefix = prefix;
- new_prefix.extend (rule, &i->second);
+ new_prefix.extend (i->first->rule, &i->second);
size = size + i->first->cover (new_prefix, input, keys);
if (size.overflow ())
{
}
if (i->first->suffix != NULL && suffix == NULL)
{
- suffix = new path_t;
- suffix->extend (rule, i->second[0]);
- suffix->append (i->first->suffix);
+ suffix = new path_t (rule);
+ suffix->append (i->second[0], i->first->suffix);
}
}
}
void Skeleton::generate_paths (uint32_t line, const std::string & cond, FILE * input, std::ofstream & keys)
{
- multipath_t prefix;
+ multipath_t prefix (nodes->rule);
if (nodes->sizeof_permutate (arccount_t (1u), arccount_t (0u)).overflow ())
{
if (nodes->cover (prefix, input, keys).overflow ())
size_t rule_pos;
public:
- generic_path_t ()
+ explicit generic_path_t (rule_rank_t r)
: arcs ()
- , rule (rule_rank_t::none ())
+ , rule (r)
, rule_pos (0)
{}
size_t len () const
{
return arcs[i];
}
- void update (rule_rank_t r)
+ void extend (rule_rank_t r, const arc_t & a)
{
+ arcs.push_back (a);
if (!r.is_none ())
{
rule = r;
rule_pos = arcs.size ();
}
}
- void extend (rule_rank_t r, arc_t a)
+ void append (const arc_t & a, const generic_path_t<arc_t> * p)
{
- update (r);
arcs.push_back (a);
- }
- void append (const generic_path_t<arc_t> * p)
- {
if (!p->rule.is_none ())
{
rule = p->rule;
rule_pos = arcs.size () + p->rule_pos;
}
- const size_t sz = p->arcs.size ();
- for (size_t i = 0; i < sz; ++i)
- {
- arcs.push_back (p->arcs[i]);
- }
+ arcs.insert (arcs.end (), p->arcs.begin (), p->arcs.end ());
}
};