Free cookie consent management tool by TermsFeed Policy Generator

source: branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis.Transformations/3.3/CopyColumnTransformation.cs @ 10909

Last change on this file since 10909 was 10778, checked in by pfleck, 11 years ago
  • Added CheckedTransformationCollectionView for providing an own type selector dialog.
File size: 2.6 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2013 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
22using System.Collections.Generic;
23
24using HeuristicLab.Common;
25using HeuristicLab.Core;
26using HeuristicLab.Data;
27using HeuristicLab.Parameters;
28using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
29
30namespace HeuristicLab.Problems.DataAnalysis.Transformations {
31  [Item("CopyColumnTransformation", "Represents a transformation which represents a copied Column.")]
32  public class CopyColumnTransformation<T> : Transformation<T> {
33    protected const string CopiedColumnNameParameterName = "CopiedColumnName";
34
35    #region Parameters
36    public IValueParameter<StringValue> CopiedColumnNameParameter {
37      get { return (IValueParameter<StringValue>)Parameters[CopiedColumnNameParameterName]; }
38    }
39    #endregion
40
41    #region properties
42    public string CopiedColumnName {
43      get { return CopiedColumnNameParameter.Value.Value; }
44    }
45    #endregion
46
47    [StorableConstructor]
48    protected CopyColumnTransformation(bool deserializing) : base(deserializing) { }
49    protected CopyColumnTransformation(CopyColumnTransformation<T> original, Cloner cloner)
50      : base(original, cloner) {
51    }
52    public CopyColumnTransformation(IEnumerable<string> allowedColumns)
53      : base(allowedColumns) {
54      Parameters.Add(new ValueParameter<StringValue>(CopiedColumnNameParameterName, "Name for the copied column", new StringValue()));
55    }
56
57    public override IDeepCloneable Clone(Cloner cloner) {
58      return new CopyColumnTransformation<T>(this, cloner);
59    }
60
61    public override IEnumerable<T> Apply(IEnumerable<T> data) {
62      foreach (T a in data) {
63        yield return a;
64      }
65    }
66
67    public override bool Check(IEnumerable<T> data, out string errorMsg) {
68      errorMsg = "";
69      return true;
70    }
71  }
72}
Note: See TracBrowser for help on using the repository browser.