Ejemplo n.º 1
0
        public static IList <DataRow> ProcessAdditionalMethodCases(string filename)
        {
            IList <DataRow> rowsToReturn = new List <DataRow>();

            if (File.Exists(filename))
            {
                //TODO:: MOVE TO OTHER CLASS
                var dataset = DataSetHelper.GetDataSetForCSV(filename);

                foreach (var row in dataset.Tables[0].Select())
                {
                    Bin loc   = LOC.Discretize(row.Field <int>("LOC"));
                    Bin cyclo = CYCLO.Discretize(row.Field <int>("CYCLO"));
                    Bin atfd  = ATFD.Discretize(row.Field <int>("ATFD"));
                    Bin fdp   = FDP.Discretize(row.Field <int>("FDP"));

                    Bin laa = null;
                    try
                    {
                        laa = LAA.Discretize(row.Field <double>("LAA"));
                    }
                    catch
                    {
                        laa = LAA.Discretize(row.Field <int>("LAA"));
                    }
                    Bin maxnesting = MAXNESTING.Discretize(row.Field <int>("MAXNESTING"));
                    Bin noav       = NOAV.Discretize(row.Field <int>("NOAV"));

                    string featureEnvy = row.Field <string>("Feature_Envy");
                    string longMethod  = row.Field <string>("Long_Method");

                    DataRow newRow = MethodDataset.Tables[0].NewRow();

                    newRow.SetField <string>("Name", row.Field <string>("Name"));
                    newRow.SetField <string>("LOC", loc.ToString());
                    newRow.SetField <string>("CYCLO", cyclo.ToString());
                    newRow.SetField <string>("ATFD", atfd.ToString());
                    newRow.SetField <string>("FDP", fdp.ToString());
                    newRow.SetField <string>("LAA", laa.ToString());
                    newRow.SetField <string>("MAXNESTING", maxnesting.ToString());
                    newRow.SetField <string>("NOAV", noav.ToString());

                    newRow.SetField <string>("Feature_Envy", featureEnvy);
                    newRow.SetField <string>("Long_Method", longMethod);

                    rowsToReturn.Add(newRow);
                }
            }

            return(rowsToReturn);
        }