示例#1
0
        /// <summary>
        /// Section Two.
        /// </summary>
        /// <returns>The five.</returns>
        /// <param name="result">Result.</param>
        private string SectionTwo(NodeDegreeReportFactory result)
        {
            Condition.Requires(result, "Result")
            .IsNotNull();

            string table = "";
            string title = "Node Id";

            foreach (Graph graph in GraphTimeToGraphObjectDict.Values)
            {
                title += "\t" + graph.GraphEndTime;
            }
            table += title;

            Dictionary <string, int[]> NodeIsNodeIdToItsDegree = result.GetNodeDegrees();

            foreach (string id in NodeIsNodeIdToItsDegree.Keys)
            {
                table += "\n" + id;
                foreach (int count in NodeIsNodeIdToItsDegree[id])
                {
                    table += string.Format("\t" + count);
                }
            }
            return(table);
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:mabuse.NodeDegreeReportWritter"/> class.
        /// </summary>
        /// <param name="result">Result.</param>
        /// <param name="filePath">File path.</param>
        public NodeDegreeReportWritter(NodeDegreeReportFactory result, string filePath)
        {
            //input parameter condition check
            Condition.Requires(result, "the analyzed result")
            .IsNotNull();
            Condition.Requires(filePath, "path of file to write to")
            .IsNotEmpty()
            .IsNotNull()
            .EndsWith(".txt");

            GraphTimeToGraphObjectDict = result.GraphTimeToGraphObjectDict;

            string[] lines = { SectionTwo(result) };
            System.IO.File.WriteAllLines(@filePath, lines);
        }
示例#3
0
        /// <summary>
        /// write Node degree report.
        /// </summary>
        /// <param name="parser">Parser.</param>
        /// <param name="pathToFile">Path to file.</param>
        private static void NodeDegreeReport_Write(Parser parser, string pathToFile)
        {
            Condition.Ensures(parser.GetGraphTimeToGraphDictionary(), "graph create by parser")
            .IsNotNull()
            .IsNotEmpty();
            Condition.Requires(pathToFile, "path to write to the fileA")
            .IsNotNullOrEmpty()
            .EndsWith(".txt")
            .IsNotNullOrWhiteSpace();

            NodeDegreeReportFactory nodeDegreeReportFactory = new NodeDegreeReportFactory(parser);

            Condition.Ensures(nodeDegreeReportFactory, "result of parserB")
            .IsNotNull();

            NodeDegreeReportWritter nodeDegreeReport = new NodeDegreeReportWritter(nodeDegreeReportFactory, pathToFile);
        }