当前位置: 首页>>代码示例>>C#>>正文


C# IRepository.SelectionDSL方法代码示例

本文整理汇总了C#中IRepository.SelectionDSL方法的典型用法代码示例。如果您正苦于以下问题:C# IRepository.SelectionDSL方法的具体用法?C# IRepository.SelectionDSL怎么用?C# IRepository.SelectionDSL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IRepository的用法示例。


在下文中一共展示了IRepository.SelectionDSL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Calc

        public override void Calc(IRepository repository)
        {
            var fileIDs = repository.SelectionDSL()
                .Files().InDirectory(TargetDir).Exist()
                .Select(f => f.ID).ToList();

            List<double> xlist = new List<double>(fileIDs.Count);
            List<double> ylist = new List<double>(fileIDs.Count);

            foreach (var fileID in fileIDs)
            {
                var code = repository.SelectionDSL()
                    .Files().IdIs(fileID)
                    .Modifications().InFiles()
                    .CodeBlocks().InModifications()
                    .Fixed();

                var dd = code.CalculateTraditionalDefectDensity();
                if (dd > 0)
                {
                    xlist.Add(code.CalculateLOC());
                    ylist.Add(dd);
                }
            }

            x = xlist.ToArray();
            y = ylist.ToArray();
        }
开发者ID:kirnosenko,项目名称:msr-tools,代码行数:28,代码来源:DefectDensityToFileSize.cs

示例2: Init

        public override void Init(IRepository repository, IEnumerable<string> releases)
        {
            base.Init(repository, releases);

            double dd = repository.SelectionDSL()
                .Commits().TillRevision(PredictionRelease)
                .Modifications().InCommits()
                .CodeBlocks().InModifications().CalculateDefectDensity(PredictionRelease);

            context.SetCommits(null, PredictionRelease);

            regression = new LinearRegression();
            foreach (var file in GetFilesInRevision(PredictionRelease))
            {
                double ddForFile = repository.SelectionDSL()
                    .Commits().TillRevision(PredictionRelease)
                    .Files().IdIs(file.ID)
                    .Modifications().InCommits().InFiles()
                    .CodeBlocks().InModifications().CalculateDefectDensity(PredictionRelease);

                if (ddForFile >= dd)
                {
                    context.SetFiles(e => e.IdIs(file.ID));

                    regression.AddTrainingData(
                        GetPredictorValuesFor(context)[0],
                        NumberOfFixedDefectsForFile(file.ID)
                    );
                }
            }

            regression.Train();
        }
开发者ID:kirnosenko,项目名称:msr-tools,代码行数:33,代码来源:TotalLocLinearRegressionPostReleaseDefectFilesPrediction.cs

示例3: DistributionData

        protected override double[] DistributionData(IRepository repository)
        {
            var commits = repository.Queryable<Commit>()
                .Select(c => new
                {
                    Revision = c.Revision,
                    Message = c.Message
                }).ToArray();

            List<double> deletedToAdded = new List<double>();
            double added, deleted;

            foreach (var c in commits)
            {
                var code = repository.SelectionDSL()
                    .Commits()
                        .RevisionIs(c.Revision)
                    .Modifications()
                        .InCommits()
                    .CodeBlocks()
                        .InModifications().Fixed();

                added = code.Added().CalculateLOC();
                if (added > 0)
                {
                    deleted = -code.Deleted().CalculateLOC();
                    deletedToAdded.Add(deleted / added);
                }
            }

            return deletedToAdded.ToArray();
        }
开发者ID:kirnosenko,项目名称:msr-tools,代码行数:32,代码来源:RemovedToAddedCode.cs

示例4: Calc

        public override void Calc(IRepository repository)
        {
            base.Calc(repository);

            x = new double[dates.Count()-1];
            yByAuthor = new Dictionary<string,double[]>();
            for (int i = 0; i < Authors.Length; i++)
            {
                yByAuthor.Add(Authors[i], new double[dates.Count()-1]);
            }

            for (int i = 0; i < Authors.Length; i++)
            {
                y = yByAuthor[Authors[i]];
                DateTime prev = dates[0];
                int counter = 0;

                for (int j = 1; j < dates.Length; j++)
                {
                    if (i == 0)
                    {
                        x[counter] = (dates[j] - dates[0]).TotalDays;
                    }
                    y[counter] = repository.SelectionDSL().Commits()
                        .DateIsGreaterOrEquelThan(prev)
                        .DateIsLesserThan(dates[j])
                        .AuthorIs(Authors[i])
                        .Count();

                    prev = dates[j];
                    counter++;
                }
            }
        }
