private Result[] CalculateCriteria(Result[] metrics) { FileUser fileUser = new FileUser(Properties.Settings.Default.Criteria, new CriteriasRepository()); Criteria[] allCriterias = (Criteria[])fileUser.getElements(); List <Result> results = new List <Result>(); float[] sum = new float[allCriterias.Length]; int[] count = new int[allCriterias.Length]; bool[] flags = new bool[allCriterias.Length]; foreach (Result metric in metrics) { Metric temp = (Metric)metric.Layer; flags[temp.CriteriaId] = true; sum[temp.CriteriaId] += metric.Assessment; ++count[temp.CriteriaId]; } for (int i = 0; i < allCriterias.Length; ++i) { if (flags[i] == true) { int c = count[i]; if (c == 0) { c = 1; } results.Add(new Result(allCriterias[i], 2, sum[i] / c)); } } return(results.ToArray()); }
public Metric[] FilterMetrics() { FileUser fileUser = new FileUser(Properties.Settings.Default.Metrics, new MetricRepository()); Metric[] metrics = (Metric[])fileUser.getElements(); metrics = FilterByPhase(metrics); metrics = SetPriority(metrics); return(metrics); }
public Indicator[] FilterIndicators() { FileUser fileUser = new FileUser(Properties.Settings.Default.Indicators, new IndicatorsRepository()); Indicator[] indicators = (Indicator[])fileUser.getElements(); MetricsFilter metricsFilter = new MetricsFilter(); Metric[] metrics = metricsFilter.FilterMetrics(); indicators = SetPriority(indicators, metrics); return(indicators); }