Beispiel #1
0
        /**
         * Print the subtree rooted at node *top to the output stream
         * @param out the output stream
         * @param prefix the number of spaces ' ' in front of each node
         * @param top the current tree sub root
         */
        public string printSubTree(int prefix, SafraTreeNode top)
        {
            string returnString = "";

            for (int i = 0; i < prefix; i++)
            {
                returnString += " ";
            }
            returnString += top.ToString() + "\r\n";

            //for (SafraTreeNode::child_iterator it=top->children_begin();
            // it!=top->children_end();
            // ++it) {
            //  printSubTree(out, prefix+1, *it);
            //}

            SafraTreeNode it = top.children_begin();

            while (it != top.children_end())
            {
                printSubTree(prefix + 1, it);

                it = it.increment();
            }
            return(returnString);
        }
Beispiel #2
0
        /**
          * Print the subtree rooted at node *top to the output stream
          * @param out the output stream
          * @param prefix the number of spaces ' ' in front of each node
          * @param top the current tree sub root
          */
        public string printSubTree(int prefix, SafraTreeNode top)
        {
            string returnString = "";
            for (int i = 0; i < prefix; i++)
            {
                returnString += " ";
            }
            returnString += top.ToString() + "\r\n";

            //for (SafraTreeNode::child_iterator it=top->children_begin();
            // it!=top->children_end();
            // ++it) {
            //  printSubTree(out, prefix+1, *it);
            //}

            SafraTreeNode it = top.children_begin();
            while (it != top.children_end())
            {
                printSubTree(prefix + 1, it);

                it = it.increment();
            }
            return returnString;
        }