mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-20 14:15:12 +00:00
49 lines
1.6 KiB
C#
49 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Diagnostics;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
|
|
namespace Octokit
|
|
{
|
|
/// <summary>
|
|
/// Represents the summary of lines added and deleted
|
|
/// </summary>
|
|
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
|
public class CodeFrequency
|
|
{
|
|
public CodeFrequency() { }
|
|
|
|
public CodeFrequency(IEnumerable<AdditionsAndDeletions> additionsAndDeletionsByWeek)
|
|
{
|
|
Ensure.ArgumentNotNull(additionsAndDeletionsByWeek, "additionsAndDeletionsByWeek");
|
|
|
|
AdditionsAndDeletionsByWeek = new ReadOnlyCollection<AdditionsAndDeletions>(additionsAndDeletionsByWeek.ToList());
|
|
}
|
|
|
|
/// <summary>
|
|
/// Construct an instance of CodeFrequency
|
|
/// </summary>
|
|
/// <param name="rawFrequencies">Raw data </param>
|
|
public CodeFrequency(IEnumerable<IList<long>> rawFrequencies)
|
|
{
|
|
Ensure.ArgumentNotNull(rawFrequencies, "rawFrequencies");
|
|
AdditionsAndDeletionsByWeek = rawFrequencies.Select(point => new AdditionsAndDeletions(point)).ToList();
|
|
}
|
|
|
|
/// <summary>
|
|
/// A weekly aggregate of the number of additions and deletions pushed to a repository.
|
|
/// </summary>
|
|
public IReadOnlyList<AdditionsAndDeletions> AdditionsAndDeletionsByWeek { get; private set; }
|
|
|
|
internal string DebuggerDisplay
|
|
{
|
|
get
|
|
{
|
|
return String.Format(CultureInfo.InvariantCulture,
|
|
"Number of weeks: {0}", AdditionsAndDeletionsByWeek.Count());
|
|
}
|
|
}
|
|
}
|
|
} |