1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
4 | *
|
---|
5 | * This file is part of HeuristicLab.
|
---|
6 | *
|
---|
7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
8 | * it under the terms of the GNU General Public License as published by
|
---|
9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
10 | * (at your option) any later version.
|
---|
11 | *
|
---|
12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
15 | * GNU General Public License for more details.
|
---|
16 | *
|
---|
17 | * You should have received a copy of the GNU General Public License
|
---|
18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
19 | */
|
---|
20 | #endregion
|
---|
21 |
|
---|
22 | using System;
|
---|
23 | using System.Collections.Generic;
|
---|
24 | using System.Linq;
|
---|
25 | using HeuristicLab.Common;
|
---|
26 | using HeuristicLab.Core;
|
---|
27 | using HeuristicLab.Data;
|
---|
28 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
29 |
|
---|
30 | namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
|
---|
31 | [StorableClass]
|
---|
32 | [Item("Sliding Window Position", "")]
|
---|
33 | public sealed class SlidingWindowData : Item {
|
---|
34 |
|
---|
35 | [Storable]
|
---|
36 | private IntRange slidingWindowPosition;
|
---|
37 | public IntRange SlidingWindowPosition {
|
---|
38 | get { return slidingWindowPosition; }
|
---|
39 | }
|
---|
40 |
|
---|
41 | [Storable]
|
---|
42 | private IEnumerable<double> targetValues;
|
---|
43 | public IEnumerable<double> TargetValues {
|
---|
44 | get { return targetValues; }
|
---|
45 | }
|
---|
46 |
|
---|
47 | [Storable]
|
---|
48 | private IEnumerable<double> estimatedValues;
|
---|
49 | public IEnumerable<double> EstimatedValues {
|
---|
50 | get { return estimatedValues; }
|
---|
51 | set {
|
---|
52 | if (value == null) throw new ArgumentNullException();
|
---|
53 | estimatedValues = value.ToArray();
|
---|
54 | OnEstimatedValuesChanged();
|
---|
55 | }
|
---|
56 | }
|
---|
57 |
|
---|
58 | [StorableConstructor]
|
---|
59 | private SlidingWindowData(bool deserializing) : base(deserializing) { }
|
---|
60 | private SlidingWindowData(SlidingWindowData original, Cloner cloner)
|
---|
61 | : base(original, cloner) {
|
---|
62 | slidingWindowPosition = cloner.Clone(original.slidingWindowPosition);
|
---|
63 | targetValues = new List<double>(original.targetValues);
|
---|
64 | }
|
---|
65 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
66 | return new SlidingWindowData(this, cloner);
|
---|
67 | }
|
---|
68 |
|
---|
69 | public SlidingWindowData(IntRange slidingWindowPosition, IEnumerable<double> targetValues)
|
---|
70 | : base() {
|
---|
71 | this.slidingWindowPosition = slidingWindowPosition;
|
---|
72 | this.targetValues = targetValues.ToArray();
|
---|
73 | }
|
---|
74 |
|
---|
75 | public event EventHandler EstimatedValuesChanged;
|
---|
76 | private void OnEstimatedValuesChanged() {
|
---|
77 | var handler = EstimatedValuesChanged;
|
---|
78 | if (handler != null) EstimatedValuesChanged(this, EventArgs.Empty);
|
---|
79 | }
|
---|
80 | }
|
---|
81 | }
|
---|