开发者ID:kirnosenko,项目名称:msr-tools,代码行数:34,代码来源:CommitsByDateAndAuthor.cs

示例5: BuildData

        public override IDictionary<string, object> BuildData(IRepository repositories)
        {
            Dictionary<string, object> result = new Dictionary<string, object>();

            var authors = repositories.Queryable<Commit>()
                .Select(x => x.Author)
                .Distinct().ToList();

            var codeByAuthor = (from author in authors select new
            {
                Name = author,
                AddedCode = repositories.SelectionDSL()
                    .Commits().AuthorIs(author)
                    .Files().InDirectory(TargetDir)
                    .Modifications().InFiles()
                    .CodeBlocks().InModifications().AddedInitiallyInCommits()
                    .Fixed(),
            }).ToList();

            var statByAuthor =
                from a in codeByAuthor
                let authorCommits = a.AddedCode.Commits().Again().Count()
                let authorFixes = a.AddedCode.Commits().Again().AreBugFixes().Count()
                let authorRefactorings = a.AddedCode.Commits().Again().AreRefactorings().Count()
            select new
                {
                    name = a.Name,
                    fixes = (double) authorFixes / authorCommits * 100,
                    refactorings = (double) authorRefactorings / authorCommits * 100
                };

            result.Add("authors", statByAuthor.OrderBy(x => x.name).ToArray());

            return result;
        }
开发者ID:kirnosenko,项目名称:msr-tools,代码行数:35,代码来源:CommitGraphBuilder.cs

示例6: Calc

        public override void Calc(IRepository repository)
        {
            base.Calc(repository);

            x = new double[dates.Count()];
            y = new double[dates.Count()];

            double codeSize = 0;
            for (int i = 0; i < dates.Length; i++)
            {
                x[i] = (dates[i] - dates[0]).TotalDays;
                codeSize += repository.SelectionDSL()
                    .Commits()
                        .Reselect(e => i > 0 ? e.DateIsGreaterThan(dates[i-1]) : e)
                        .DateIsLesserOrEquelThan(dates[i])
                    .Files()
                        .InDirectory(TargetDir)
                    .Modifications()
                        .InCommits()
                        .InFiles()
                    .CodeBlocks()
                        .InModifications()
                        .CalculateLOC();
                y[i] = codeSize;
            }
        }
开发者ID:kirnosenko,项目名称:msr-tools,代码行数:26,代码来源:CodeSizeToDate.cs

示例7: Calc

        public override void Calc(IRepository repository)
        {
            base.Calc(repository);

            x = new double[dates.Count()];
            tdd = new double[dates.Count()];
            dd = new double[dates.Count()];
            string revision = null;

            for (int i = 0; i < dates.Length; i++)
            {
                x[i] = (dates[i] - dates[0]).TotalDays;
                var code = repository.SelectionDSL()
                    .Commits()
                        .DateIsLesserOrEquelThan(dates[i])
                        .Do(c =>
                            revision = repository.Queryable<Commit>().Single(cc =>
                                cc.OrderedNumber == c.Max(ccc => ccc.OrderedNumber)
                            ).Revision
                        )
                    .Files()
                        .InDirectory(TargetDir)
                    .Modifications()
                        .InCommits()
                        .InFiles()
                    .CodeBlocks()
                        .InModifications();

                tdd[i] = code.CalculateTraditionalDefectDensity(revision);
                dd[i] = code.CalculateDefectDensity(revision);
            }
        }
开发者ID:kirnosenko,项目名称:msr-tools,代码行数:32,代码来源:DefectDensityToDate.cs

示例8: DistributionData

        protected override double[] DistributionData(IRepository repository)
        {
            var commits = repository.SelectionDSL()
                .Commits()
                .Select(x => x.Revision).ToArray();

            List<double> locData = new List<double>(commits.Count());

            foreach (var commit in commits)
            {
                locData.Add(repository.SelectionDSL()
                    .Commits().RevisionIs(commit)
                    .Modifications().InCommits()
                    .CodeBlocks().InModifications().Added().CalculateLOC()
                );
            }

            return locData.ToArray();
        }
开发者ID:kirnosenko,项目名称:msr-tools,代码行数:19,代码来源:CommitSizeDistribution.cs

