Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/19/17 11:24:43 (7 years ago)
Author:
pfleck
Message:

#2809: Removed TransactionalPreprocessingData and moved relevant code to PreprocessingData.

Location:
branches/DataPreprocessing Cleanup
Files:
2 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing.Views/3.4/DataGridContentView.cs

    r15110 r15270  
    167167
    168168      ReplaceTransaction(() => {
    169         Content.PreProcessingData.InTransaction(() => {
     169        Content.PreprocessingData.InTransaction(() => {
    170170          for (int row = containsHeader ? 1 : 0; row < values.GetLength(1); row++) {
    171171            for (int col = 0; col < values.GetLength(0); col++) {
     
    177177              if (string.IsNullOrWhiteSpace(firstRow[i]))
    178178                firstRow[i] = string.Format("<{0}>", i);
    179             Content.PreProcessingData.RenameColumns(firstRow);
     179            Content.PreprocessingData.RenameColumns(firstRow);
    180180          }
    181181        });
     
    224224      if (e.Button == MouseButtons.Middle) {
    225225        int newIndex = e.ColumnIndex >= 0 ? e.ColumnIndex : 0;
    226         Content.PreProcessingData.InsertColumn<double>(newIndex.ToString(), newIndex);
     226        Content.PreprocessingData.InsertColumn<double>(newIndex.ToString(), newIndex);
    227227      } else if (e.Button == MouseButtons.Right && Content.SortableView) {
    228228        SortColumn(e.ColumnIndex);
     
    235235        if (e.Button == MouseButtons.Middle) {
    236236          int newIndex = e.RowIndex >= 0 ? e.RowIndex : 0;
    237           Content.PreProcessingData.InsertRow(newIndex);
     237          Content.PreprocessingData.InsertRow(newIndex);
    238238        }
    239239      }
     
    531531            medianToolStripMenuItem_Selection.Enabled =
    532532            randomToolStripMenuItem_Column.Enabled =
    533             randomToolStripMenuItem_Selection.Enabled = !Content.PreProcessingData.AreAllStringColumns(columnIndices);
     533            randomToolStripMenuItem_Selection.Enabled = !Content.PreprocessingData.AreAllStringColumns(columnIndices);
    534534
    535535          smoothingToolStripMenuItem_Column.Enabled =
    536536            interpolationToolStripMenuItem_Column.Enabled = !dataGridView.SelectedCells.Contains(dataGridView[e.ColumnIndex, 0])
    537537            && !dataGridView.SelectedCells.Contains(dataGridView[e.ColumnIndex, Content.Rows - 1])
    538             && !Content.PreProcessingData.AreAllStringColumns(columnIndices);
     538            && !Content.PreprocessingData.AreAllStringColumns(columnIndices);
    539539
    540540          replaceValueOverColumnToolStripMenuItem.Visible = true;
     
    675675
    676676    private void addRowButton_Click(object sender, EventArgs e) {
    677       Content.PreProcessingData.InsertRow(Content.Rows);
     677      Content.PreprocessingData.InsertRow(Content.Rows);
    678678    }
    679679
    680680    private void addColumnButton_Click(object sender, EventArgs e) {
    681       Content.PreProcessingData.InsertColumn<double>(Content.Columns.ToString(), Content.Columns);
     681      Content.PreprocessingData.InsertColumn<double>(Content.Columns.ToString(), Content.Columns);
    682682    }
    683683
     
    686686
    687687      if (renameDialog.ShowDialog(this) == DialogResult.OK) {
    688         Content.PreProcessingData.RenameColumns(renameDialog.ColumnNames);
     688        Content.PreprocessingData.RenameColumns(renameDialog.ColumnNames);
    689689      }
    690690    }
     
    693693      foreach (DataGridViewColumn column in DataGridView.Columns) {
    694694        var variable = column.HeaderText;
    695         bool isInputTarget = Content.PreProcessingData.InputVariables.Contains(variable)
    696           || Content.PreProcessingData.TargetVariable == variable;
     695        bool isInputTarget = Content.PreprocessingData.InputVariables.Contains(variable)
     696          || Content.PreprocessingData.TargetVariable == variable;
    697697        column.Visible = isInputTarget;
    698698      }
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Content/CorrelationMatrixContent.cs

    r15110 r15270  
    3333
    3434    public PreprocessingContext Context { get; private set; }
    35     public ITransactionalPreprocessingData PreprocessingData {
     35    public IPreprocessingData PreprocessingData {
    3636      get { return Context.Data; }
    3737    }
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Content/DataCompletenessChartContent.cs

    r15269 r15270  
    3232    }
    3333
    34     public ITransactionalPreprocessingData PreprocessingData { get; private set; }
     34    public IPreprocessingData PreprocessingData { get; private set; }
    3535
    36     public DataCompletenessChartContent(ITransactionalPreprocessingData preprocessingData) {
     36    public DataCompletenessChartContent(IPreprocessingData preprocessingData) {
    3737      PreprocessingData = preprocessingData;
    3838    }
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Content/DataGridContent.cs

    r15110 r15270  
    3636    }
    3737
    38     public ITransactionalPreprocessingData PreProcessingData { get; private set; }
     38    public IPreprocessingData PreprocessingData { get; private set; }
    3939
    4040    public ManipulationLogic ManipulationLogic { get; private set; }
     
    4242
    4343    public int Rows {
    44       get { return PreProcessingData.Rows; }
     44      get { return PreprocessingData.Rows; }
    4545      set { }
    4646    }
    4747
    4848    public int Columns {
    49       get { return PreProcessingData.Columns; }
     49      get { return PreprocessingData.Columns; }
    5050      set { }
    5151    }
    5252
    5353    public IEnumerable<string> ColumnNames {
    54       get { return PreProcessingData.VariableNames; }
     54      get { return PreprocessingData.VariableNames; }
    5555      set { }
    5656    }
     
    7171
    7272    public IDictionary<int, IList<int>> Selection {
    73       get { return PreProcessingData.Selection; }
    74       set { PreProcessingData.Selection = value; }
     73      get { return PreprocessingData.Selection; }
     74      set { PreprocessingData.Selection = value; }
    7575    }
    7676
    77     public DataGridContent(ITransactionalPreprocessingData preProcessingData, ManipulationLogic theManipulationLogic, FilterLogic theFilterLogic) {
     77    public DataGridContent(IPreprocessingData preprocessingData, ManipulationLogic theManipulationLogic, FilterLogic theFilterLogic) {
    7878      ManipulationLogic = theManipulationLogic;
    7979      FilterLogic = theFilterLogic;
    80       PreProcessingData = preProcessingData;
     80      PreprocessingData = preprocessingData;
    8181    }
    8282
     
    9090
    9191    public void DeleteRows(IEnumerable<int> rows) {
    92       PreProcessingData.DeleteRowsWithIndices(rows);
     92      PreprocessingData.DeleteRowsWithIndices(rows);
    9393    }
    9494
    9595    public void DeleteColumn(int column) {
    96       PreProcessingData.DeleteColumn(column);
     96      PreprocessingData.DeleteColumn(column);
    9797    }
    9898
    9999    public bool Validate(string value, out string errorMessage, int columnIndex) {
    100       return PreProcessingData.Validate(value, out errorMessage, columnIndex);
     100      return PreprocessingData.Validate(value, out errorMessage, columnIndex);
    101101    }
    102102
    103103    public string GetValue(int rowIndex, int columnIndex) {
    104       return PreProcessingData.GetCellAsString(columnIndex, rowIndex);
     104      return PreprocessingData.GetCellAsString(columnIndex, rowIndex);
    105105    }
    106106
    107107    public bool SetValue(string value, int rowIndex, int columnIndex) {
    108       return PreProcessingData.SetValue(value, columnIndex, rowIndex);
     108      return PreprocessingData.SetValue(value, columnIndex, rowIndex);
    109109    }
    110110
    111111    public event DataPreprocessingChangedEventHandler Changed {
    112       add { PreProcessingData.Changed += value; }
    113       remove { PreProcessingData.Changed -= value; }
     112      add { PreprocessingData.Changed += value; }
     113      remove { PreprocessingData.Changed -= value; }
    114114    }
    115115
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Content/StatisticsContent.cs

    r15110 r15270  
    3131    }
    3232
    33     public ITransactionalPreprocessingData PreprocessingData { get; private set; }
     33    public IPreprocessingData PreprocessingData { get; private set; }
    3434    public StatisticsLogic StatisticsLogic { get; private set; }
    3535
    36     public StatisticsContent(ITransactionalPreprocessingData preProcessingData, StatisticsLogic statisticsLogic) {
     36    public StatisticsContent(IPreprocessingData preProcessingData, StatisticsLogic statisticsLogic) {
    3737      PreprocessingData = preProcessingData;
    3838      StatisticsLogic = statisticsLogic;
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Data/FilteredPreprocessingData.cs

    r15269 r15270  
    2525using HeuristicLab.Core;
    2626using HeuristicLab.Data;
     27using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2728using HeuristicLab.Problems.DataAnalysis;
    2829
    2930namespace HeuristicLab.DataPreprocessing {
     31  [Item("FilteredPreprocessingData", "Represents filtered data used for preprocessing.")]
     32  [StorableClass]
    3033  public sealed class FilteredPreprocessingData : NamedItem, IFilteredPreprocessingData {
    31     private readonly ITransactionalPreprocessingData originalData;
    32     private ITransactionalPreprocessingData filteredData;
    33 
    34     public IntRange TrainingPartition {
    35       get { return originalData.TrainingPartition; }
    36     }
    37 
    38     public IntRange TestPartition {
    39       get { return originalData.TestPartition; }
    40     }
    41 
    42     public IList<ITransformation> Transformations {
    43       get { return originalData.Transformations; }
    44     }
    45 
    46     public IEnumerable<string> VariableNames {
    47       get { return ActiveData.VariableNames; }
    48     }
    49 
    50     public IList<string> InputVariables { get { return ActiveData.InputVariables; } }
    51     public string TargetVariable { get { return ActiveData.TargetVariable; } } // optional
    52 
    53     public IDictionary<int, IList<int>> Selection {
    54       get { return originalData.Selection; }
    55       set { originalData.Selection = value; }
    56     }
    57 
    58     public int Columns {
    59       get { return ActiveData.Columns; }
    60     }
    61 
    62     public int Rows {
    63       get { return ActiveData.Rows; }
    64     }
    65 
    66     public ITransactionalPreprocessingData ActiveData {
     34
     35    [Storable]
     36    private readonly IPreprocessingData originalData;
     37    [Storable]
     38    private IPreprocessingData filteredData;
     39
     40    public IPreprocessingData ActiveData {
    6741      get { return IsFiltered ? filteredData : originalData; }
    6842    }
    6943
    70     public bool IsUndoAvailable {
    71       get { return IsFiltered ? false : originalData.IsUndoAvailable; }
    72     }
    73 
    74     public bool IsFiltered {
    75       get { return filteredData != null; }
    76     }
    77 
    78 
    79     public FilteredPreprocessingData(ITransactionalPreprocessingData preporcessingData)
     44    #region Constructor, Cloning & Persistance
     45    public FilteredPreprocessingData(IPreprocessingData preporcessingData)
    8046      : base() {
    8147      originalData = preporcessingData;
     
    9258    }
    9359
     60    [StorableConstructor]
     61    private FilteredPreprocessingData(bool deserializing)
     62      : base(deserializing) { }
     63    #endregion
     64
     65    #region Cells
    9466    public bool IsCellEmpty(int columnIndex, int rowIndex) {
    9567      return ActiveData.IsCellEmpty(columnIndex, rowIndex);
     
    12193    }
    12294
     95    public bool SetValue(string value, int columnIndex, int rowIndex) {
     96      if (IsFiltered)
     97        throw new InvalidOperationException("SetValue not possible while data is filtered");
     98      return originalData.SetValue(value, columnIndex, rowIndex);
     99    }
     100
     101    public int Columns {
     102      get { return ActiveData.Columns; }
     103    }
     104
     105    public int Rows {
     106      get { return ActiveData.Rows; }
     107    }
     108    #endregion
     109
     110    #region Rows
    123111    public void InsertRow(int rowIndex) {
    124112      if (IsFiltered)
     
    133121
    134122      originalData.DeleteRow(rowIndex);
     123    }
     124
     125    public void DeleteRowsWithIndices(IEnumerable<int> rows) {
     126      if (IsFiltered)
     127        throw new InvalidOperationException("DeleteRowsWithIndices not possible while data is filtered");
     128
     129      originalData.DeleteRowsWithIndices(rows);
    135130    }
    136131
     
    160155    }
    161156
     157    public bool AreAllStringColumns(IEnumerable<int> columnIndices) {
     158      return originalData.AreAllStringColumns(columnIndices);
     159    }
     160    #endregion
     161
     162    #region Variables
     163    public IEnumerable<string> VariableNames {
     164      get { return ActiveData.VariableNames; }
     165    }
     166    public IEnumerable<string> GetDoubleVariableNames() {
     167      return originalData.GetDoubleVariableNames();
     168    }
    162169    public string GetVariableName(int columnIndex) {
    163170      return ActiveData.GetVariableName(columnIndex);
     
    172179    }
    173180
     181    public IList<string> InputVariables {
     182      get { return ActiveData.InputVariables; }
     183    }
     184
     185    public string TargetVariable {
     186      get { return ActiveData.TargetVariable; }
     187    } // optional
     188    #endregion
     189
     190    #region Partitions
     191    public IntRange TrainingPartition {
     192      get { return originalData.TrainingPartition; }
     193    }
     194
     195    public IntRange TestPartition {
     196      get { return originalData.TestPartition; }
     197    }
     198    #endregion
     199
     200    #region Transformations
     201    public IList<ITransformation> Transformations {
     202      get { return originalData.Transformations; }
     203    }
     204    #endregion
     205
     206    #region Validation
     207    public bool Validate(string value, out string errorMessage, int columnIndex) {
     208      return originalData.Validate(value, out errorMessage, columnIndex);
     209    }
     210    #endregion
     211
     212    #region Import & Export
     213    public void Import(IDataAnalysisProblemData problemData) {
     214      if (IsFiltered)
     215        throw new InvalidOperationException("Import not possible while data is filtered");
     216      originalData.Import(problemData);
     217    }
     218
    174219    public Dataset ExportToDataset() {
    175220      return originalData.ExportToDataset();
    176221    }
    177 
     222    #endregion
     223
     224    #region Selection
     225    public IDictionary<int, IList<int>> Selection {
     226      get { return originalData.Selection; }
     227      set { originalData.Selection = value; }
     228    }
     229
     230    public void ClearSelection() {
     231      originalData.ClearSelection();
     232    }
     233
     234    public event EventHandler SelectionChanged {
     235      add { originalData.SelectionChanged += value; }
     236      remove { originalData.SelectionChanged -= value; }
     237    }
     238    #endregion
     239
     240    #region Transactions
     241    public event DataPreprocessingChangedEventHandler Changed {
     242      add { originalData.Changed += value; }
     243      remove { originalData.Changed -= value; }
     244    }
     245
     246    public bool IsUndoAvailable {
     247      get { return IsFiltered ? false : originalData.IsUndoAvailable; }
     248    }
     249
     250    public void Undo() {
     251      if (IsFiltered)
     252        throw new InvalidOperationException("Undo not possible while data is filtered");
     253
     254      originalData.Undo();
     255    }
     256
     257    public void InTransaction(Action action, DataPreprocessingChangedEventType type = DataPreprocessingChangedEventType.Any) {
     258      if (IsFiltered)
     259        throw new InvalidOperationException("Transaction not possible while data is filtered");
     260      originalData.InTransaction(action, type);
     261    }
     262
     263    public void BeginTransaction(DataPreprocessingChangedEventType type) {
     264      if (IsFiltered)
     265        throw new InvalidOperationException("Transaction not possible while data is filtered");
     266      originalData.BeginTransaction(type);
     267    }
     268
     269    public void EndTransaction() {
     270      originalData.EndTransaction();
     271    }
     272    #endregion
     273
     274    #region Filters
    178275    public void SetFilter(bool[] rowFilters) {
    179       filteredData = (ITransactionalPreprocessingData)originalData.Clone();
     276      filteredData = (IPreprocessingData)originalData.Clone();
    180277      filteredData.InTransaction(() => {
    181278        for (int row = (rowFilters.Length - 1); row >= 0; --row) {
     
    210307    }
    211308
     309    public bool IsFiltered {
     310      get { return filteredData != null; }
     311    }
     312
     313    public event EventHandler FilterChanged;
     314
    212315    private void OnFilterChanged() {
    213316      if (FilterChanged != null) {
     
    215318      }
    216319    }
    217 
    218     public event DataPreprocessingChangedEventHandler Changed {
    219       add { originalData.Changed += value; }
    220       remove { originalData.Changed -= value; }
    221     }
    222 
    223     public bool SetValue(string value, int columnIndex, int rowIndex) {
    224       if (IsFiltered)
    225         throw new InvalidOperationException("SetValue not possible while data is filtered");
    226       return originalData.SetValue(value, columnIndex, rowIndex);
    227     }
    228 
    229     public bool AreAllStringColumns(IEnumerable<int> columnIndices) {
    230       return originalData.AreAllStringColumns(columnIndices);
    231     }
    232 
    233     public void DeleteRowsWithIndices(IEnumerable<int> rows) {
    234       if (IsFiltered)
    235         throw new InvalidOperationException("DeleteRowsWithIndices not possible while data is filtered");
    236 
    237       originalData.DeleteRowsWithIndices(rows);
    238     }
    239 
    240     public void Undo() {
    241       if (IsFiltered)
    242         throw new InvalidOperationException("Undo not possible while data is filtered");
    243 
    244       originalData.Undo();
    245     }
    246 
    247     public void InTransaction(Action action, DataPreprocessingChangedEventType type = DataPreprocessingChangedEventType.Any) {
    248       if (IsFiltered)
    249         throw new InvalidOperationException("Transaction not possible while data is filtered");
    250       originalData.InTransaction(action, type);
    251     }
    252 
    253     public void BeginTransaction(DataPreprocessingChangedEventType type) {
    254       if (IsFiltered)
    255         throw new InvalidOperationException("Transaction not possible while data is filtered");
    256       originalData.BeginTransaction(type);
    257     }
    258 
    259     public void EndTransaction() {
    260       originalData.EndTransaction();
    261     }
    262 
    263     public IEnumerable<string> GetDoubleVariableNames() {
    264       return originalData.GetDoubleVariableNames();
    265     }
    266 
    267     public void ClearSelection() {
    268       originalData.ClearSelection();
    269     }
    270 
    271     public event EventHandler SelectionChanged {
    272       add { originalData.SelectionChanged += value; }
    273       remove { originalData.SelectionChanged -= value; }
    274     }
    275 
    276     #region IPreprocessingData Members
    277     public bool Validate(string value, out string errorMessage, int columnIndex) {
    278       return originalData.Validate(value, out errorMessage, columnIndex);
    279     }
    280 
    281     public event EventHandler FilterChanged;
    282320    #endregion
    283321  }
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Data/IFilteredPreprocessingData.cs

    r14185 r15270  
    2323
    2424namespace HeuristicLab.DataPreprocessing {
    25   public interface IFilteredPreprocessingData : ITransactionalPreprocessingData {
     25  public interface IFilteredPreprocessingData : IPreprocessingData {
     26    #region Filters
    2627    void SetFilter(bool[] rowFilters);
    2728    void PersistFilter();
     
    3031
    3132    event EventHandler FilterChanged;
     33    #endregion
    3234  }
    3335}
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Data/IPreprocessingData.cs

    r15269 r15270  
    2828namespace HeuristicLab.DataPreprocessing {
    2929  public interface IPreprocessingData : INamedItem {
     30    #region Cells
    3031    bool IsCellEmpty(int columnIndex, int rowIndex);
    3132    T GetCell<T>(int columnIndex, int rowIndex);
     
    4041    bool SetValue(string value, int columnIndex, int rowIndex);
    4142
     43    int Columns { get; }
     44    int Rows { get; }
     45    #endregion
     46
     47    #region Rows
    4248    void InsertRow(int rowIndex);
    4349    void DeleteRow(int rowIndex);
     
    5157
    5258    bool AreAllStringColumns(IEnumerable<int> columnIndices);
    53     bool Validate(string value, out string errorMessage, int columnIndex);
     59    #endregion
    5460
    55     IntRange TrainingPartition { get; }
    56     IntRange TestPartition { get; }
    57 
    58     IList<ITransformation> Transformations { get; }
    59 
     61    #region Variables
    6062    IEnumerable<string> VariableNames { get; }
    6163    IEnumerable<string> GetDoubleVariableNames();
     
    6769    IList<string> InputVariables { get; }
    6870    string TargetVariable { get; } // optional
     71    #endregion
    6972
    70     int Columns { get; }
    71     int Rows { get; }
     73    #region Partitions
     74    IntRange TrainingPartition { get; }
     75    IntRange TestPartition { get; }
     76    #endregion
    7277
     78    #region Transformations
     79    IList<ITransformation> Transformations { get; }
     80    #endregion
     81
     82    #region Validation
     83    bool Validate(string value, out string errorMessage, int columnIndex);
     84    #endregion
     85
     86    #region Import & Export
     87    void Import(IDataAnalysisProblemData problemData);
    7388    Dataset ExportToDataset();
     89    #endregion
    7490
     91    #region Selection
    7592    IDictionary<int, IList<int>> Selection { get; set; }
    7693    void ClearSelection();
    7794
    7895    event EventHandler SelectionChanged;
     96    #endregion
     97
     98    #region Transactions
     99    event DataPreprocessingChangedEventHandler Changed;
     100
     101    bool IsUndoAvailable { get; }
     102    void Undo();
     103    void InTransaction(Action action, DataPreprocessingChangedEventType type = DataPreprocessingChangedEventType.Any);
     104    void BeginTransaction(DataPreprocessingChangedEventType type);
     105    void EndTransaction();
     106    #endregion
    79107  }
    80108}
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Data/PreprocessingData.cs

    r15269 r15270  
    2323using System.Collections;
    2424using System.Collections.Generic;
     25using System.Globalization;
    2526using System.Linq;
    2627using HeuristicLab.Common;
    2728using HeuristicLab.Core;
    2829using HeuristicLab.Data;
     30using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2931using HeuristicLab.Problems.DataAnalysis;
    3032
     
    3234
    3335  [Item("PreprocessingData", "Represents data used for preprocessing.")]
    34   public abstract class PreprocessingData : NamedItem, IPreprocessingData {
    35     public IntRange TrainingPartition { get; set; }
    36     public IntRange TestPartition { get; set; }
    37 
    38     public IList<ITransformation> Transformations { get; protected set; }
    39 
     36  [StorableClass]
     37  public class PreprocessingData : NamedItem, IPreprocessingData {
     38
     39    [Storable]
    4040    protected IList<IList> variableValues;
     41    [Storable]
    4142    protected IList<string> variableNames;
    4243
    43     public IEnumerable<string> VariableNames {
    44       get { return variableNames; }
    45     }
    46 
    47     public IEnumerable<string> GetDoubleVariableNames() {
    48       var doubleVariableNames = new List<string>();
    49       for (int i = 0; i < Columns; ++i) {
    50         if (VariableHasType<double>(i)) {
    51           doubleVariableNames.Add(variableNames[i]);
    52         }
    53       }
    54       return doubleVariableNames;
    55     }
    56 
    57     public IList<string> InputVariables { get; private set; }
    58     public string TargetVariable { get; private set; } // optional
    59 
    60     public int Columns {
    61       get { return variableNames.Count; }
    62     }
    63 
    64     public int Rows {
    65       get { return variableValues.Count > 0 ? variableValues[0].Count : 0; }
    66     }
    67 
    68     protected IDictionary<int, IList<int>> selection;
    69     public IDictionary<int, IList<int>> Selection {
    70       get { return selection; }
    71       set {
    72         selection = value;
    73         OnSelectionChanged();
    74       }
     44    #region Constructor, Cloning & Persistance
     45    public PreprocessingData(IDataAnalysisProblemData problemData)
     46      : base() {
     47      Name = "Preprocessing Data";
     48
     49      Transformations = new List<ITransformation>();
     50      selection = new Dictionary<int, IList<int>>();
     51
     52      Import(problemData);
     53
     54      RegisterEventHandler();
    7555    }
    7656
     
    8868      RegisterEventHandler();
    8969    }
    90 
    91     protected PreprocessingData(IDataAnalysisProblemData problemData)
    92       : base() {
    93       Name = "Preprocessing Data";
    94 
    95       Transformations = new List<ITransformation>();
    96       selection = new Dictionary<int, IList<int>>();
    97 
    98       Import(problemData);
    99 
     70    public override IDeepCloneable Clone(Cloner cloner) {
     71      return new PreprocessingData(this, cloner);
     72    }
     73
     74    [StorableConstructor]
     75    protected PreprocessingData(bool deserializing)
     76      : base(deserializing) { }
     77    [StorableHook(HookType.AfterDeserialization)]
     78    private void AfterDeserialization() {
    10079      RegisterEventHandler();
    10180    }
    10281
     82    private void RegisterEventHandler() {
     83      Changed += (s, e) => {
     84        switch (e.Type) {
     85          case DataPreprocessingChangedEventType.DeleteRow:
     86          case DataPreprocessingChangedEventType.Any:
     87          case DataPreprocessingChangedEventType.Transformation:
     88            int maxRowIndex = Math.Max(0, Rows);
     89            TrainingPartition.Start = Math.Min(TrainingPartition.Start, maxRowIndex);
     90            TrainingPartition.End = Math.Min(TrainingPartition.End, maxRowIndex);
     91            TestPartition.Start = Math.Min(TestPartition.Start, maxRowIndex);
     92            TestPartition.End = Math.Min(TestPartition.End, maxRowIndex);
     93            break;
     94        }
     95      };
     96    }
     97    #endregion
     98
     99    #region Cells
     100    public bool IsCellEmpty(int columnIndex, int rowIndex) {
     101      var value = variableValues[columnIndex][rowIndex];
     102      return IsMissingValue(value);
     103    }
     104
     105    public T GetCell<T>(int columnIndex, int rowIndex) {
     106      return (T)variableValues[columnIndex][rowIndex];
     107    }
     108
     109    public void SetCell<T>(int columnIndex, int rowIndex, T value) {
     110      SaveSnapshot(DataPreprocessingChangedEventType.ChangeItem, columnIndex, rowIndex);
     111
     112      for (int i = Rows; i <= rowIndex; i++)
     113        InsertRow(i);
     114      for (int i = Columns; i <= columnIndex; i++)
     115        InsertColumn<T>(i.ToString(), i);
     116
     117      variableValues[columnIndex][rowIndex] = value;
     118      if (!IsInTransaction)
     119        OnChanged(DataPreprocessingChangedEventType.ChangeItem, columnIndex, rowIndex);
     120    }
     121
     122    public string GetCellAsString(int columnIndex, int rowIndex) {
     123      return variableValues[columnIndex][rowIndex].ToString();
     124    }
     125
     126    public IList<T> GetValues<T>(int columnIndex, bool considerSelection) {
     127      if (considerSelection) {
     128        var list = new List<T>();
     129        foreach (var rowIdx in selection[columnIndex]) {
     130          list.Add((T)variableValues[columnIndex][rowIdx]);
     131        }
     132        return list;
     133      } else {
     134        return (IList<T>)variableValues[columnIndex];
     135      }
     136    }
     137
     138    public void SetValues<T>(int columnIndex, IList<T> values) {
     139      SaveSnapshot(DataPreprocessingChangedEventType.ChangeColumn, columnIndex, -1);
     140      if (VariableHasType<T>(columnIndex)) {
     141        variableValues[columnIndex] = (IList)values;
     142      } else {
     143        throw new ArgumentException("The datatype of column " + columnIndex + " must be of type " + variableValues[columnIndex].GetType().Name + " but was " + typeof(T).Name);
     144      }
     145      if (!IsInTransaction)
     146        OnChanged(DataPreprocessingChangedEventType.ChangeColumn, columnIndex, -1);
     147    }
     148
     149    public bool SetValue(string value, int columnIndex, int rowIndex) {
     150      bool valid = false;
     151      if (VariableHasType<double>(columnIndex)) {
     152        double val;
     153        valid = double.TryParse(value, out val);
     154        if (valid)
     155          SetCell(columnIndex, rowIndex, val);
     156      } else if (VariableHasType<string>(columnIndex)) {
     157        valid = value != null;
     158        if (valid)
     159          SetCell(columnIndex, rowIndex, value);
     160      } else if (VariableHasType<DateTime>(columnIndex)) {
     161        DateTime date;
     162        valid = DateTime.TryParse(value, out date);
     163        if (valid)
     164          SetCell(columnIndex, rowIndex, date);
     165      } else {
     166        throw new ArgumentException("column " + columnIndex + " contains a non supported type.");
     167      }
     168
     169      if (!IsInTransaction)
     170        OnChanged(DataPreprocessingChangedEventType.ChangeColumn, columnIndex, -1);
     171
     172      return valid;
     173    }
     174
     175    public int Columns {
     176      get { return variableNames.Count; }
     177    }
     178
     179    public int Rows {
     180      get { return variableValues.Count > 0 ? variableValues[0].Count : 0; }
     181    }
     182
     183    public static bool IsMissingValue(object value) {
     184      if (value is double) return double.IsNaN((double)value);
     185      if (value is string) return string.IsNullOrEmpty((string)value);
     186      if (value is DateTime) return ((DateTime)value).Equals(DateTime.MinValue);
     187      throw new ArgumentException();
     188    }
     189    #endregion
     190
     191    #region Rows
     192    public void InsertRow(int rowIndex) {
     193      SaveSnapshot(DataPreprocessingChangedEventType.DeleteRow, -1, rowIndex);
     194      foreach (IList column in variableValues) {
     195        Type type = column.GetType().GetGenericArguments()[0];
     196        column.Insert(rowIndex, type.IsValueType ? Activator.CreateInstance(type) : null);
     197      }
     198      if (TrainingPartition.Start <= rowIndex && rowIndex <= TrainingPartition.End) {
     199        TrainingPartition.End++;
     200        if (TrainingPartition.End <= TestPartition.Start) {
     201          TestPartition.Start++;
     202          TestPartition.End++;
     203        }
     204      } else if (TestPartition.Start <= rowIndex && rowIndex <= TestPartition.End) {
     205        TestPartition.End++;
     206        if (TestPartition.End <= TrainingPartition.Start) {
     207          TestPartition.Start++;
     208          TestPartition.End++;
     209        }
     210      }
     211      if (!IsInTransaction)
     212        OnChanged(DataPreprocessingChangedEventType.AddRow, -1, rowIndex);
     213    }
     214    public void DeleteRow(int rowIndex) {
     215      SaveSnapshot(DataPreprocessingChangedEventType.AddRow, -1, rowIndex);
     216      foreach (IList column in variableValues) {
     217        column.RemoveAt(rowIndex);
     218      }
     219      if (TrainingPartition.Start <= rowIndex && rowIndex <= TrainingPartition.End) {
     220        TrainingPartition.End--;
     221        if (TrainingPartition.End <= TestPartition.Start) {
     222          TestPartition.Start--;
     223          TestPartition.End--;
     224        }
     225      } else if (TestPartition.Start <= rowIndex && rowIndex <= TestPartition.End) {
     226        TestPartition.End--;
     227        if (TestPartition.End <= TrainingPartition.Start) {
     228          TestPartition.Start--;
     229          TestPartition.End--;
     230        }
     231      }
     232      if (!IsInTransaction)
     233        OnChanged(DataPreprocessingChangedEventType.DeleteRow, -1, rowIndex);
     234    }
     235    public void DeleteRowsWithIndices(IEnumerable<int> rows) {
     236      SaveSnapshot(DataPreprocessingChangedEventType.AddRow, -1, -1);
     237      foreach (int rowIndex in rows.OrderByDescending(x => x)) {
     238        foreach (IList column in variableValues) {
     239          column.RemoveAt(rowIndex);
     240        }
     241        if (TrainingPartition.Start <= rowIndex && rowIndex <= TrainingPartition.End) {
     242          TrainingPartition.End--;
     243          if (TrainingPartition.End <= TestPartition.Start) {
     244            TestPartition.Start--;
     245            TestPartition.End--;
     246          }
     247        } else if (TestPartition.Start <= rowIndex && rowIndex <= TestPartition.End) {
     248          TestPartition.End--;
     249          if (TestPartition.End <= TrainingPartition.Start) {
     250            TestPartition.Start--;
     251            TestPartition.End--;
     252          }
     253        }
     254      }
     255      if (!IsInTransaction)
     256        OnChanged(DataPreprocessingChangedEventType.DeleteRow, -1, -1);
     257    }
     258
     259    public void InsertColumn<T>(string variableName, int columnIndex) {
     260      SaveSnapshot(DataPreprocessingChangedEventType.DeleteColumn, columnIndex, -1);
     261      variableValues.Insert(columnIndex, new List<T>(Enumerable.Repeat(default(T), Rows)));
     262      variableNames.Insert(columnIndex, variableName);
     263      if (!IsInTransaction)
     264        OnChanged(DataPreprocessingChangedEventType.AddColumn, columnIndex, -1);
     265    }
     266
     267    public void DeleteColumn(int columnIndex) {
     268      SaveSnapshot(DataPreprocessingChangedEventType.AddColumn, columnIndex, -1);
     269      variableValues.RemoveAt(columnIndex);
     270      variableNames.RemoveAt(columnIndex);
     271      if (!IsInTransaction)
     272        OnChanged(DataPreprocessingChangedEventType.DeleteColumn, columnIndex, -1);
     273    }
     274
     275    public void RenameColumn(int columnIndex, string name) {
     276      SaveSnapshot(DataPreprocessingChangedEventType.ChangeColumn, columnIndex, -1);
     277      if (columnIndex < 0 || columnIndex > variableNames.Count)
     278        throw new ArgumentOutOfRangeException("columnIndex");
     279      variableNames[columnIndex] = name;
     280
     281      if (!IsInTransaction)
     282        OnChanged(DataPreprocessingChangedEventType.ChangeColumn, -1, -1);
     283    }
     284
     285    public void RenameColumns(IList<string> names) {
     286      if (names == null) throw new ArgumentNullException("names");
     287      if (names.Count != variableNames.Count) throw new ArgumentException("number of names must match the number of columns.", "names");
     288
     289      SaveSnapshot(DataPreprocessingChangedEventType.ChangeColumn, -1, -1);
     290      for (int i = 0; i < names.Count; i++)
     291        variableNames[i] = names[i];
     292
     293      if (!IsInTransaction)
     294        OnChanged(DataPreprocessingChangedEventType.ChangeColumn, -1, -1);
     295    }
     296
     297    public bool AreAllStringColumns(IEnumerable<int> columnIndices) {
     298      return columnIndices.All(x => VariableHasType<string>(x));
     299    }
     300    #endregion
     301
     302    #region Variables
     303    public IEnumerable<string> VariableNames {
     304      get { return variableNames; }
     305    }
     306
     307    public IEnumerable<string> GetDoubleVariableNames() {
     308      var doubleVariableNames = new List<string>();
     309      for (int i = 0; i < Columns; ++i) {
     310        if (VariableHasType<double>(i)) {
     311          doubleVariableNames.Add(variableNames[i]);
     312        }
     313      }
     314      return doubleVariableNames;
     315    }
     316
     317    public string GetVariableName(int columnIndex) {
     318      return variableNames[columnIndex];
     319    }
     320
     321    public int GetColumnIndex(string variableName) {
     322      return variableNames.IndexOf(variableName);
     323    }
     324
     325    public bool VariableHasType<T>(int columnIndex) {
     326      return columnIndex >= variableValues.Count || variableValues[columnIndex] is List<T>;
     327    }
     328
     329    public IList<string> InputVariables { get; private set; }
     330    public string TargetVariable { get; private set; } // optional
     331    #endregion
     332
     333    #region Partitions
     334    [Storable]
     335    public IntRange TrainingPartition { get; set; }
     336    [Storable]
     337    public IntRange TestPartition { get; set; }
     338    #endregion
     339
     340    #region Transformations
     341    [Storable]
     342    public IList<ITransformation> Transformations { get; protected set; }
     343    #endregion
     344
     345    #region Validation
     346    public bool Validate(string value, out string errorMessage, int columnIndex) {
     347      if (columnIndex < 0 || columnIndex > VariableNames.Count()) {
     348        throw new ArgumentOutOfRangeException("column index is out of range");
     349      }
     350
     351      bool valid = false;
     352      errorMessage = string.Empty;
     353      if (VariableHasType<double>(columnIndex)) {
     354        double val;
     355        valid = double.TryParse(value, out val);
     356        if (!valid) {
     357          errorMessage = "Invalid Value (Valid Value Format: \"" + FormatPatterns.GetDoubleFormatPattern() + "\")";
     358        }
     359      } else if (VariableHasType<string>(columnIndex)) {
     360        valid = value != null;
     361        if (!valid) {
     362          errorMessage = "Invalid Value (string must not be null)";
     363        }
     364      } else if (VariableHasType<DateTime>(columnIndex)) {
     365        DateTime date;
     366        valid = DateTime.TryParse(value, out date);
     367        if (!valid) {
     368          errorMessage = "Invalid Value (Valid Value Format: \"" + CultureInfo.CurrentCulture.DateTimeFormat + "\"";
     369        }
     370      } else {
     371        throw new ArgumentException("column " + columnIndex + " contains a non supported type.");
     372      }
     373
     374      return valid;
     375    }
     376    #endregion
     377
     378    #region Import & Export
    103379    public void Import(IDataAnalysisProblemData problemData) {
    104380      Dataset dataset = (Dataset)problemData.Dataset;
     
    107383      TargetVariable = (problemData is IRegressionProblemData) ? ((IRegressionProblemData)problemData).TargetVariable
    108384        : (problemData is IClassificationProblemData) ? ((IClassificationProblemData)problemData).TargetVariable
    109         : null;
     385          : null;
    110386
    111387      int columnIndex = 0;
     
    128404    }
    129405
    130     private void RegisterEventHandler() {
    131       Changed += (s, e) => {
    132         switch (e.Type) {
    133           case DataPreprocessingChangedEventType.DeleteRow:
    134             CheckPartitionRanges();
    135             break;
    136           case DataPreprocessingChangedEventType.Any:
    137             CheckPartitionRanges();
    138             break;
    139           case DataPreprocessingChangedEventType.Transformation:
    140             CheckPartitionRanges();
    141             break;
    142         }
    143       };
    144     }
    145 
    146     private void CheckPartitionRanges() {
    147       int maxRowIndex = Math.Max(0, Rows);
    148       TrainingPartition.Start = Math.Min(TrainingPartition.Start, maxRowIndex);
    149       TrainingPartition.End = Math.Min(TrainingPartition.End, maxRowIndex);
    150       TestPartition.Start = Math.Min(TestPartition.Start, maxRowIndex);
    151       TestPartition.End = Math.Min(TestPartition.End, maxRowIndex);
    152     }
    153 
    154     protected IList<IList> CopyVariableValues(IList<IList> original) {
    155       var copy = new List<IList>(original);
    156       for (int i = 0; i < original.Count; ++i) {
    157         copy[i] = (IList)Activator.CreateInstance(original[i].GetType(), original[i]);
    158       }
    159       return copy;
    160     }
    161 
    162     public static bool IsMissingValue(object value) {
    163       if (value is double) return double.IsNaN((double)value);
    164       if (value is string) return string.IsNullOrEmpty((string)value);
    165       if (value is DateTime) return ((DateTime)value).Equals(DateTime.MinValue);
    166       throw new ArgumentException();
    167     }
    168 
    169     #region IPreprocessingData Members
    170     public abstract bool IsCellEmpty(int columnIndex, int rowIndex);
    171     public abstract T GetCell<T>(int columnIndex, int rowIndex);
    172 
    173     public abstract void SetCell<T>(int columnIndex, int rowIndex, T value);
    174 
    175     public abstract string GetCellAsString(int columnIndex, int rowIndex);
    176 
    177     public abstract string GetVariableName(int columnIndex);
    178 
    179     public abstract int GetColumnIndex(string variableName);
    180 
    181     public abstract bool VariableHasType<T>(int columnIndex);
    182 
    183     public abstract IList<T> GetValues<T>(int columnIndex, bool considerSelection);
    184 
    185     public abstract void SetValues<T>(int columnIndex, IList<T> values);
    186 
    187     public abstract bool SetValue(string value, int columnIndex, int rowIndex);
    188 
    189     public abstract bool Validate(string value, out string errorMessage, int columnIndex);
    190 
    191     public abstract bool AreAllStringColumns(IEnumerable<int> columnIndices);
    192 
    193     public abstract void DeleteRowsWithIndices(IEnumerable<int> rows);
    194 
    195     public abstract void InsertRow(int rowIndex);
    196 
    197     public abstract void DeleteRow(int rowIndex);
    198 
    199     public abstract void InsertColumn<T>(string variableName, int columnIndex);
    200 
    201     public abstract void DeleteColumn(int columnIndex);
    202 
    203     public abstract void RenameColumn(int columnIndex, string name);
    204     public abstract void RenameColumns(IList<string> list);
    205 
    206     public abstract Dataset ExportToDataset();
    207 
    208     public abstract void ClearSelection();
    209 
    210     public abstract event EventHandler SelectionChanged;
    211     protected abstract void OnSelectionChanged();
     406    public Dataset ExportToDataset() {
     407      IList<IList> values = new List<IList>();
     408
     409      for (int i = 0; i < Columns; ++i) {
     410        values.Add(variableValues[i]);
     411      }
     412
     413      var dataset = new Dataset(variableNames, values);
     414      return dataset;
     415    }
     416    #endregion
     417
     418    #region Selection
     419    [Storable]
     420    protected IDictionary<int, IList<int>> selection;
     421    public IDictionary<int, IList<int>> Selection {
     422      get { return selection; }
     423      set {
     424        selection = value;
     425        OnSelectionChanged();
     426      }
     427    }
     428    public void ClearSelection() {
     429      Selection = new Dictionary<int, IList<int>>();
     430    }
     431
     432    public event EventHandler SelectionChanged;
     433    protected void OnSelectionChanged() {
     434      var listeners = SelectionChanged;
     435      if (listeners != null) listeners(this, EventArgs.Empty);
     436    }
     437    #endregion
     438
     439    #region Transactions
     440    // Stapshot/History are nost storable/cloneable on purpose
     441    private class Snapshot {
     442      public IList<IList> VariableValues { get; set; }
     443      public IList<string> VariableNames { get; set; }
     444
     445      public IntRange TrainingPartition { get; set; }
     446      public IntRange TestPartition { get; set; }
     447      public IList<ITransformation> Transformations { get; set; }
     448      public DataPreprocessingChangedEventType ChangedType { get; set; }
     449
     450      public int ChangedColumn { get; set; }
     451      public int ChangedRow { get; set; }
     452    }
    212453
    213454    public event DataPreprocessingChangedEventHandler Changed;
     
    216457      if (listeners != null) listeners(this, new DataPreprocessingChangedEventArgs(type, column, row));
    217458    }
     459
     460    private const int MAX_UNDO_DEPTH = 5;
     461
     462    private readonly IList<Snapshot> undoHistory = new List<Snapshot>();
     463    private readonly Stack<DataPreprocessingChangedEventType> eventStack = new Stack<DataPreprocessingChangedEventType>();
     464
     465    public bool IsInTransaction { get { return eventStack.Count > 0; } }
     466
     467    private void SaveSnapshot(DataPreprocessingChangedEventType changedType, int column, int row) {
     468      if (IsInTransaction) return;
     469
     470      var currentSnapshot = new Snapshot {
     471        VariableValues = CopyVariableValues(variableValues),
     472        VariableNames = new List<string>(variableNames),
     473        TrainingPartition = new IntRange(TrainingPartition.Start, TrainingPartition.End),
     474        TestPartition = new IntRange(TestPartition.Start, TestPartition.End),
     475        Transformations = new List<ITransformation>(Transformations),
     476        ChangedType = changedType,
     477        ChangedColumn = column,
     478        ChangedRow = row
     479      };
     480
     481      if (undoHistory.Count >= MAX_UNDO_DEPTH)
     482        undoHistory.RemoveAt(0);
     483
     484      undoHistory.Add(currentSnapshot);
     485    }
     486
     487    public bool IsUndoAvailable {
     488      get { return undoHistory.Count > 0; }
     489    }
     490
     491    public void Undo() {
     492      if (IsUndoAvailable) {
     493        Snapshot previousSnapshot = undoHistory[undoHistory.Count - 1];
     494        variableValues = previousSnapshot.VariableValues;
     495        variableNames = previousSnapshot.VariableNames;
     496        TrainingPartition = previousSnapshot.TrainingPartition;
     497        TestPartition = previousSnapshot.TestPartition;
     498        Transformations = previousSnapshot.Transformations;
     499        undoHistory.Remove(previousSnapshot);
     500        OnChanged(previousSnapshot.ChangedType,
     501          previousSnapshot.ChangedColumn,
     502          previousSnapshot.ChangedRow);
     503      }
     504    }
     505
     506    public void InTransaction(Action action, DataPreprocessingChangedEventType type = DataPreprocessingChangedEventType.Any) {
     507      BeginTransaction(type);
     508      action();
     509      EndTransaction();
     510    }
     511
     512    public void BeginTransaction(DataPreprocessingChangedEventType type) {
     513      SaveSnapshot(type, -1, -1);
     514      eventStack.Push(type);
     515    }
     516
     517    public void EndTransaction() {
     518      if (eventStack.Count == 0)
     519        throw new InvalidOperationException("There is no open transaction that can be ended.");
     520
     521      var @event = eventStack.Pop();
     522      OnChanged(@event, -1, -1);
     523    }
     524    #endregion
     525
     526    #region Helpers
     527    private static IList<IList> CopyVariableValues(IList<IList> original) {
     528      var copy = new List<IList>(original);
     529      for (int i = 0; i < original.Count; ++i) {
     530        copy[i] = (IList)Activator.CreateInstance(original[i].GetType(), original[i]);
     531      }
     532      return copy;
     533    }
    218534    #endregion
    219535  }
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/HeuristicLab.DataPreprocessing-3.4.csproj

    r15269 r15270  
    145145    <Compile Include="Content\DataGridContent.cs" />
    146146    <Compile Include="PreprocessingContext.cs" />
    147     <Compile Include="Data\TransactionalPreprocessingData.cs" />
    148147    <Compile Include="Logic\StatisticsLogic.cs" />
    149     <Compile Include="Data\ITransactionalPreprocessingData.cs" />
    150148    <Compile Include="Plugin.cs" />
    151149    <Compile Include="Properties\AssemblyInfo.cs" />
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Logic/ManipulationLogic.cs

    r15269 r15270  
    2828namespace HeuristicLab.DataPreprocessing {
    2929  public class ManipulationLogic {
    30     private readonly ITransactionalPreprocessingData preprocessingData;
     30    private readonly IPreprocessingData preprocessingData;
    3131    private readonly StatisticsLogic statisticsLogic;
    3232
     
    3535    }
    3636
    37     public ITransactionalPreprocessingData PreProcessingData {
     37    public IPreprocessingData PreProcessingData {
    3838      get { return preprocessingData; }
    3939    }
    4040
    41     public ManipulationLogic(ITransactionalPreprocessingData preprocessingData, StatisticsLogic theStatisticsLogic) {
     41    public ManipulationLogic(IPreprocessingData preprocessingData, StatisticsLogic theStatisticsLogic) {
    4242      this.preprocessingData = preprocessingData;
    4343      statisticsLogic = theStatisticsLogic;
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Logic/StatisticsLogic.cs

    r15269 r15270  
    2727namespace HeuristicLab.DataPreprocessing {
    2828  public class StatisticsLogic {
    29     private readonly ITransactionalPreprocessingData preprocessingData;
    30 
    31     public StatisticsLogic(ITransactionalPreprocessingData preprocessingData) {
     29    private readonly IPreprocessingData preprocessingData;
     30
     31    public StatisticsLogic(IPreprocessingData preprocessingData) {
    3232      this.preprocessingData = preprocessingData;
    3333    }
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/PreprocessingContext.cs

    r15110 r15270  
    7171      if (namedSource != null)
    7272        Name = "Preprocessing " + namedSource.Name;
    73       Data = new FilteredPreprocessingData(new TransactionalPreprocessingData(problemData));
     73      Data = new FilteredPreprocessingData(new PreprocessingData(problemData));
    7474      OnReset();
    7575      // Reset GUI:
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/PreprocessingTransformator.cs

    r14843 r15270  
    2929namespace HeuristicLab.DataPreprocessing {
    3030  public class PreprocessingTransformator {
    31     private readonly ITransactionalPreprocessingData preprocessingData;
     31    private readonly IPreprocessingData preprocessingData;
    3232
    3333    private readonly IDictionary<string, IList<double>> originalColumns;
     
    3636
    3737    public PreprocessingTransformator(IPreprocessingData preprocessingData) {
    38       this.preprocessingData = (ITransactionalPreprocessingData)preprocessingData;
     38      this.preprocessingData = preprocessingData;
    3939      originalColumns = new Dictionary<string, IList<double>>();
    4040      renamedColumns = new Dictionary<string, string>();
     
    6868          preprocessingData.Undo();
    6969        }
    70       }
    71       catch (Exception e) {
     70      } catch (Exception e) {
    7271        preprocessingData.Undo();
    7372        if (string.IsNullOrEmpty(errorMsg)) errorMsg = e.Message;
    74       }
    75       finally {
     73      } finally {
    7674        preprocessingData.EndTransaction();
    7775      }
Note: See TracChangeset for help on using the changeset viewer.