1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2016 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 |
|
---|
21 | //Code is based on an implementation from Laurens van der Maaten
|
---|
22 |
|
---|
23 | /*
|
---|
24 | *
|
---|
25 | * Copyright (c) 2014, Laurens van der Maaten (Delft University of Technology)
|
---|
26 | * All rights reserved.
|
---|
27 | *
|
---|
28 | * Redistribution and use in source and binary forms, with or without
|
---|
29 | * modification, are permitted provided that the following conditions are met:
|
---|
30 | * 1. Redistributions of source code must retain the above copyright
|
---|
31 | * notice, this list of conditions and the following disclaimer.
|
---|
32 | * 2. Redistributions in binary form must reproduce the above copyright
|
---|
33 | * notice, this list of conditions and the following disclaimer in the
|
---|
34 | * documentation and/or other materials provided with the distribution.
|
---|
35 | * 3. All advertising materials mentioning features or use of this software
|
---|
36 | * must display the following acknowledgement:
|
---|
37 | * This product includes software developed by the Delft University of Technology.
|
---|
38 | * 4. Neither the name of the Delft University of Technology nor the names of
|
---|
39 | * its contributors may be used to endorse or promote products derived from
|
---|
40 | * this software without specific prior written permission.
|
---|
41 | *
|
---|
42 | * THIS SOFTWARE IS PROVIDED BY LAURENS VAN DER MAATEN ''AS IS'' AND ANY EXPRESS
|
---|
43 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
44 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
---|
45 | * EVENT SHALL LAURENS VAN DER MAATEN BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
---|
46 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
---|
47 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
---|
48 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
---|
49 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
---|
50 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
---|
51 | * OF SUCH DAMAGE.
|
---|
52 | *
|
---|
53 | */
|
---|
54 | #endregion
|
---|
55 |
|
---|
56 | using HeuristicLab.Common;
|
---|
57 | using HeuristicLab.Core;
|
---|
58 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
59 |
|
---|
60 | namespace HeuristicLab.Algorithms.DataAnalysis {
|
---|
61 | [StorableClass]
|
---|
62 | public class DataPoint<T> : Item, IDataPoint<T> where T : class, IDeepCloneable {
|
---|
63 | #region properties
|
---|
64 | [Storable]
|
---|
65 | private int ind;
|
---|
66 | [Storable]
|
---|
67 | public T X { get; private set; }
|
---|
68 |
|
---|
69 | public int Index
|
---|
70 | {
|
---|
71 | get { return ind; }
|
---|
72 | }
|
---|
73 | #endregion
|
---|
74 |
|
---|
75 | #region HLConstructors & Cloning
|
---|
76 | [StorableConstructor]
|
---|
77 | protected DataPoint(bool deserializing) : base(deserializing) { }
|
---|
78 | protected DataPoint(DataPoint<T> original, Cloner cloner)
|
---|
79 | : base(original, cloner) {
|
---|
80 | ind = original.ind;
|
---|
81 | X = cloner.Clone(original.X);
|
---|
82 | }
|
---|
83 | public override IDeepCloneable Clone(Cloner cloner) { return new DataPoint<T>(this, cloner); }
|
---|
84 | public DataPoint() : this(1, null) { }
|
---|
85 | public DataPoint(int ind, T x) {
|
---|
86 | this.ind = ind;
|
---|
87 | X = (T)x.Clone();
|
---|
88 | }
|
---|
89 | #endregion
|
---|
90 |
|
---|
91 |
|
---|
92 |
|
---|
93 | }
|
---|
94 | }
|
---|