Changeset 16308 for branches/2845_EnhancedProgress/HeuristicLab.DataPreprocessing/3.4/Content/FilterContent.cs
- Timestamp:
- 11/20/18 13:52:40 (5 years ago)
- Location:
- branches/2845_EnhancedProgress
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2845_EnhancedProgress
- Property svn:mergeinfo changed
/stable reverse-merged: 15587-15588 /trunk/sources removed
- Property svn:mergeinfo changed
-
branches/2845_EnhancedProgress/HeuristicLab.DataPreprocessing
- Property svn:mergeinfo changed
/stable/HeuristicLab.DataPreprocessing reverse-merged: 15587 /branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing removed /trunk/sources/HeuristicLab.DataPreprocessing removed
- Property svn:mergeinfo changed
-
branches/2845_EnhancedProgress/HeuristicLab.DataPreprocessing/3.4
- Property svn:mergeinfo changed
/stable/HeuristicLab.DataPreprocessing/3.4 reverse-merged: 15587 /branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4 removed /trunk/sources/HeuristicLab.DataPreprocessing/3.4 removed
- Property svn:mergeinfo changed
-
branches/2845_EnhancedProgress/HeuristicLab.DataPreprocessing/3.4/Content/FilterContent.cs
r16307 r16308 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 8Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 20 20 #endregion 21 21 22 using System.Collections.Generic;23 22 using System.Drawing; 24 using System.Linq;25 23 using HeuristicLab.Common; 26 24 using HeuristicLab.Core; 27 25 using HeuristicLab.DataPreprocessing.Filter; 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;29 26 30 27 namespace HeuristicLab.DataPreprocessing { 31 28 [Item("Filter", "Represents the filter grid.")] 32 [StorableClass] 33 public class FilterContent : PreprocessingContent, IViewShortcut { 29 public class FilterContent : Item, IViewShortcut { 34 30 public static new Image StaticItemImage { 35 31 get { return HeuristicLab.Common.Resources.VSImageLibrary.Filter; } 36 32 } 37 [Storable] 33 34 public FilterLogic FilterLogic { get; private set; } 35 38 36 public ICheckedItemCollection<IFilter> Filters { get; private set; } 39 37 40 [Storable]41 38 public bool IsAndCombination { get; set; } 42 39 43 public IEnumerable<IFilter> ActiveFilters { 44 get { return Filters.Where(f => f.Active && f.ConstraintData != null); } 40 public FilterContent(FilterLogic filterLogic) { 41 Filters = new CheckedItemCollection<IFilter>(); 42 IsAndCombination = true; 43 FilterLogic = filterLogic; 45 44 } 46 45 47 public bool[] GetRemainingRows() { 48 var remainingRows = new bool[PreprocessingData.Rows]; 49 if (ActiveFilters.Any()) { 50 var filterResults = ActiveFilters.Select(f => f.Check()).ToList(); 51 var rowFilterResults = new bool[filterResults.Count]; 52 for (int row = 0; row < remainingRows.Length; row++) { 53 for (int i = 0; i < filterResults.Count; i++) 54 rowFilterResults[i] = filterResults[i][row]; 55 56 remainingRows[row] = IsAndCombination 57 ? rowFilterResults.All(x => x) 58 : rowFilterResults.Any(x => x); 59 } 60 } else { 61 // if not filters active => all rows are remaining 62 for (int i = 0; i < remainingRows.Length; i++) 63 remainingRows[i] = true; 64 } 65 return remainingRows; 46 protected FilterContent(FilterContent content, Cloner cloner) 47 : base(content, cloner) { 66 48 } 67 49 68 #region Constructor, Cloning & Persistence69 public FilterContent(IFilteredPreprocessingData preprocessingData)70 : base(preprocessingData) {71 Filters = new CheckedItemCollection<IFilter>();72 IsAndCombination = true;73 }74 75 protected FilterContent(FilterContent original, Cloner cloner)76 : base(original, cloner) {77 Filters = cloner.Clone(original.Filters);78 IsAndCombination = original.IsAndCombination;79 }80 50 public override IDeepCloneable Clone(Cloner cloner) { 81 51 return new FilterContent(this, cloner); 82 52 } 83 84 [StorableConstructor]85 protected FilterContent(bool deserializing)86 : base(deserializing) { }87 #endregion88 53 } 89 54 }
Note: See TracChangeset
for help on using the changeset viewer.