public static StatisticsResult FromCSVLine(string csvline) { string[] tmp = csvline.Split(';'); Debug.Assert(2 == tmp.Length); int bugId = int.Parse(tmp[0]); IEnumerable <int> matchedNumbers = tmp[1] .Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries) .Select(matchString => int.Parse(matchString)); StatisticsResult sr = new StatisticsResult(bugId); foreach (int i in Enumerable.Range(0, NUMBER_OF_EXPERTS)) { sr.Matches[i] = matchedNumbers.Contains(i); } return(sr); }
private StatisticsResult CalculateResultForOneAlgorithmAndBug(int algorithmId, int bugId, List <int> actualReviewerIds) { StatisticsResult sr = new StatisticsResult(bugId); ComputedReviewer currentReviewerSet; using (ExpertiseDBEntities context = new ExpertiseDBEntities()) { currentReviewerSet = context.ComputedReviewers.Single(cr => cr.AlgorithmId == algorithmId && cr.BugId == bugId); } sr.Matches[0] = actualReviewerIds.Contains(currentReviewerSet.Expert1Id ?? -1); // the magic "-1" never matches sr.Matches[1] = actualReviewerIds.Contains(currentReviewerSet.Expert2Id ?? -1); sr.Matches[2] = actualReviewerIds.Contains(currentReviewerSet.Expert3Id ?? -1); sr.Matches[3] = actualReviewerIds.Contains(currentReviewerSet.Expert4Id ?? -1); sr.Matches[4] = actualReviewerIds.Contains(currentReviewerSet.Expert5Id ?? -1); return(sr); }