Exemplo n.º 1
0
        private void exportSuspiciousnessRanking()
        {
            string filenameTemplate = "cluster_";

            foreach (int key in suspiciousnessListForEveryCluster.Keys)
            {
                if (suspiciousnessListForEveryCluster[key].Count > 0)
                {
                    string      output  = "Rank" + separator + "Functionname" + separator + "Suspiciousness Value(" + faultLocalizationStrategy.ToString() + ")\n";
                    string      path    = parentPath + "\\" + filenameTemplate + key + ".csv";
                    List <Item> tmpList = suspiciousnessListForEveryCluster[key];

                    int    rank  = 1;
                    double value = tmpList.ElementAt(0).Suspiciousness;
                    foreach (Item item in tmpList)
                    {
                        if (Math.Abs(value - item.Suspiciousness) > 0.0000001)
                        {
                            rank++;
                        }
                        output += Convert.ToString(rank) + separator + item.ItemName + separator + item.Suspiciousness + "\n";
                        value   = item.Suspiciousness;
                    }



                    using (System.IO.StreamWriter file = new System.IO.StreamWriter(path))
                    {
                        file.Write(output);
                    }

                    CommandLinePrinter.printToCommandLine(".");
                }
            }
        }
Exemplo n.º 2
0
        private void exportSuspiciousnessRanking()
        {
            string filenameTemplate = "fault";

            if (!commandLineArguments.ContainsKey(PossibleCommandLineArguments.SEPARATOR))
            {
                separator = ' ';
            }
            else
            {
                separator = commandLineArguments[PossibleCommandLineArguments.SEPARATOR].Value.Trim()[0];
            }

            if (suspiciousnessList.Count > 0)
            {
                string output = "Rank" + separator + "Block_name" + separator + "Suspiciousness Value(" + strategy.ToString() + ")\n";
                if (!System.IO.Directory.Exists(parentPath))
                {
                    System.IO.Directory.CreateDirectory(parentPath);
                }
                string      path    = parentPath + "\\" + filenameTemplate + ".csv";
                List <Item> tmpList = suspiciousnessList;

                int    rank  = 1;
                double value = tmpList.ElementAt(0).Suspiciousness;
                foreach (Item item in tmpList)
                {
                    if (Math.Abs(value - item.Suspiciousness) > 0.0000001)
                    {
                        rank++;
                    }
                    output += Convert.ToString(rank) + separator + item.ItemName + separator + item.Suspiciousness + "\n";
                    value   = item.Suspiciousness;
                }



                using (System.IO.StreamWriter file = new System.IO.StreamWriter(path))
                {
                    file.Write(output);
                }
            }
        }