示例#1
0
 /// <summary>
 /// Calculate for each fix the time between dates when
 /// the oldest and the newest buggy code were added.
 /// </summary>
 /// <param name="bugFixes">Fixes to be processed.</param>
 /// <returns>Time in days.</returns>
 public static IEnumerable <double> CalculateBugLifetimeSpread(this BugFixSelectionExpression bugFixes)
 {
     return
         ((
              from bf in bugFixes
              join c in bugFixes.Queryable <Commit>() on bf.CommitID equals c.ID
              join m in bugFixes.Queryable <Modification>() on c.ID equals m.CommitID
              join dcb in bugFixes.Queryable <CodeBlock>() on m.ID equals dcb.ModificationID
              join acb in bugFixes.Queryable <CodeBlock>() on dcb.TargetCodeBlockID equals acb.ID
              where
              dcb.Size < 0
              let codeDate = bugFixes.Queryable <Commit>().Single(x => x.ID == acb.AddedInitiallyInCommitID).Date
                             group codeDate by c.Date into g
                             select(g.Max() - g.Min()).TotalDays
              ).ToArray());
 }
示例#2
0
        public static double CalculateStabilizationPeriod(this BugFixSelectionExpression bugFixes, double stabilizationProbability)
        {
            var    bugLifetimes        = bugFixes.CalculateAvarageBugLifetime().OrderByDescending(x => x);
            int    bugLifetimesCount   = bugLifetimes.Count();
            double stabilizationPeriod = bugLifetimes.First();

            foreach (var bugLifetime in bugLifetimes)
            {
                double lessOrEqualToTotal = (double)bugLifetimes.Where(x => x <= bugLifetime).Count() / bugLifetimes.Count();
                if (lessOrEqualToTotal >= stabilizationProbability)
                {
                    stabilizationPeriod = bugLifetime;
                }
                else
                {
                    break;
                }
            }

            return(stabilizationPeriod);
        }
 protected override IEnumerable<double> BugLifetimes(BugFixSelectionExpression bugFixes)
 {
     return bugFixes.CalculateMinBugLifetime();
 }
 protected virtual IEnumerable<double> BugLifetimes(BugFixSelectionExpression bugFixes)
 {
     return bugFixes.CalculateAvarageBugLifetime();
 }
示例#5
0
 protected override IEnumerable <double> BugLifetimes(BugFixSelectionExpression bugFixes)
 {
     return(bugFixes.CalculateMaxBugLifetime());
 }
示例#6
0
 protected virtual IEnumerable <double> BugLifetimes(BugFixSelectionExpression bugFixes)
 {
     return(bugFixes.CalculateAvarageBugLifetime());
 }