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.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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      }
Note: See TracChangeset for help on using the changeset viewer.