#region License Information
/* HeuristicLab
* Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
*
* This file is part of HeuristicLab.
*
* HeuristicLab is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* HeuristicLab is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with HeuristicLab. If not, see .
*/
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using HeuristicLab.Common;
using HeuristicLab.Core;
using HeuristicLab.Data;
using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
[StorableClass]
[Item("Sliding Window Position", "")]
public sealed class SlidingWindowData : Item {
[Storable]
private IntRange slidingWindowPosition;
public IntRange SlidingWindowPosition {
get { return slidingWindowPosition; }
}
[Storable]
private IEnumerable targetValues;
public IEnumerable TargetValues {
get { return targetValues; }
}
[Storable]
private IEnumerable estimatedValues;
public IEnumerable EstimatedValues {
get { return estimatedValues; }
set {
if (value == null) throw new ArgumentNullException();
estimatedValues = value.ToArray();
OnEstimatedValuesChanged();
}
}
[StorableConstructor]
private SlidingWindowData(bool deserializing) : base(deserializing) { }
private SlidingWindowData(SlidingWindowData original, Cloner cloner)
: base(original, cloner) {
slidingWindowPosition = cloner.Clone(original.slidingWindowPosition);
targetValues = new List(original.targetValues);
}
public override IDeepCloneable Clone(Cloner cloner) {
return new SlidingWindowData(this, cloner);
}
public SlidingWindowData(IntRange slidingWindowPosition, IEnumerable targetValues)
: base() {
this.slidingWindowPosition = slidingWindowPosition;
this.targetValues = targetValues.ToArray();
}
public event EventHandler EstimatedValuesChanged;
private void OnEstimatedValuesChanged() {
var handler = EstimatedValuesChanged;
if (handler != null) EstimatedValuesChanged(this, EventArgs.Empty);
}
}
}