//--------------------------<Test Stub for Display>------------------------ #if (TEST_DISPLAY) static void Main(string[] args) { string path = "../../"; string[] arg = { "../../", "*.cs" }; List <string> patterns = new List <string>(); patterns.Add("*.cs"); List <string> options = new List <string>(); string[] files = getFiles(path, patterns); foreach (string f in files) //to populate element Relation { ElemRelation e = new ElemRelation(); e.fromClass = "Derived"; e.toClass = "Original"; e.relationType = "Inheritance"; e.fileName = f; RelationshipRepository.relationship_.Add(e); } foreach (string f1 in files) //to populate types { Elem elem = new Elem(); elem.fileName = f1; elem.type = "function"; elem.name = "Derived"; elem.begin = 1; elem.end = 10; elem.functionComplexity = 2; OutputRepository.output_.Add(elem); } options.Add("/S"); patterns.Add("*.cs"); Display d = new Display(); d.display(files, path, patterns, options); d.displaySummary(files); d.displayFunctionComplexity(files); d.displayRelation(files); }
//-------------<the parsing is called from this method>----------------------------------------------- //-------------<it also calls the display function and XML functions>--------------------------------- public static void processAnalysis(string[] files, string path, List <string> patterns, List <string> options) { XMLOutput xml = new XMLOutput(); Analyzer analyze = new Analyzer(); Display display = new Display(); if (options.Contains("/R") || options.Contains("/r")) { analyze.doAnalysis(files); analyze.doAnalysisRelationship(files); display.display(files, path, patterns, options); display.displaySummary(files); display.displayRelation(files); } else { analyze.doAnalysis(files); display.display(files, path, patterns, options); display.displaySummary(files); display.displayFunctionComplexity(files); } if (options.Contains("/X") || options.Contains("/x")) { xml.displaySummary(); if (options.Contains("/R") || options.Contains("/r")) { xml.displayRelation(); } else { xml.displayFunctionAnalysis(); } } }
//-------------<the parsing is called from this method>----------------------------------------------- //-------------<it also calls the display function and XML functions>--------------------------------- public static void processAnalysis(string[] files, string path, List<string> patterns, List<string> options) { XMLOutput xml = new XMLOutput(); Analyzer analyze = new Analyzer(); Display display = new Display(); if (options.Contains("/R") || options.Contains("/r")) { analyze.doAnalysis(files); analyze.doAnalysisRelationship(files); display.display(files, path, patterns, options); display.displaySummary(files); display.displayRelation(files); } else { analyze.doAnalysis(files); display.display(files, path, patterns, options); display.displaySummary(files); display.displayFunctionComplexity(files); } if (options.Contains("/X") || options.Contains("/x")) { xml.displaySummary(); if (options.Contains("/R") || options.Contains("/r")) { xml.displayRelation(); } else { xml.displayFunctionAnalysis(); } } }
//--------------------------<Test Stub for Display>------------------------ #if(TEST_DISPLAY) static void Main(string[] args) { string path = "../../"; string[] arg = { "../../", "*.cs" }; List<string> patterns = new List<string>(); patterns.Add("*.cs"); List<string> options = new List<string>(); string[] files = getFiles(path, patterns); foreach (string f in files) //to populate element Relation { ElemRelation e = new ElemRelation(); e.fromClass = "Derived"; e.toClass = "Original"; e.relationType = "Inheritance"; e.fileName = f; RelationshipRepository.relationship_.Add(e); } foreach (string f1 in files) //to populate types { Elem elem = new Elem(); elem.fileName = f1; elem.type = "function"; elem.name = "Derived"; elem.begin = 1; elem.end = 10; elem.functionComplexity = 2; OutputRepository.output_.Add(elem); } options.Add("/S"); patterns.Add("*.cs"); Display d = new Display(); d.display(files, path, patterns, options); d.displaySummary(files); d.displayFunctionComplexity(files); d.displayRelation(files); }