Changeset 10940


Ignore:
Timestamp:
06/04/14 13:22:03 (8 years ago)
Author:
tsteinre
Message:
  • fixed CopyColumnTransformation inheritance
  • created a non-generic version of Transformation
Location:
branches/DataPreprocessing
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TransformationToSymbolicTreeMapper.cs

    r10878 r10940  
    4646      } else if (transformation is ShiftStandardDistributionTransformation) {
    4747        return GenerateModelForShiftStandardDistributionTransformation();
     48      } else if (transformation is CopyColumnTransformation) {
     49        // TODO
    4850      }
    4951      throw new NotImplementedException();
  • branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis.Transformations/3.4/CopyColumnTransformation.cs

    r10935 r10940  
    3030namespace HeuristicLab.Problems.DataAnalysis.Transformations {
    3131  [Item("CopyColumnTransformation", "Represents a transformation which represents a copied Column.")]
    32   public class CopyColumnTransformation<T> : Transformation<T> {
     32  public class CopyColumnTransformation : Transformation {
    3333    protected const string CopiedColumnNameParameterName = "CopiedColumnName";
    3434
     
    4040
    4141    #region properties
     42    public override string ShortName {
     43      get { return "Cpy"; }
     44    }
    4245    public string CopiedColumnName {
    4346      get { return CopiedColumnNameParameter.Value.Value; }
     
    4750    [StorableConstructor]
    4851    protected CopyColumnTransformation(bool deserializing) : base(deserializing) { }
    49     protected CopyColumnTransformation(CopyColumnTransformation<T> original, Cloner cloner)
     52    protected CopyColumnTransformation(CopyColumnTransformation original, Cloner cloner)
    5053      : base(original, cloner) {
    5154    }
     
    5659
    5760    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;
     61      return new CopyColumnTransformation(this, cloner);
    7062    }
    7163  }
  • branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis.Transformations/3.4/Transformation.cs

    r10932 r10940  
    2929
    3030namespace HeuristicLab.Problems.DataAnalysis.Transformations {
     31
    3132  [Item("Transformation", "Represents the base class for a transformation.")]
    3233  [StorableClass]
    33   public abstract class Transformation<T> : ParameterizedNamedItem, ITransformation<T> {
     34  public abstract class Transformation : ParameterizedNamedItem, ITransformation {
    3435    protected const string ColumnParameterName = "Column";
    3536    #region parameter properties
     
    4950    [StorableConstructor]
    5051    protected Transformation(bool deserializing) : base(deserializing) { }
    51     protected Transformation(Transformation<T> original, Cloner cloner) : base(original, cloner) { }
     52    protected Transformation(Transformation original, Cloner cloner) : base(original, cloner) { }
    5253    protected Transformation(IEnumerable<string> allowedColumns) {
    5354      var allowed = new ItemSet<StringValue>(allowedColumns.Select(e => new StringValue(e)));
    5455      Parameters.Add(new ConstrainedValueParameter<StringValue>(ColumnParameterName, "Column used for the Transformation", allowed));
    5556    }
     57  }
     58
     59  [Item("Transformation", "Represents the base class for a transformation.")]
     60  [StorableClass]
     61  public abstract class Transformation<T> : Transformation, ITransformation<T> {
     62
     63    [StorableConstructor]
     64    protected Transformation(bool deserializing) : base(deserializing) { }
     65    protected Transformation(Transformation<T> original, Cloner cloner) : base(original, cloner) { }
     66    protected Transformation(IEnumerable<string> allowedColumns):base(allowedColumns) { }
    5667
    5768    public abstract IEnumerable<T> Apply(IEnumerable<T> data);
    5869
    5970    public abstract bool Check(IEnumerable<T> data, out string errorMsg);
    60 
    61     #region IParameterizedItem Members
    62 
    63     public new IKeyedItemCollection<string, IParameter> Parameters {
    64       get { throw new System.NotImplementedException(); }
    65     }
    66 
    67     #endregion
    6871  }
    6972}
Note: See TracChangeset for help on using the changeset viewer.