コード例 #1
0
        /// <summary>Private recursion.</summary>
        private void VisitInPreOrder(IStateVisitor v, int node, BitArray visited)
        {
            if (visited.Get(node))
            {
                return;
            }
            visited.Set(node, true);

            if (v.Accept(node))
            {
                for (int arc = GetFirstArc(node); arc != 0; arc = GetNextArc(arc))
                {
                    if (!IsArcTerminal(arc))
                    {
                        VisitInPreOrder(v, GetEndNode(arc), visited);
                    }
                }
            }
        }
コード例 #2
0
        /// <summary>Private recursion.</summary>
        private bool VisitInPostOrder(IStateVisitor v, int node, BitArray visited)
        {
            if (visited.Get(node))
            {
                return(true);
            }
            visited.Set(node, true);

            for (int arc = GetFirstArc(node); arc != 0; arc = GetNextArc(arc))
            {
                if (!IsArcTerminal(arc))
                {
                    if (!VisitInPostOrder(v, GetEndNode(arc), visited))
                    {
                        return(false);
                    }
                }
            }

            return(v.Accept(node));
        }