Browse Source

Statistics: Histogram DataContract for ephemeral serialization #350

netstandard
Christoph Ruegg 11 years ago
parent
commit
59e32d7e11
  1. 18
      src/Numerics/Statistics/Histogram.cs

18
src/Numerics/Statistics/Histogram.cs

@ -28,18 +28,20 @@
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// </copyright> // </copyright>
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Text;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.Statistics namespace MathNet.Numerics.Statistics
{ {
using System;
using System.Collections.Generic;
using System.Text;
using Properties;
/// <summary> /// <summary>
/// A <see cref="Histogram"/> consists of a series of <see cref="Bucket"/>s, /// A <see cref="Histogram"/> consists of a series of <see cref="Bucket"/>s,
/// each representing a region limited by a lower bound (exclusive) and an upper bound (inclusive). /// each representing a region limited by a lower bound (exclusive) and an upper bound (inclusive).
/// </summary> /// </summary>
[Serializable] [Serializable]
[DataContract(Namespace = "urn:MathNet/Numerics")]
public class Bucket : public class Bucket :
#if PORTABLE #if PORTABLE
IComparable<Bucket> IComparable<Bucket>
@ -71,11 +73,13 @@ namespace MathNet.Numerics.Statistics
/// <summary> /// <summary>
/// Lower Bound of the Bucket. /// Lower Bound of the Bucket.
/// </summary> /// </summary>
[DataMember(Order = 1)]
public double LowerBound { get; set; } public double LowerBound { get; set; }
/// <summary> /// <summary>
/// Upper Bound of the Bucket. /// Upper Bound of the Bucket.
/// </summary> /// </summary>
[DataMember(Order = 2)]
public double UpperBound { get; set; } public double UpperBound { get; set; }
/// <summary> /// <summary>
@ -84,6 +88,7 @@ namespace MathNet.Numerics.Statistics
/// <remarks> /// <remarks>
/// Value may be NaN if this was constructed as a <see cref="IComparer{Bucket}"/> argument. /// Value may be NaN if this was constructed as a <see cref="IComparer{Bucket}"/> argument.
/// </remarks> /// </remarks>
[DataMember(Order = 3)]
public double Count { get; set; } public double Count { get; set; }
/// <summary> /// <summary>
@ -245,16 +250,19 @@ namespace MathNet.Numerics.Statistics
/// A class which computes histograms of data. /// A class which computes histograms of data.
/// </summary> /// </summary>
[Serializable] [Serializable]
[DataContract(Namespace = "urn:MathNet/Numerics")]
public class Histogram public class Histogram
{ {
/// <summary> /// <summary>
/// Contains all the <c>Bucket</c>s of the <c>Histogram</c>. /// Contains all the <c>Bucket</c>s of the <c>Histogram</c>.
/// </summary> /// </summary>
[DataMember(Order = 1)]
private readonly List<Bucket> _buckets; private readonly List<Bucket> _buckets;
/// <summary> /// <summary>
/// Indicates whether the elements of <c>buckets</c> are currently sorted. /// Indicates whether the elements of <c>buckets</c> are currently sorted.
/// </summary> /// </summary>
[DataMember(Order = 2)]
private bool _areBucketsSorted; private bool _areBucketsSorted;
/// <summary> /// <summary>

Loading…
Cancel
Save