コード例 #1
0
        static void Main(string[] args)
        {
            Console.Write("\n  Demonstrating Parser");
            Console.Write("\n ======================\n");

            TestParser.ShowCommandLine(args);

            List <string> files = TestParser.ProcessCommandline(args);
            Repository    repo  = new Repository();

            repo.semi = Factory.create();

            typeAnalyzer(repo, files, args);

            Console.Write("\n\n  Type and Dependency Analysis");
            Console.Write("\n ----------------------------");

            TypeTable table = repo.typeTable;

            Display.showTypeTable(table);

            DepAnalyzer(repo, files, args);

            Console.Write("\n\nDependency Analysis:");
            Display.showDependency(repo.depGraph);

            Console.Write("\n");
            var strongComponents = TarjanSccSolver.DetectCycle(repo.depGraph);

            Display.showStrongComponents(strongComponents);

            Console.Write("\n\n");
        }
コード例 #2
0
        //---------< Execute dependency analysis >-----------------------------------------
        static void Main(string[] args)
        {
            bool optionDA            = Boolean.Parse(args[1]);
            bool optionSC            = Boolean.Parse(args[2]);
            bool optionFileRecursion = Boolean.Parse(args[3]);

            using (StreamWriter streamWriter = new StreamWriter(resultFilePath))
            {
                streamWriter.WriteLine("Processing path: {0}", args[0]);

                List <string> files = ProcessCommandline(args, optionFileRecursion);
                Repository    repo  = new Repository();
                repo.semi = Factory.create();
                BuildTypeTable(args, files, repo);
                depAnalysis(args, files, repo);
                if (optionDA)
                {
                    showDependency(repo.depGraph, streamWriter);
                    streamWriter.WriteLine("");
                }

                if (optionSC)
                {
                    var strongComponents = TarjanSccSolver.DetectCycle(repo.depGraph);
                    showStrongComponents(strongComponents, streamWriter);
                }
            }

            //Console.Read();
        }
コード例 #3
0
        public bool doTest()
        {
            Console.WriteLine();
            ReqDisplay.title("Req #8 - An automated unit test suite");
            ReqDisplay.message(message);
            string[] args = new string[] { "../../../DemoExecutive/SpecialTestCases/" };
            DemoExecutive.ShowCommandLine(args);
            List <string> files = DemoExecutive.ProcessCommandline(args);
            Repository    repo  = new Repository();

            repo.semi = Factory.create();
            DemoExecutive.BuildTypeTable(args, files, repo);
            Display.showTypeTable(repo.typeTable);
            Console.WriteLine();
            Display.showAliasTable(repo.aliasTable);
            Console.WriteLine();
            DemoExecutive.depAnalysis(args, files, repo);
            Console.Write("\n\nDependency Analysis:");
            Display.showDependency(repo.depGraph);
            Console.Write("\n");
            var strongComponents = TarjanSccSolver.DetectCycle(repo.depGraph);

            Display.showStrongComponents(strongComponents);
            return(true);
        }
コード例 #4
0
        public bool doTest()
        {
            Console.WriteLine();
            ReqDisplay.title("Req #6 - Find all strong components in the file collection");
            ReqDisplay.message("- In this program, Tarjan Algorithm is used to solve strong components.");

            string[] args = new string[] { "../../../DemoExecutive/Test/" };
            DemoExecutive.ShowCommandLine(args);
            List <string> files = DemoExecutive.ProcessCommandline(args);

            Repository repo = new Repository();

            repo.semi = Factory.create();

            BuildTypeAnalyzer builder = new BuildTypeAnalyzer(repo);
            Parser            parser  = builder.build();

            DemoExecutive.BuildTypeTable(args, files, repo);
            DemoExecutive.depAnalysis(args, files, repo);

            Console.Write("\n\nDependency Analysis:");
            Display.showDependency(repo.depGraph);

            Console.Write("\n");
            var strongComponents = TarjanSccSolver.DetectCycle(repo.depGraph);

            Display.showStrongComponents(strongComponents);

            return(true);
        }
        public static void Main(string[] args)
        {
            CsGraph <FileNode, string> graph = new CsGraph <FileNode, string>("DepGraph");
            FileNode fileNode1 = new FileNode();

            fileNode1.fileName = "F1";
            FileNode fileNode2 = new FileNode();

            fileNode2.fileName = "F2";
            FileNode fileNode3 = new FileNode();

            fileNode3.fileName = "F3";
            FileNode fileNode4 = new FileNode();

            fileNode4.fileName = "F4";
            FileNode fileNode5 = new FileNode();

            fileNode5.fileName = "F5";
            FileNode fileNode6 = new FileNode();

            fileNode6.fileName = "F6";
            FileNode fileNode7 = new FileNode();

            fileNode7.fileName = "F7";
            FileNode fileNode8 = new FileNode();

            fileNode8.fileName = "F8";
            Vertex v1 = new Vertex("F1")
            {
                nodeValue = fileNode1
            };
            Vertex v2 = new Vertex("F2")
            {
                nodeValue = fileNode2
            };
            Vertex v3 = new Vertex("F3")
            {
                nodeValue = fileNode3
            };
            Vertex v4 = new Vertex("F4")
            {
                nodeValue = fileNode4
            };
            Vertex v5 = new Vertex("F5")
            {
                nodeValue = fileNode5
            };
            Vertex v6 = new Vertex("F6")
            {
                nodeValue = fileNode6
            };
            Vertex v7 = new Vertex("F7")
            {
                nodeValue = fileNode7
            };
            Vertex v8 = new Vertex("F8")
            {
                nodeValue = fileNode8
            };

            v1.addChild(v2, "edge12");
            v1.addChild(v5, "edge15");
            v2.addChild(v6, "edge26");
            v3.addChild(v4, "edge34");
            v3.addChild(v2, "edge32");
            v3.addChild(v7, "edge37");
            v4.addChild(v7, "edge47");
            v5.addChild(v1, "edge51");
            v5.addChild(v6, "edge56");
            v6.addChild(v3, "edge63");
            v6.addChild(v7, "edge67");
            v7.addChild(v8, "edge78");
            v8.addChild(v4, "edge84");
            graph.addNode(v1); graph.addNode(v2);
            graph.addNode(v3); graph.addNode(v4);
            graph.addNode(v5); graph.addNode(v6);
            graph.addNode(v7); graph.addNode(v8);
            var cycle_list = TarjanSccSolver.DetectCycle(graph);

            showStrongComponent(cycle_list);
        }