示例9: DistributionData

        protected override double[] DistributionData(IRepository repository)
        {
            var fileIDs = repository.SelectionDSL()
                .Files()
                    .InDirectory(TargetDir)
                    .Exist()
                .Select(x => x.ID).ToArray();

            List<double> ddData = new List<double>(fileIDs.Count());

            foreach (var fileID in fileIDs)
            {
                ddData.Add(repository.SelectionDSL()
                    .Files().IdIs(fileID)
                    .Modifications().InFiles()
                    .CodeBlocks().InModifications().CalculateDefectDensity()
                );
            }

            return ddData.ToArray();
        }
开发者ID:kirnosenko,项目名称:msr-tools,代码行数:21,代码来源:FileDefectDensityDistribution.cs

示例10: BuildData

        public override IDictionary<string, object> BuildData(IRepository repositories)
        {
            Dictionary<string, object> result = new Dictionary<string, object>();

            var authors = repositories.Queryable<Commit>()
                .Select(x => x.Author)
                .Distinct().ToList();

            var codeByAuthor = (from author in authors select new
            {
                Name = author,
                AddedCode = repositories.SelectionDSL()
                    .Commits().AuthorIs(author)
                    .Files().InDirectory(TargetDir)
                    .Modifications().InFiles()
                    .CodeBlocks().InModifications().AddedInitiallyInCommits()
                    .Fixed(),
                RemovedCode = repositories.SelectionDSL()
                    .Commits().AuthorIs(author)
                    .Files().InDirectory(TargetDir)
                    .Modifications().InCommits().InFiles()
                    .CodeBlocks().InModifications().Deleted()
                    .Fixed()
            }).ToList();

            var statByAuthor =
                from a in codeByAuthor
                select new
                {
                    name = a.Name,
                    added_loc = a.AddedCode.CalculateLOC() / (a.AddedCode.CalculateLOC() - a.RemovedCode.CalculateLOC()) * 100,
                    removed_loc = -a.RemovedCode.CalculateLOC() / (a.AddedCode.CalculateLOC() - a.RemovedCode.CalculateLOC()) * 100
                };
            result.Add("authors", statByAuthor.OrderBy(x => x.name).ToArray());

            return result;
        }
开发者ID:kirnosenko,项目名称:msr-tools,代码行数:37,代码来源:ActivityGraphBuilder.cs

示例11: Calc

        public override void Calc(IRepository repository)
        {
            var revisions = repository.SelectionDSL()
                .Commits()
                .Select(c => c.Revision)
                .ToList();

            List<double> xlist = new List<double>(revisions.Count);
            List<double> ylist = new List<double>(revisions.Count);

            foreach (var revision in revisions)
            {
                var code = repository.SelectionDSL()
                    .Commits().RevisionIs(revision)
                    .Files().InDirectory(TargetDir)
                    .Modifications().InCommits().InFiles()
                    .CodeBlocks().InModifications()
                    .Fixed();

                var addedLoc = code.Added().CalculateLOC();
                if (addedLoc == 0)
                {
                    continue;
                }
                var dd = code.CalculateTraditionalDefectDensity();
                if (dd == 0)
                {
                    continue;
                }
                xlist.Add(addedLoc);
                ylist.Add(dd);
            }

            x = xlist.ToArray();
            y = ylist.ToArray();
        }
开发者ID:kirnosenko,项目名称:msr-tools,代码行数:36,代码来源:DefectDensityToCommitSize.cs

示例12: BuildData

        public override IDictionary<string, object> BuildData(IRepository repositories)
        {
            Dictionary<string, object> result = new Dictionary<string, object>();

            var authors = repositories.Queryable<Commit>()
                .Select(x => x.Author)
                .Distinct().ToList();

            var codeByAuthor = (from author in authors
                                select new
                                {
                                    Name = author,
                                }).ToList();

            var statByAuthor =
                from a in codeByAuthor
                select new
                {
                    name = a.Name,
                };

            result.Add("authors", statByAuthor.OrderBy(x => x.name).ToArray());

            DateTime statFrom = repositories.Queryable<Commit>().Min(x => x.Date);
            DateTime statTo = repositories.Queryable<Commit>().Max(x => x.Date);

            List<object> monthObjs = new List<object>();
            List<object> locObjs = new List<object>();

            List<DateTime> monthes = new List<DateTime>();
            DateTime m = new DateTime(statFrom.Year, statFrom.Month, 1);
            while (m < statTo)
            {
                monthes.Add(m);
                m = m.AddMonths(1);
            }

            foreach (var month in monthes)
            {
                DateTime nextMonth = month.AddMonths(1);

                var totalMonthCommits = repositories.SelectionDSL()
                    .Commits()
                        .DateIsLesserThan(nextMonth)
                        .Fixed();

                foreach (var author in authors)
                {
                    double authorLoc = totalMonthCommits
                        .AuthorIs(author).Files().InDirectory(TargetDir)
                        .Modifications().InCommits().InFiles()
                        .CodeBlocks().InModifications().Fixed().CalculateLOC();

                    locObjs.Add(new
                    {
                        loc = authorLoc
                    });
                }

                monthObjs.Add(new
                {
                    month = String.Format("{0:00}", month.Month) + "-" + month.Year.ToString()
                });
            }

            result.Add("monthes", monthObjs);

            result.Add("locs", locObjs);

            return result;
        }
