Example #1
0
        public static void PrintToConsole(BTree <int> tree)
        {
            Console.WriteLine("\n\nPrinting to Console.");
            PrintParentIndetifier();
            ConsolePrinter     printer     = new ConsolePrinter();
            BTreePrinter <int> treePrinter = new BTreePrinter <int>(printer);

            treePrinter.PrintBTree(tree);
        }
Example #2
0
        public static void PrintToFile(BTree <int> tree)
        {
            Console.WriteLine("\n\nPrinting to file.");
            PrintParentIndetifier();
            string outPath = GetWorkingDirPath("output.txt");

            try
            {
                using (FilePrinter printer = new FilePrinter(outPath))
                {
                    BTreePrinter <int> treePrinter = new BTreePrinter <int>(printer);
                    treePrinter.PrintBTree(tree);
                    Console.WriteLine("Wrote to file at {0}", outPath);
                }
            }
            catch (Exception)
            {
                Console.WriteLine("Error writing to file, make sure the file {0} is available for writing.", outPath);
            }
        }
        public static void PrintToFile(BTree<int> tree)
        {
            Console.WriteLine("\n\nPrinting to file.");
            PrintParentIndetifier();
            string outPath = GetWorkingDirPath("output.txt");

            try
            {
                using (FilePrinter printer = new FilePrinter(outPath))
                {
                    BTreePrinter<int> treePrinter = new BTreePrinter<int>(printer);
                    treePrinter.PrintBTree(tree);
                    Console.WriteLine("Wrote to file at {0}", outPath);
                }
            }
            catch (Exception)
            {
                Console.WriteLine("Error writing to file, make sure the file {0} is available for writing.", outPath);
            }
        }
        public static void PrintToConsole(BTree<int> tree)
        {
            Console.WriteLine("\n\nPrinting to Console.");
            PrintParentIndetifier();
            ConsolePrinter printer = new ConsolePrinter();
            BTreePrinter<int> treePrinter = new BTreePrinter<int>(printer);

            treePrinter.PrintBTree(tree);
        }