Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/19/17 14:32:57 (7 years ago)
Author:
pfleck
Message:

#2809:

  • Removed FilterLogic.
  • Made Contents storable and implemented proper cloning.
Location:
branches/DataPreprocessing Cleanup
Files:
1 added
1 deleted
25 edited

Legend:

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

    r15110 r15274  
    5151          // TODO: Avoid accessing parent view
    5252          var transformationView = (TransformationView)Parent;
    53           var columnNames = transformationView.Content.Data.VariableNames;
     53          var columnNames = transformationView.Content.PreprocessingData.VariableNames;
    5454
    5555          return (ITransformation)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(new[] { columnNames });
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing.Views/3.4/DataGridContentView.cs

    r15270 r15274  
    8585      base.RegisterContentEvents();
    8686      Content.Changed += Content_Changed;
    87       Content.FilterLogic.FilterChanged += FilterLogic_FilterChanged;
     87      Content.PreprocessingData.FilterChanged += FilterLogic_FilterChanged;
    8888    }
    8989
     
    9191      base.DeregisterContentEvents();
    9292      Content.Changed -= Content_Changed;
    93       Content.FilterLogic.FilterChanged -= FilterLogic_FilterChanged;
     93      Content.PreprocessingData.FilterChanged -= FilterLogic_FilterChanged;
    9494    }
    9595
     
    9898      searchIterator = null;
    9999      if (findAndReplaceDialog != null && !findAndReplaceDialog.IsDisposed) {
    100         if (Content.FilterLogic.IsFiltered) {
     100        if (Content.PreprocessingData.IsFiltered) {
    101101          findAndReplaceDialog.DisableReplace();
    102102        } else {
     
    104104        }
    105105      }
    106       btnReplace.Enabled = !Content.FilterLogic.IsFiltered;
     106      btnReplace.Enabled = !Content.PreprocessingData.IsFiltered;
    107107    }
    108108
     
    126126      string errorMessage;
    127127      if (!String.IsNullOrEmpty(e.FormattedValue.ToString())) {
    128         if (dataGridView.IsCurrentCellInEditMode && Content.FilterLogic.IsFiltered) {
     128        if (dataGridView.IsCurrentCellInEditMode && Content.PreprocessingData.IsFiltered) {
    129129          errorMessage = "A filter is active, you cannot modify data. Press ESC to exit edit mode.";
    130130        } else {
     
    271271        searchIterator = null;
    272272        DataGridView.SelectionChanged += DataGridView_SelectionChanged_FindAndReplace;
    273         if (Content.FilterLogic.IsFiltered) {
     273        if (Content.PreprocessingData.IsFiltered) {
    274274          findAndReplaceDialog.DisableReplace();
    275275        }
     
    405405      ComparisonOperation comparisonOperation = findAndReplaceDialog.GetComparisonOperation();
    406406      var foundCells = new Dictionary<int, IList<int>>();
    407       for (int i = 0; i < Content.FilterLogic.PreprocessingData.Columns; i++) {
     407      for (int i = 0; i < Content.PreprocessingData.Columns; i++) {
    408408        var filters = CreateFilters(match, comparisonOperation, i);
    409409
    410         bool[] filteredRows = Content.FilterLogic.GetFilterResult(filters, true);
     410        bool[] filteredRows = GetFilterResult(filters, true);
    411411        var foundIndices = new List<int>();
    412412        for (int idx = 0; idx < filteredRows.Length; ++idx) {
     
    427427    }
    428428
     429    private bool[] GetFilterResult(IList<IFilter> filters, bool isAndCombination) {
     430      IList<IFilter> activeFilters = filters.Where(f => f.Active && f.ConstraintData != null).ToList();
     431
     432      if (activeFilters.Count == 0) {
     433        return Enumerable.Repeat(false, Content.PreprocessingData.Rows).ToArray(); ;
     434      }
     435
     436      var result = Enumerable.Repeat(!isAndCombination, Content.PreprocessingData.Rows).ToArray();
     437      foreach (IFilter filter in activeFilters) {
     438        bool[] filterResult = filter.Check();
     439        for (int row = 0; row < result.Length; ++row) {
     440          result[row] = isAndCombination ? result[row] || filterResult[row] : result[row] && filterResult[row];
     441        }
     442      }
     443      return result;
     444    }
     445
    429446    private List<IFilter> CreateFilters(string match, ComparisonOperation comparisonOperation, int columnIndex) {
    430       IPreprocessingData preprocessingData = Content.FilterLogic.PreprocessingData;
     447      IPreprocessingData preprocessingData = Content.PreprocessingData;
    431448      IStringConvertibleValue value;
    432449      if (preprocessingData.VariableHasType<double>(columnIndex)) {
     
    547564      base.dataGridView_KeyDown(sender, e);
    548565      //data is in read only mode....
    549       if (Content.FilterLogic.IsFiltered) return;
     566      if (Content.PreprocessingData.IsFiltered) return;
    550567
    551568      if (e.KeyCode == Keys.Delete) {
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing.Views/3.4/DataPreprocessingView.cs

    r15269 r15274  
    4949      if (Content != null) {
    5050        var data = Content.Data;
    51         var filterLogic = new FilterLogic(data);
    5251        var statisticsLogic = new StatisticsLogic(data);
    5352        var manipulationLogic = new ManipulationLogic(data, statisticsLogic);
    5453
    5554        var viewShortcuts = new ItemList<IViewShortcut> {
    56           new DataGridContent(data, manipulationLogic, filterLogic),
     55          new DataGridContent(data, manipulationLogic),
    5756          new StatisticsContent(data, statisticsLogic),
    5857
     
    6463          new DataCompletenessChartContent(data),
    6564
    66           new FilterContent(filterLogic),
    67           new ManipulationContent(manipulationLogic, filterLogic),
    68           new TransformationContent(data, filterLogic)
     65          new FilterContent(data),
     66          new ManipulationContent(data, manipulationLogic),
     67          new TransformationContent(data)
    6968        };
    7069
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing.Views/3.4/FilterView.cs

    r15110 r15274  
    7474      rBtnAnd.Enabled = (activeFilters > 0);
    7575      rBtnOr.Enabled = (activeFilters > 0);
    76       Content.FilterLogic.Reset();
    77       bool[] result = Content.FilterLogic.Preview(filters, rBtnAnd.Checked);
     76      Content.PreprocessingData.ResetFilter();
     77      bool isAndCombination = rBtnAnd.Checked;
     78      bool[] ret;
     79      IList<IFilter> activeFilters1 = filters.Where(f => f.Active && f.ConstraintData != null).ToList();
     80      if (activeFilters1.Count > 0) {
     81        var result1 = Enumerable.Repeat(!isAndCombination, Content.PreprocessingData.Rows).ToArray();
     82
     83        foreach (IFilter filter in activeFilters1) {
     84          bool[] filterResult = filter.Check();
     85          for (int row = 0; row < result1.Length; ++row) {
     86            result1[row] = isAndCombination ? result1[row] || filterResult[row] : result1[row] && filterResult[row];
     87          }
     88        }
     89        Content.PreprocessingData.SetFilter(result1);
     90        ret = result1;
     91      } else {
     92        ret = Enumerable.Repeat(false, Content.PreprocessingData.Rows).ToArray();
     93      }
     94      bool[] result = ret;
    7895
    7996      int filteredCnt = result.Count(c => !c);
     
    89106        List<IFilter> filters = Content.Filters.ToList();
    90107        //apply filters
    91         Content.FilterLogic.Apply(filters, rBtnAnd.Checked);
     108        bool isAndCombination = rBtnAnd.Checked;
     109        Content.PreprocessingData.PersistFilter();
     110        Content.PreprocessingData.ResetFilter();
    92111        //deactivate checked filters
    93112        filters = checkedFilterView.Content.CheckedItems.ToList();
     
    104123      if (Content != null) {
    105124        foreach (IFilter filter in e.Items) {
    106           filter.ConstrainedValue = Content.FilterLogic.PreprocessingData;
     125          filter.ConstrainedValue = Content.PreprocessingData;
    107126        }
    108127      }
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing.Views/3.4/ManipulationView.cs

    r15269 r15274  
    8383    protected override void RegisterContentEvents() {
    8484      base.RegisterContentEvents();
    85       Content.FilterLogic.FilterChanged += FilterLogic_FilterChanged;
     85      Content.ManipulationLogic.PreProcessingData.FilterChanged += FilterLogic_FilterChanged;
    8686    }
    8787
    8888    protected override void DeregisterContentEvents() {
    89       Content.FilterLogic.FilterChanged -= FilterLogic_FilterChanged;
     89      Content.ManipulationLogic.PreProcessingData.FilterChanged -= FilterLogic_FilterChanged;
    9090      base.DeregisterContentEvents();
    9191    }
     
    9898
    9999    private void CheckFilters() {
    100       if (Content.FilterLogic.IsFiltered) {
     100      if (Content.PreprocessingData.IsFiltered) {
    101101        tabsPreview.SelectedIndex = 0;
    102102        lstMethods.Enabled = false;
     
    159159        var filteredColumns = Content.ManipulationLogic.ColumnsWithMissingValuesGreater(GetDeleteColumnsInfo());
    160160        int count = filteredColumns.Count;
    161         int columnCount = Content.FilterLogic.PreprocessingData.Columns;
     161        int columnCount = Content.PreprocessingData.Columns;
    162162        lblPreviewColumnsInfo.Text = string.Format("{0} column{1} of {2} ({3}) were detected with more than {4}% missing values.", count, (count > 1 || count == 0 ? "s" : ""), columnCount, string.Format("{0:F2}%", 100d / columnCount * count), txtDeleteColumnsInfo.Text);
    163163
     
    190190        var filteredColumns = Content.ManipulationLogic.ColumnsWithVarianceSmaller(GetDeleteColumnsVariance());
    191191        int count = filteredColumns.Count;
    192         int columnCount = Content.FilterLogic.PreprocessingData.Columns;
     192        int columnCount = Content.PreprocessingData.Columns;
    193193        lblPreviewColumnsVariance.Text = string.Format("{0} column{1} of {2} ({3}) were detected with a variance smaller than {4}.", count, (count > 1 || count == 0 ? "s" : ""), columnCount, string.Format("{0:F2}%", 100d / columnCount * count), txtDeleteColumnsVariance.Text);
    194194
     
    220220      if (btnApply.Enabled) {
    221221        int count = Content.ManipulationLogic.RowsWithMissingValuesGreater(GetRowsColumnsInfo()).Count;
    222         int rowCount = Content.FilterLogic.PreprocessingData.Rows;
     222        int rowCount = Content.PreprocessingData.Rows;
    223223        lblPreviewRowsInfo.Text = count + " row" + (count > 1 || count == 0 ? "s" : "") + " of " + rowCount + " (" + string.Format("{0:F2}%", 100d / rowCount * count) + ") were detected with more than " + txtDeleteRowsInfo.Text + "% missing values.";
    224224        if (count > 0) {
     
    256256          if (Content.ManipulationLogic.PreProcessingData.IsCellEmpty(columnIndex, rowIndex)) count++;
    257257
    258         int cellCount = Content.FilterLogic.PreprocessingData.Rows * Content.FilterLogic.PreprocessingData.Columns;
     258        int cellCount = Content.PreprocessingData.Rows * Content.PreprocessingData.Columns;
    259259        lblPreviewReplaceMissingValues.Text = count + " cell" + (count > 1 || count == 0 ? "s" : "")
    260260          + " of " + cellCount + " (" + string.Format("{0:F2}%", 100d / cellCount * count) + ") were detected with missing values which would be replaced with " + replaceWith;
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing.Views/3.4/StatisticsView.cs

    r15210 r15274  
    8888    private void UpdateData(Dictionary<string, bool> oldVisibility = null) {
    8989      var logic = Content.StatisticsLogic;
    90       rowsTextBox.Text = logic.GetRowCount().ToString();
    91       columnsTextBox.Text = logic.GetColumnCount().ToString();
    92       numericColumnsTextBox.Text = logic.GetNumericColumnCount().ToString();
    93       nominalColumnsTextBox5.Text = logic.GetNominalColumnCount().ToString();
     90      var data = Content.PreprocessingData;
     91      rowsTextBox.Text = data.Rows.ToString();
     92      columnsTextBox.Text = data.Rows.ToString();
     93      numericColumnsTextBox.Text = GetColumnCount<double>().ToString();
     94      nominalColumnsTextBox5.Text = GetColumnCount<string>().ToString();
    9495      missingValuesTextBox.Text = logic.GetMissingValueCount().ToString();
    95       totalValuesTextBox.Text = (logic.GetColumnCount() * logic.GetRowCount() - logic.GetMissingValueCount()).ToString();
     96      totalValuesTextBox.Text = (data.Rows * data.Rows - logic.GetMissingValueCount()).ToString();
    9697
    9798      var variableNames = Content.PreprocessingData.VariableNames.ToList();
     
    107108        };
    108109
    109       for (int i = 0; i < logic.GetColumnCount(); i++) {
    110         var data = GetStatistics(i);
    111         for (int j = 0; j < data.Count; j++) {
     110      for (int i = 0; i < data.Columns; i++) {
     111        var statistics = GetStatistics(i);
     112        for (int j = 0; j < statistics.Count; j++) {
    112113          if (horizontal)
    113             statisticsMatrix[j, i] = data[j];
     114            statisticsMatrix[j, i] = statistics[j];
    114115          else
    115             statisticsMatrix[i, j] = data[j];
     116            statisticsMatrix[i, j] = statistics[j];
    116117        }
    117118      }
     
    136137      stringMatrixView.DataGridView.AutoResizeColumns();
    137138      stringMatrixView.Parent.ResumeRepaint(true);
     139    }
     140
     141    public int GetColumnCount<T>() {
     142      int count = 0;
     143      for (int i = 0; i < Content.PreprocessingData.Columns; ++i) {
     144        if (Content.PreprocessingData.VariableHasType<T>(i)) {
     145          ++count;
     146        }
     147      }
     148      return count;
    138149    }
    139150
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing.Views/3.4/TransformationView.cs

    r15110 r15274  
    5151
    5252    protected override void RegisterContentEvents() {
    53       Content.FilterLogic.FilterChanged += FilterLogic_FilterChanged;
     53      Content.PreprocessingData.FilterChanged += FilterLogic_FilterChanged;
    5454    }
    5555
    5656    protected override void DeregisterContentEvents() {
    57       Content.FilterLogic.FilterChanged -= FilterLogic_FilterChanged;
     57      Content.PreprocessingData.FilterChanged -= FilterLogic_FilterChanged;
    5858    }
    5959
     
    6565
    6666    private void CheckFilters() {
    67       if (Content.FilterLogic.IsFiltered) {
     67      if (Content.PreprocessingData.IsFiltered) {
    6868        applyButton.Enabled = false;
    6969        lblFilterNotice.Visible = true;
     
    8282      }
    8383
    84       var transformator = new PreprocessingTransformator(Content.Data);
     84      var transformator = new PreprocessingTransformator(Content.PreprocessingData);
    8585      bool preserve = preserveColumnsCheckbox.CheckState == CheckState.Checked;
    8686      string errorMsg;
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Content/CorrelationMatrixContent.cs

    r15270 r15274  
    2323using HeuristicLab.Common;
    2424using HeuristicLab.Core;
     25using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2526using HeuristicLab.Problems.DataAnalysis;
    2627
    2728namespace HeuristicLab.DataPreprocessing {
    2829  [Item("Feature Correlation Matrix", "Represents the feature correlation matrix.")]
    29   public class CorrelationMatrixContent : Item, IViewShortcut {
     30  [StorableClass]
     31  public class CorrelationMatrixContent : PreprocessingContent, IViewShortcut {
    3032    public static new Image StaticItemImage {
    3133      get { return HeuristicLab.Common.Resources.VSImageLibrary.Gradient; }
    3234    }
    3335
     36    [Storable]
    3437    public PreprocessingContext Context { get; private set; }
    35     public IPreprocessingData PreprocessingData {
    36       get { return Context.Data; }
    37     }
     38
    3839
    3940    public DataAnalysisProblemData ProblemData {
     
    4748    }
    4849
    49     public CorrelationMatrixContent(PreprocessingContext context) {
     50    #region Constructor, Cloning & Persistence
     51    public CorrelationMatrixContent(PreprocessingContext context)
     52      : base(context.Data) {
    5053      Context = context;
    5154    }
     
    5558      Context = original.Context;
    5659    }
    57 
    5860    public override IDeepCloneable Clone(Cloner cloner) {
    5961      return new CorrelationMatrixContent(this, cloner);
    6062    }
     63
     64    [StorableConstructor]
     65    protected CorrelationMatrixContent(bool deserializing)
     66      : base(deserializing) { }
     67    #endregion
    6168
    6269    public event DataPreprocessingChangedEventHandler Changed {
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Content/DataCompletenessChartContent.cs

    r15270 r15274  
    2323using HeuristicLab.Common;
    2424using HeuristicLab.Core;
     25using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2526
    2627namespace HeuristicLab.DataPreprocessing {
    2728  [Item("Data Completeness Chart", "Represents a datacompleteness chart.")]
    28 
    29   public class DataCompletenessChartContent : Item, IViewShortcut {
     29  [StorableClass]
     30  public class DataCompletenessChartContent : PreprocessingContent, IViewShortcut {
    3031    public static new Image StaticItemImage {
    3132      get { return HeuristicLab.Common.Resources.VSImageLibrary.EditBrightnessContrast; }
    3233    }
    3334
    34     public IPreprocessingData PreprocessingData { get; private set; }
    35 
    36     public DataCompletenessChartContent(IPreprocessingData preprocessingData) {
    37       PreprocessingData = preprocessingData;
     35    #region Constructor, Cloning & Persistence
     36    public DataCompletenessChartContent(IFilteredPreprocessingData preprocessingData)
     37      : base(preprocessingData) {
    3838    }
    3939
    4040    public DataCompletenessChartContent(DataCompletenessChartContent content, Cloner cloner)
    4141      : base(content, cloner) {
    42       PreprocessingData = content.PreprocessingData;
    4342    }
    44 
    4543    public override IDeepCloneable Clone(Cloner cloner) {
    4644      return new DataCompletenessChartContent(this, cloner);
    4745    }
     46
     47    [StorableConstructor]
     48    protected DataCompletenessChartContent(bool deserializing)
     49      : base(deserializing) { }
     50    #endregion
    4851  }
    4952}
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Content/DataGridContent.cs

    r15270 r15274  
    2727using HeuristicLab.Core;
    2828using HeuristicLab.Data;
     29using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2930
    3031namespace HeuristicLab.DataPreprocessing {
    31 
    3232  [Item("Data Grid", "Represents a data grid.")]
    33   public class DataGridContent : Item, IStringConvertibleMatrix, IViewShortcut {
     33  [StorableClass]
     34  public class DataGridContent : PreprocessingContent, IStringConvertibleMatrix, IViewShortcut {
    3435    public static new Image StaticItemImage {
    3536      get { return HeuristicLab.Common.Resources.VSImageLibrary.Table; }
    3637    }
    3738
    38     public IPreprocessingData PreprocessingData { get; private set; }
    39 
     39    [Storable]
    4040    public ManipulationLogic ManipulationLogic { get; private set; }
    41     public FilterLogic FilterLogic { get; private set; }
    4241
    4342    public int Rows {
     
    7574    }
    7675
    77     public DataGridContent(IPreprocessingData preprocessingData, ManipulationLogic theManipulationLogic, FilterLogic theFilterLogic) {
    78       ManipulationLogic = theManipulationLogic;
    79       FilterLogic = theFilterLogic;
    80       PreprocessingData = preprocessingData;
     76    #region Constructor, Cloning & Persistence
     77    public DataGridContent(IFilteredPreprocessingData preprocessingData, ManipulationLogic manipulationLogic)
     78      : base(preprocessingData) {
     79      ManipulationLogic = manipulationLogic;
    8180    }
    8281
    83     public DataGridContent(DataGridContent dataGridContent, Cloner cloner)
    84       : base(dataGridContent, cloner) {
    85 
     82    public DataGridContent(DataGridContent original, Cloner cloner)
     83      : base(original, cloner) {
     84      ManipulationLogic = cloner.Clone(original.ManipulationLogic);
    8685    }
    8786    public override IDeepCloneable Clone(Cloner cloner) {
    8887      return new DataGridContent(this, cloner);
    8988    }
     89
     90    [StorableConstructor]
     91    protected DataGridContent(bool deserializing)
     92      : base(deserializing) { }
     93    #endregion
    9094
    9195    public void DeleteRows(IEnumerable<int> rows) {
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Content/FilterContent.cs

    r15110 r15274  
    2424using HeuristicLab.Core;
    2525using HeuristicLab.DataPreprocessing.Filter;
     26using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2627
    2728namespace HeuristicLab.DataPreprocessing {
    2829  [Item("Filter", "Represents the filter grid.")]
    29   public class FilterContent : Item, IViewShortcut {
     30  [StorableClass]
     31  public class FilterContent : PreprocessingContent, IViewShortcut {
    3032    public static new Image StaticItemImage {
    3133      get { return HeuristicLab.Common.Resources.VSImageLibrary.Filter; }
    3234    }
    33 
    34     public FilterLogic FilterLogic { get; private set; }
    35 
     35    [Storable]
    3636    public ICheckedItemCollection<IFilter> Filters { get; private set; }
    3737
     38    [Storable]
    3839    public bool IsAndCombination { get; set; }
    3940
    40     public FilterContent(FilterLogic filterLogic) {
     41    #region Constructor, Cloning & Persistence
     42    public FilterContent(IFilteredPreprocessingData preprocessingData)
     43      : base(preprocessingData) {
    4144      Filters = new CheckedItemCollection<IFilter>();
    4245      IsAndCombination = true;
    43       FilterLogic = filterLogic;
    4446    }
    4547
    46     protected FilterContent(FilterContent content, Cloner cloner)
    47       : base(content, cloner) {
     48    protected FilterContent(FilterContent original, Cloner cloner)
     49      : base(original, cloner) {
     50      Filters = cloner.Clone(original.Filters);
     51      IsAndCombination = original.IsAndCombination;
    4852    }
    49 
    5053    public override IDeepCloneable Clone(Cloner cloner) {
    5154      return new FilterContent(this, cloner);
    5255    }
     56
     57    [StorableConstructor]
     58    protected FilterContent(bool deserializing)
     59      : base(deserializing) { }
     60    #endregion
    5361  }
    5462}
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Content/HistogramContent.cs

    r15210 r15274  
    2626using HeuristicLab.Common;
    2727using HeuristicLab.Core;
     28using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2829
    2930namespace HeuristicLab.DataPreprocessing {
    3031  [Item("Histogram", "Represents the histogram grid.")]
     32  [StorableClass]
    3133  public class HistogramContent : PreprocessingChartContent {
    3234    public static new Image StaticItemImage {
     
    3436    }
    3537
     38    [Storable]
    3639    public string GroupingVariableName { get; set; }
    3740
     41    [Storable]
    3842    public int Bins { get; set; }
     43    [Storable]
    3944    public bool ExactBins { get; set; }
    4045
     46    [Storable]
    4147    public LegendOrder Order { get; set; }
    4248
     49    #region Constructor, Cloning & Persistence
    4350    public HistogramContent(IFilteredPreprocessingData preprocessingData)
    4451      : base(preprocessingData) {
     
    4754    }
    4855
    49     public HistogramContent(HistogramContent content, Cloner cloner)
    50       : base(content, cloner) {
     56    public HistogramContent(HistogramContent original, Cloner cloner)
     57      : base(original, cloner) {
     58      GroupingVariableName = original.GroupingVariableName;
     59      Bins = original.Bins;
     60      ExactBins = original.ExactBins;
     61      Order = original.Order;
    5162    }
    5263    public override IDeepCloneable Clone(Cloner cloner) {
    5364      return new HistogramContent(this, cloner);
    5465    }
     66
     67    [StorableConstructor]
     68    protected HistogramContent(bool deserializing)
     69      : base(deserializing) { }
     70    #endregion
    5571
    5672    public static DataTable CreateHistogram(IFilteredPreprocessingData preprocessingData, string variableName, string groupingVariableName, DataTableVisualProperties.DataTableHistogramAggregation aggregation, LegendOrder legendOrder = LegendOrder.Alphabetically) {
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Content/LineChartContent.cs

    r15110 r15274  
    2323using HeuristicLab.Common;
    2424using HeuristicLab.Core;
     25using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2526
    2627namespace HeuristicLab.DataPreprocessing {
    27 
    2828  [Item("Line Chart", "Represents the line chart grid.")]
     29  [StorableClass]
    2930  public class LineChartContent : PreprocessingChartContent {
    30     public bool AllInOneMode { get; set; }
    31 
    3231    public static new Image StaticItemImage {
    3332      get { return HeuristicLab.Common.Resources.VSImageLibrary.Performance; }
    3433    }
    3534
     35    [Storable]
     36    public bool AllInOneMode { get; set; }
     37
     38
     39    #region Constructor, Cloning & Persistence
    3640    public LineChartContent(IFilteredPreprocessingData preprocessingData)
    3741      : base(preprocessingData) {
     
    3943    }
    4044
    41     public LineChartContent(LineChartContent content, Cloner cloner)
    42       : base(content, cloner) {
    43       this.AllInOneMode = content.AllInOneMode;
     45    public LineChartContent(LineChartContent original, Cloner cloner)
     46      : base(original, cloner) {
     47      AllInOneMode = original.AllInOneMode;
    4448    }
    4549    public override IDeepCloneable Clone(Cloner cloner) {
    4650      return new LineChartContent(this, cloner);
    4751    }
     52
     53    [StorableConstructor]
     54    protected LineChartContent(bool deserializing)
     55      : base(deserializing) { }
     56    #endregion
    4857  }
    4958}
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Content/ManipulationContent.cs

    r15269 r15274  
    2323using HeuristicLab.Common;
    2424using HeuristicLab.Core;
     25using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2526
    2627namespace HeuristicLab.DataPreprocessing {
    27 
    2828  [Item("Manipulation", "Represents the available manipulations on a data set.")]
    29   public class ManipulationContent : Item, IViewShortcut {
     29  [StorableClass]
     30  public class ManipulationContent : PreprocessingContent, IViewShortcut {
    3031    public static new Image StaticItemImage {
    3132      get { return HeuristicLab.Common.Resources.VSImageLibrary.Method; }
    3233    }
    3334
     35    [Storable]
    3436    public ManipulationLogic ManipulationLogic { get; private set; }
    35     public FilterLogic FilterLogic { get; private set; }
    3637
    37     public ManipulationContent(ManipulationLogic manipulationLogic, FilterLogic filterLogic) {
     38    #region Constructor, Cloning & Persistence
     39    public ManipulationContent(IFilteredPreprocessingData preprocessingData, ManipulationLogic manipulationLogic)
     40      : base(preprocessingData) {
    3841      ManipulationLogic = manipulationLogic;
    39       FilterLogic = filterLogic;
    4042    }
    4143
    42     public ManipulationContent(ManipulationContent content, Cloner cloner) : base(content, cloner) { }
    43 
     44    public ManipulationContent(ManipulationContent original, Cloner cloner) :
     45      base(original, cloner) {
     46      ManipulationLogic = cloner.Clone(original.ManipulationLogic);
     47    }
    4448    public override IDeepCloneable Clone(Cloner cloner) {
    4549      return new ManipulationContent(this, cloner);
    4650    }
     51
     52    [StorableConstructor]
     53    protected ManipulationContent(bool deserializing)
     54      : base(deserializing) { }
     55    #endregion
    4756  }
    4857}
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Content/MultiScatterPlotContent.cs

    r15110 r15274  
    2323using HeuristicLab.Common;
    2424using HeuristicLab.Core;
     25using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2526
    2627namespace HeuristicLab.DataPreprocessing {
    27 
    2828  [Item("Multi Scatter Plot", "Represents a multi scatter plot.")]
     29  [StorableClass]
    2930  public class MultiScatterPlotContent : ScatterPlotContent {
    3031    public static new Image StaticItemImage {
     
    3233    }
    3334
     35    #region Constructor, Cloning & Persistence
    3436    public MultiScatterPlotContent(IFilteredPreprocessingData preprocessingData)
    3537      : base(preprocessingData) {
    3638    }
    3739
    38     public MultiScatterPlotContent(MultiScatterPlotContent content, Cloner cloner)
    39       : base(content, cloner) {
     40    public MultiScatterPlotContent(MultiScatterPlotContent original, Cloner cloner)
     41      : base(original, cloner) {
    4042    }
    41 
    4243    public override IDeepCloneable Clone(Cloner cloner) {
    4344      return new MultiScatterPlotContent(this, cloner);
    4445    }
     46
     47    [StorableConstructor]
     48    protected MultiScatterPlotContent(bool deserializing)
     49      : base(deserializing) { }
     50    #endregion
    4551  }
    4652}
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Content/PreprocessingChartContent.cs

    r15210 r15274  
    2929using HeuristicLab.Core;
    3030using HeuristicLab.Data;
     31using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3132
    3233namespace HeuristicLab.DataPreprocessing {
    3334  [Item("PreprocessingChart", "Represents a preprocessing chart.")]
    34   public class PreprocessingChartContent : Item, IViewShortcut {
     35  [StorableClass]
     36  public class PreprocessingChartContent : PreprocessingContent, IViewShortcut {
    3537    public enum LegendOrder {
    3638      Alphabetically,
     
    4244    }
    4345
    44     private ICheckedItemList<StringValue> variableItemList = null;
     46    [Storable]
     47    private ICheckedItemList<StringValue> variableItemList;
    4548    public ICheckedItemList<StringValue> VariableItemList {
    4649      get {
    4750        if (variableItemList == null)
    4851          variableItemList = CreateVariableItemList(PreprocessingData);
    49         return this.variableItemList;
     52        return variableItemList;
    5053      }
    5154    }
    5255
    53     public IFilteredPreprocessingData PreprocessingData { get; private set; }
    5456    public event DataPreprocessingChangedEventHandler Changed {
    5557      add { PreprocessingData.Changed += value; }
     
    5759    }
    5860
    59     public PreprocessingChartContent(IFilteredPreprocessingData preprocessingData) {
    60       PreprocessingData = preprocessingData;
     61    #region Constructor, Cloning & Persistence
     62    public PreprocessingChartContent(IFilteredPreprocessingData preprocessingData)
     63       : base(preprocessingData) {
    6164    }
    6265
    63     public PreprocessingChartContent(PreprocessingChartContent content, Cloner cloner)
    64       : base(content, cloner) {
    65       this.PreprocessingData = content.PreprocessingData;
    66       this.variableItemList = cloner.Clone<ICheckedItemList<StringValue>>(variableItemList);
     66    public PreprocessingChartContent(PreprocessingChartContent original, Cloner cloner)
     67      : base(original, cloner) {
     68      variableItemList = cloner.Clone(original.variableItemList);
    6769    }
    6870    public override IDeepCloneable Clone(Cloner cloner) {
    6971      return new PreprocessingChartContent(this, cloner);
    7072    }
     73
     74    [StorableConstructor]
     75    protected PreprocessingChartContent(bool deserializing)
     76      : base(deserializing) { }
     77    #endregion
    7178
    7279    public DataRow CreateDataRow(string variableName, DataRowVisualProperties.DataRowChartType chartType) {
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Content/ScatterPlotContent.cs

    r15210 r15274  
    2525using HeuristicLab.Analysis;
    2626using HeuristicLab.Common;
     27using HeuristicLab.Core;
     28using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2729using HeuristicLab.Visualization.ChartControlsExtensions;
    2830
    2931namespace HeuristicLab.DataPreprocessing {
    30 
     32  [Item("ScatterPlotContent", "")]
     33  [StorableClass]
    3134  public abstract class ScatterPlotContent : PreprocessingChartContent {
     35    [Storable]
    3236    public string GroupingVariable { get; set; }
    3337
     38    #region Constructor, Cloning & Persistence
    3439    protected ScatterPlotContent(IFilteredPreprocessingData preprocessingData)
    3540      : base(preprocessingData) {
    3641    }
    3742
    38     protected ScatterPlotContent(ScatterPlotContent content, Cloner cloner)
    39       : base(content, cloner) {
     43    protected ScatterPlotContent(ScatterPlotContent original, Cloner cloner)
     44      : base(original, cloner) {
     45      GroupingVariable = original.GroupingVariable;
    4046    }
     47
     48    [StorableConstructor]
     49    protected ScatterPlotContent(bool deserializing)
     50      : base(deserializing) { }
     51    #endregion
    4152
    4253    public static ScatterPlot CreateScatterPlot(IFilteredPreprocessingData preprocessingData, string variableNameX, string variableNameY, string variableNameGroup = "-", LegendOrder legendOrder = LegendOrder.Alphabetically) {
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Content/SingleScatterPlotContent.cs

    r15110 r15274  
    2323using HeuristicLab.Common;
    2424using HeuristicLab.Core;
     25using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2526
    2627namespace HeuristicLab.DataPreprocessing {
    27 
    2828  [Item("Scatter Plot", "Represents a scatter plot.")]
     29  [StorableClass]
    2930  public class SingleScatterPlotContent : ScatterPlotContent {
    3031    public static new Image StaticItemImage {
     
    3233    }
    3334
     35    [Storable]
    3436    public string SelectedXVariable { get; set; }
     37    [Storable]
    3538    public string SelectedYVariable { get; set; }
    3639
     40    #region Constructor, Cloning & Persistence
    3741    public SingleScatterPlotContent(IFilteredPreprocessingData preprocessingData)
    3842      : base(preprocessingData) {
    3943    }
    4044
    41     public SingleScatterPlotContent(SingleScatterPlotContent content, Cloner cloner)
    42       : base(content, cloner) {
    43       this.SelectedXVariable = content.SelectedXVariable;
    44       this.SelectedYVariable = content.SelectedYVariable;
    45       this.GroupingVariable = content.GroupingVariable;
     45    public SingleScatterPlotContent(SingleScatterPlotContent original, Cloner cloner)
     46      : base(original, cloner) {
     47      SelectedXVariable = original.SelectedXVariable;
     48      SelectedYVariable = original.SelectedYVariable;
    4649    }
    47 
    4850    public override IDeepCloneable Clone(Cloner cloner) {
    4951      return new SingleScatterPlotContent(this, cloner);
    5052    }
     53
     54    [StorableConstructor]
     55    protected SingleScatterPlotContent(bool deserializing)
     56      : base(deserializing) { }
     57    #endregion
    5158  }
    5259}
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Content/StatisticsContent.cs

    r15270 r15274  
    2323using HeuristicLab.Common;
    2424using HeuristicLab.Core;
     25using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2526
    2627namespace HeuristicLab.DataPreprocessing {
    2728  [Item("Statistics", "Represents the statistics grid.")]
    28   public class StatisticsContent : Item, IViewShortcut {
     29  [StorableClass]
     30  public class StatisticsContent : PreprocessingContent, IViewShortcut {
    2931    public static new Image StaticItemImage {
    3032      get { return HeuristicLab.Common.Resources.VSImageLibrary.Object; }
    3133    }
    3234
    33     public IPreprocessingData PreprocessingData { get; private set; }
     35    [Storable]
    3436    public StatisticsLogic StatisticsLogic { get; private set; }
    3537
    36     public StatisticsContent(IPreprocessingData preProcessingData, StatisticsLogic statisticsLogic) {
    37       PreprocessingData = preProcessingData;
     38    #region Constructor, Cloning & Persistence
     39    public StatisticsContent(IFilteredPreprocessingData preprocessingData, StatisticsLogic statisticsLogic)
     40      : base(preprocessingData) {
    3841      StatisticsLogic = statisticsLogic;
    3942    }
    4043
    41     public StatisticsContent(StatisticsContent content, Cloner cloner)
    42       : base(content, cloner) {
     44    public StatisticsContent(StatisticsContent original, Cloner cloner)
     45      : base(original, cloner) {
     46      StatisticsLogic = cloner.Clone(original.StatisticsLogic);
    4347    }
    44 
    4548    public override IDeepCloneable Clone(Cloner cloner) {
    4649      return new StatisticsContent(this, cloner);
    4750    }
     51
     52    [StorableConstructor]
     53    protected StatisticsContent(bool deserializing)
     54      : base(deserializing) { }
     55    #endregion
    4856
    4957    public event DataPreprocessingChangedEventHandler Changed {
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Content/TransformationContent.cs

    r15110 r15274  
    2323using HeuristicLab.Common;
    2424using HeuristicLab.Core;
     25using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2526using HeuristicLab.Problems.DataAnalysis;
    2627
    2728namespace HeuristicLab.DataPreprocessing {
    2829  [Item("Transformation", "Represents the transformation grid.")]
    29   public class TransformationContent : Item, IViewShortcut {
     30  [StorableClass]
     31  public class TransformationContent : PreprocessingContent, IViewShortcut {
    3032    public static new Image StaticItemImage {
    3133      get { return HeuristicLab.Common.Resources.VSImageLibrary.Method; }
    3234    }
    3335
    34     public IPreprocessingData Data { get; private set; }
    35     public FilterLogic FilterLogic { get; private set; }
    36 
     36    [Storable]
    3737    public ICheckedItemList<ITransformation> CheckedTransformationList { get; private set; }
    3838
    39     public TransformationContent(IPreprocessingData data, FilterLogic filterLogic) {
    40       Data = data;
     39    #region Constructor, Cloning & Persistence
     40    public TransformationContent(IFilteredPreprocessingData preprocessingData)
     41      : base(preprocessingData) {
    4142      CheckedTransformationList = new CheckedItemList<ITransformation>();
    42       FilterLogic = filterLogic;
    4343    }
    4444
    4545    public TransformationContent(TransformationContent original, Cloner cloner)
    4646      : base(original, cloner) {
    47       Data = original.Data;
    48       CheckedTransformationList = new CheckedItemList<ITransformation>(original.CheckedTransformationList);
     47      CheckedTransformationList = cloner.Clone(original.CheckedTransformationList);
    4948    }
    50 
    5149    public override IDeepCloneable Clone(Cloner cloner) {
    5250      return new TransformationContent(this, cloner);
    5351    }
     52
     53    [StorableConstructor]
     54    protected TransformationContent(bool deserializing)
     55      : base(deserializing) { }
     56    #endregion
    5457  }
    5558}
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Data/FilteredPreprocessingData.cs

    r15270 r15274  
    4242    }
    4343
    44     #region Constructor, Cloning & Persistance
     44    #region Constructor, Cloning & Persistence
    4545    public FilteredPreprocessingData(IPreprocessingData preporcessingData)
    4646      : base() {
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Data/PreprocessingData.cs

    r15270 r15274  
    4242    protected IList<string> variableNames;
    4343
    44     #region Constructor, Cloning & Persistance
     44    #region Constructor, Cloning & Persistence
    4545    public PreprocessingData(IDataAnalysisProblemData problemData)
    4646      : base() {
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/HeuristicLab.DataPreprocessing-3.4.csproj

    r15270 r15274  
    119119  <ItemGroup>
    120120    <Compile Include="Content\MultiScatterPlotContent.cs" />
     121    <Compile Include="Content\PreprocessingContent.cs" />
    121122    <Compile Include="Content\SingleScatterPlotContent.cs" />
    122123    <Compile Include="Content\ScatterPlotContent.cs" />
     
    135136    <Compile Include="Data\IPreprocessingData.cs" />
    136137    <Compile Include="Content\FilterContent.cs" />
    137     <Compile Include="Logic\FilterLogic.cs" />
    138138    <Compile Include="Content\HistogramContent.cs" />
    139139    <Compile Include="Content\LineChartContent.cs" />
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Logic/ManipulationLogic.cs

    r15270 r15274  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using HeuristicLab.Common;
     26using HeuristicLab.Core;
    2527using HeuristicLab.Data;
     28using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2629using HeuristicLab.Random;
    2730
    2831namespace HeuristicLab.DataPreprocessing {
    29   public class ManipulationLogic {
    30     private readonly IPreprocessingData preprocessingData;
     32  [Item("ManipulationLogic", "")]
     33  [StorableClass]
     34  public class ManipulationLogic : Item {
     35
     36    [Storable]
     37    private readonly IFilteredPreprocessingData preprocessingData;
     38
     39    [Storable]
    3140    private readonly StatisticsLogic statisticsLogic;
    3241
     
    3544    }
    3645
    37     public IPreprocessingData PreProcessingData {
     46    public IFilteredPreprocessingData PreProcessingData {
    3847      get { return preprocessingData; }
    3948    }
    4049
    41     public ManipulationLogic(IPreprocessingData preprocessingData, StatisticsLogic theStatisticsLogic) {
     50    #region Constructor, Cloning & Persistence
     51    public ManipulationLogic(IFilteredPreprocessingData preprocessingData, StatisticsLogic theStatisticsLogic) {
    4252      this.preprocessingData = preprocessingData;
    4353      statisticsLogic = theStatisticsLogic;
    4454    }
     55    public ManipulationLogic(ManipulationLogic original, Cloner cloner)
     56      : base(original, cloner) {
     57      preprocessingData = cloner.Clone(original.preprocessingData);
     58      statisticsLogic = cloner.Clone(original.statisticsLogic);
     59    }
     60    public override IDeepCloneable Clone(Cloner cloner) {
     61      return new ManipulationLogic(this, cloner);
     62    }
     63
     64    [StorableConstructor]
     65    protected ManipulationLogic(bool deserializing)
     66      : base(deserializing) { }
     67    #endregion
    4568
    4669    public void ReplaceIndicesByValue<T>(int columnIndex, IEnumerable<int> rowIndices, T value) {
     
    123146      for (int i = 0; i < count; ++i) {
    124147        if (start == int.MinValue) {
    125           start = indexOfPrevPresentValue(column.Key, rowIndices[i]);
     148          start = IndexOfPrevPresentValue(column.Key, rowIndices[i]);
    126149        }
    127150        if (i + 1 == count || (i + 1 < count && rowIndices[i + 1] - rowIndices[i] > 1)) {
    128           int next = indexOfNextPresentValue(column.Key, rowIndices[i]);
     151          int next = IndexOfNextPresentValue(column.Key, rowIndices[i]);
    129152          if (start > 0 && next < preprocessingData.Rows) {
    130153            startEndings.Add(new Tuple<int, int>(start, next));
     
    144167            // dont replace first or last values
    145168            if (index > 0 && index < countValues) {
    146               int prevIndex = indexOfPrevPresentValue(column.Key, index);
    147               int nextIndex = indexOfNextPresentValue(column.Key, index);
     169              int prevIndex = IndexOfPrevPresentValue(column.Key, index);
     170              int nextIndex = IndexOfNextPresentValue(column.Key, index);
    148171
    149172              // no neighbours found
     
    183206    }
    184207
    185     private int indexOfPrevPresentValue(int columnIndex, int start) {
     208    private int IndexOfPrevPresentValue(int columnIndex, int start) {
    186209      int offset = start - 1;
    187210      while (offset >= 0 && preprocessingData.IsCellEmpty(columnIndex, offset)) {
     
    192215    }
    193216
    194     private int indexOfNextPresentValue(int columnIndex, int start) {
     217    private int IndexOfNextPresentValue(int columnIndex, int start) {
    195218      int offset = start + 1;
    196219      while (offset < preprocessingData.Rows && preprocessingData.IsCellEmpty(columnIndex, offset)) {
  • branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Logic/StatisticsLogic.cs

    r15270 r15274  
    2424using System.Linq;
    2525using HeuristicLab.Common;
     26using HeuristicLab.Core;
     27using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2628
    2729namespace HeuristicLab.DataPreprocessing {
    28   public class StatisticsLogic {
     30  [Item("StatisticsLogic", "")]
     31  [StorableClass]
     32  public class StatisticsLogic : Item {
     33    [Storable]
    2934    private readonly IPreprocessingData preprocessingData;
    3035
     36    #region Constructor, Cloning & Persistence
    3137    public StatisticsLogic(IPreprocessingData preprocessingData) {
    3238      this.preprocessingData = preprocessingData;
    3339    }
    34 
    35     public int GetColumnCount() {
    36       return preprocessingData.Columns;
    37     }
    38 
    39     public int GetRowCount() {
    40       return preprocessingData.Rows;
    41     }
    42 
    43     public int GetNumericColumnCount() {
    44       int count = 0;
    45 
    46       for (int i = 0; i < preprocessingData.Columns; ++i) {
    47         if (preprocessingData.VariableHasType<double>(i)) {
    48           ++count;
    49         }
    50       }
    51       return count;
    52     }
    53 
    54     public int GetNominalColumnCount() {
    55       return preprocessingData.Columns - GetNumericColumnCount();
    56     }
     40    public StatisticsLogic(StatisticsLogic original, Cloner cloner)
     41      : base(original, cloner) {
     42      preprocessingData = cloner.Clone(original.preprocessingData);
     43    }
     44    public override IDeepCloneable Clone(Cloner cloner) {
     45      return new StatisticsLogic(this, cloner);
     46    }
     47
     48    [StorableConstructor]
     49    protected StatisticsLogic(bool deserializing)
     50      : base(deserializing) { }
     51    #endregion
    5752
    5853    public int GetMissingValueCount() {
Note: See TracChangeset for help on using the changeset viewer.