Exemplo n.º 1
0
        private void BuildPath(List <IStatementList> paths, IStatementList path, Statement lastElement)
        {
            Statement element = path.GetSize() > 0 ? path.GetLast() : lastElement;

            if (path.GetSize() == 0 || element != lastElement)
            {
                IStatementList nexting = GetNext(element);
                if (nexting.GetSize() > 0)
                {
                    if (nexting.GetLast() != nexting.GetFirst())
                    {
                        IStatementList newPath = path.Copy();
                        newPath.AddStatement(nexting.GetLast());
                        BuildPath(paths, newPath, element);
                    }
                    path.AddStatement(nexting.GetFirst());
                    BuildPath(paths, path, element);
                }
                else
                {
                    paths.Add(path);
                }
            }
            else
            {
                paths.Add(path);
            }
        }