开发者ID:kirnosenko,项目名称:msr-tools,代码行数:71,代码来源:LocGraphBuilder.cs

示例13: Init

        public override void Init(IRepository repository)
        {
            authorByRevision = repository.SelectionDSL()
                .Commits().TillRevision(model.PredictionRelease)
                .ToDictionary(x => x.Revision, x => x.Author);

            defectLineProbabilityOfAuthor = new SmartDictionary<string,double>(a =>
                repository.SelectionDSL()
                    .Commits().AuthorIs(a).BeforeRevision(model.PredictionRelease)
                    .Modifications().InCommits()
                    .CodeBlocks().InModifications().CalculateDefectCodeDensity(model.PredictionRelease)
            );
        }
开发者ID:kirnosenko,项目名称:msr-tools,代码行数:13,代码来源:CodeStabilityPostReleaseDefectFilesPrediction.cs

示例14: BuildData

        public override IDictionary<string, object> BuildData(IRepository repository)
        {
            Dictionary<string, object> result = new Dictionary<string, object>();

            double totalLoc = repository.SelectionDSL()
                .Files().InDirectory(TargetDir)
                .Modifications().InFiles()
                .CodeBlocks().InModifications().CalculateLOC();

            List<object> monthObjects = new List<object>();

            DateTime statFrom = repository.Queryable<Commit>().Min(x => x.Date);
            DateTime statTo = repository.Queryable<Commit>().Max(x => x.Date);

            List<DateTime> monthes = new List<DateTime>();
            DateTime m = new DateTime(statFrom.Year, statFrom.Month, 1);
            while (m < statTo)
            {
                monthes.Add(m);
                m = m.AddMonths(1);
            }

            string lastRevision = null;

            foreach (var month in monthes)
            {
                DateTime nextMonth = month.AddMonths(1);

                var monthCommits = repository.SelectionDSL()
                    .Commits()
                        .DateIsGreaterOrEquelThan(month)
                        .DateIsLesserThan(nextMonth)
                        .Fixed();
                var monthCode = monthCommits
                    .Files().InDirectory(TargetDir)
                    .Modifications().InCommits().InFiles()
                    .CodeBlocks().InModifications().Fixed();
                var totalMonthCommits = repository.SelectionDSL()
                    .Commits()
                        .DateIsLesserThan(nextMonth)
                        .Fixed();
                var totalMonthCode = totalMonthCommits
                    .Files().InDirectory(TargetDir)
                    .Modifications().InCommits().InFiles()
                    .CodeBlocks().InModifications().Fixed();

                int monthCommitsCount = monthCommits.Count();
                int totalMonthCommitsCount = totalMonthCommits.Count();
                int monthAuthorsCount = monthCommits.Select(c => c.Author).Distinct().Count();
                int totalMonthAuthorsCount = totalMonthCommits.Select(c => c.Author).Distinct().Count();
                int monthFixesCount = monthCommits.AreBugFixes().Count();
                int totalMonthFixesCount = totalMonthCommits.AreBugFixes().Count();
                if (monthCommitsCount > 0)
                {
                    lastRevision = monthCommits
                        .Single(c => c.OrderedNumber == monthCommits.Max(x => x.OrderedNumber))
                        .Revision;
                }

                monthObjects.Add(new
                {
                    month = month.Year.ToString() + "-" + String.Format("{0:00}", month.Month),
                    commits = string.Format("{0} ({1})",
                        monthCommitsCount,
                        totalMonthCommitsCount
                    ),
                    authors = string.Format("{0} ({1})",
                        monthAuthorsCount,
                        totalMonthAuthorsCount
                    ),
                    files = repository.SelectionDSL().Files()
                        .ExistInRevision(lastRevision).Count(),
                    fixed_defects = string.Format("{0} ({1})",
                        monthFixesCount,
                        totalMonthFixesCount
                    ),
                    added_loc = string.Format("{0} ({1})",
                        monthCode.Added().CalculateLOC(),
                        totalMonthCode.Added().CalculateLOC()
                    ),
                    removed_loc = string.Format("{0} ({1})",
                        -monthCode.Deleted().CalculateLOC(),
                        -totalMonthCode.Deleted().CalculateLOC()
                    ),
                    loc = totalMonthCode.CalculateLOC()
                });
            }

            result.Add("monthes", monthObjects);
            return result;
        }
