- Timestamp:
- 11/09/17 11:51:37 (6 years ago)
- Location:
- branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Content/FilterContent.cs
r15274 r15466 20 20 #endregion 21 21 22 using System.Collections.Generic; 22 23 using System.Drawing; 24 using System.Linq; 23 25 using HeuristicLab.Common; 24 26 using HeuristicLab.Core; … … 38 40 [Storable] 39 41 public bool IsAndCombination { get; set; } 42 43 public IEnumerable<IFilter> ActiveFilters { 44 get { return Filters.Where(f => f.Active && f.ConstraintData != null); } 45 } 46 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; 66 } 40 67 41 68 #region Constructor, Cloning & Persistence -
branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Data/FilteredPreprocessingData.cs
r15431 r15466 43 43 44 44 #region Constructor, Cloning & Persistence 45 public FilteredPreprocessingData(IPreprocessingData prep orcessingData)45 public FilteredPreprocessingData(IPreprocessingData preprocessingData) 46 46 : base() { 47 originalData = prep orcessingData;47 originalData = preprocessingData; 48 48 filteredData = null; 49 49 } … … 317 317 318 318 #region Filters 319 public void SetFilter(bool[] r owFilters) {319 public void SetFilter(bool[] remainingRows) { 320 320 filteredData = (IPreprocessingData)originalData.Clone(); 321 321 filteredData.InTransaction(() => { 322 for (int row = (r owFilters.Length - 1); row >= 0; --row) {323 if ( rowFilters[row]) {322 for (int row = (remainingRows.Length - 1); row >= 0; --row) { 323 if (!remainingRows[row]) { 324 324 filteredData.DeleteRow(row); 325 325 } -
branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Data/IFilteredPreprocessingData.cs
r15270 r15466 25 25 public interface IFilteredPreprocessingData : IPreprocessingData { 26 26 #region Filters 27 void SetFilter(bool[] r owFilters);27 void SetFilter(bool[] remainingRows); 28 28 void PersistFilter(); 29 29 void ResetFilter(); -
branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Filter/ComparisonFilter.cs
r15110 r15466 86 86 } 87 87 88 // return remaining rows 88 89 public new bool[] Check() { 89 90 bool[] result = new bool[ConstrainedValue.Rows]; … … 102 103 } 103 104 104 result[row] = !base.Check(item);105 result[row] = base.Check(item); 105 106 } 106 107
Note: See TracChangeset
for help on using the changeset viewer.