Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/23/19 11:32:42 (5 years ago)
Author:
chaider
Message:

#2971 Added serialization to Interval class

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Interval.cs

    r16412 r16547  
    2424using System.Linq;
    2525using HeuristicLab.Common;
     26using HeuristicLab.Core;
     27using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2628
    2729namespace HeuristicLab.Problems.DataAnalysis {
    28   public class Interval : IEquatable<Interval> {
     30  [StorableClass]
     31  public class Interval :Item, IEquatable<Interval> {
     32    [Storable]
    2933    public double LowerBound { get; private set; }
     34    [Storable]
    3035    public double UpperBound { get; private set; }
    3136
     37    [StorableConstructor]
     38    protected Interval(bool deserializing) : base(deserializing) { }
     39    protected Interval(Interval original, Cloner cloner)
     40      : base(original, cloner) {
     41    }
    3242    public Interval(double lowerBound, double upperBound) {
    3343      if (lowerBound > upperBound)
     
    4050    public bool Contains(double value) {
    4151      return LowerBound <= value && value <= UpperBound;
     52    }
     53
     54    public override IDeepCloneable Clone(Cloner cloner) {
     55      return new Interval(this, cloner);
    4256    }
    4357
Note: See TracChangeset for help on using the changeset viewer.