开发者ID:kirnosenko,项目名称:msr-tools,代码行数:91,代码来源:ActivityStatBuilder.cs

示例15: BuildData

        public override IDictionary<string, object> BuildData(IRepository repositories)
        {
            Dictionary<string, object> result = new Dictionary<string, object>();

            var authors = repositories.Queryable<Commit>()
                .Select(x => x.Author)
                .Distinct().ToList();

            var codeByAuthor = (from author in authors select new
            {
                Name = author,
            }).ToList();

            var statByAuthor =
                from a in codeByAuthor
            select new
            {
                name = a.Name,
            };

            result.Add("authors", statByAuthor.OrderBy(x => x.name).ToArray());

            List<object> monthObjs = new List<object>();
            List<object> fixObjs = new List<object>();
            List<object> refactObjs = new List<object>();
            List<object> restObjs = new List<object>();

            DateTime statFrom = repositories.Queryable<Commit>().Min(x => x.Date);
            DateTime statTo = repositories.Queryable<Commit>().Max(x => x.Date);

            List<DateTime> monthes = new List<DateTime>();
            DateTime m = new DateTime(statFrom.Year, statFrom.Month, 1);
            while (m < statTo)
            {
                monthes.Add(m);
                m = m.AddMonths(1);
            }

            foreach (var month in monthes)
            {
                DateTime nextMonth = month.AddMonths(1);

                var monthCommits = repositories.SelectionDSL()
                    .Commits()
                        .DateIsGreaterOrEquelThan(month)
                        .DateIsLesserThan(nextMonth)
                        .Fixed();

                int monthFixCommitsCount = monthCommits.AreBugFixes().Count();
                int monthRefactCommitsCount = monthCommits.AreRefactorings().Count();
                int monthRestCommitsCount = monthCommits.Count() - monthFixCommitsCount - monthRefactCommitsCount;

                foreach (var author in authors)
                {
                    int monthAuthFixCommits = monthCommits.AuthorIs(author).AreBugFixes().Count();
                    int monthAuthRefactCommits = monthCommits.AuthorIs(author).AreRefactorings().Count();
                    int monthRestAuthCommits = monthCommits.AuthorIs(author).Count() - monthAuthFixCommits - monthAuthRefactCommits;

                    double monthAuthFixCommitsCount = monthFixCommitsCount == 0 ? 0 : (monthAuthFixCommits / monthFixCommitsCount * 100);
                    double monthAuthRefactCommitsCount = monthRefactCommitsCount == 0 ? 0 : (monthAuthRefactCommits / monthRefactCommitsCount * 100);
                    double monthAuthRestCommitsCount = monthRestCommitsCount == 0 ? 0 : (monthRestAuthCommits / monthRestCommitsCount * 100);

                    fixObjs.Add(new
                    {
                        fix = monthAuthFixCommitsCount
                    });

                    refactObjs.Add(new
                    {
                        refact = monthAuthRefactCommitsCount
                    });

                    restObjs.Add(new
                    {
                        rest = monthAuthRestCommitsCount
                    });
                }

                monthObjs.Add(new
                {
                    month = month.Year.ToString() + "-" + String.Format("{0:00}", month.Month)
                });
            }

            result.Add("monthes", monthObjs);

            result.Add("fixes",fixObjs);

            result.Add("refactorings",refactObjs);

            result.Add("rests",restObjs);

            return result;
        }
开发者ID:kirnosenko,项目名称:msr-tools,代码行数:94,代码来源:CommitPerMonthGraphBuilder.cs


注:本文中的IRepository.SelectionDSL方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。