Changeset 10619
- Timestamp:
- 03/19/14 13:00:11 (11 years ago)
- Location:
- branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/Filter/ComparisonFilter.cs
r10611 r10619 27 27 using HeuristicLab.Common; 28 28 using HeuristicLab.Data; 29 using System.Collections.Generic; 29 30 30 31 namespace HeuristicLab.DataPreprocessing.Filter … … 104 105 105 106 106 p rotected override boolCheck(object constrainedMember)107 public bool[] Check(object constrainedMember) 107 108 { 109 bool[] result = new bool[ConstrainedValue.Rows]; 110 108 111 if (!Active) 109 return false;112 return result; 110 113 111 114 for (int row = 0; row < ConstrainedValue.Rows; ++row) 112 115 { 113 114 116 object item = null; 115 117 if (ConstrainedValue.IsType<double>(constraintColumn)) … … 126 128 } 127 129 128 if (base.Check(item)) 129 return true; 130 130 result[row] = base.Check(item); 131 131 } 132 132 133 return false;133 return result; 134 134 } 135 135 136 p rotected override boolCheck(object constrainedMember, out string errorMessage)136 public bool[] Check(object constrainedMember, out string errorMessage) 137 137 { 138 138 errorMessage = string.Empty; -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/FilterLogic.cs
r10558 r10619 20 20 #endregion 21 21 22 using HeuristicLab.DataPreprocessing.Filter; 23 using System.Collections.Generic; 22 24 namespace HeuristicLab.DataPreprocessing { 23 25 public class FilterLogic : IFilterLogic { 26 27 private ITransactionalPreprocessingData preprocessingData; 28 29 public FilterLogic(ITransactionalPreprocessingData preprocessingData) { 30 this.preprocessingData = preprocessingData; 31 } 32 33 34 public bool[] Preview(IList<ComparisonFilter> filters) 35 { 36 bool[] result = new bool[preprocessingData.Rows]; 37 38 foreach (ComparisonFilter filter in filters) { 39 bool[] filterResult = filter.Check(); 40 41 for(int row = 0; row < result.Length; ++row) { 42 result[row] = result[row] & filterResult[row]; 43 } 44 } 45 46 return result; 47 } 48 49 public void Apply(IList<ComparisonFilter> filters) 50 { 51 bool[] results = Preview(filters); 52 53 for(int row = 0; row < results.Length; ++row) 54 if(!results[row]){ 55 preprocessingData.DeleteRow(row); 56 } 57 } 58 } 24 59 } 25 60 } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Interfaces/IFilterLogic.cs
r10558 r10619 20 20 #endregion 21 21 22 using HeuristicLab.DataPreprocessing.Filter; 23 using System.Collections.Generic; 22 24 namespace HeuristicLab.DataPreprocessing { 23 25 public interface IFilterLogic { 26 List<bool> Preview(IList<IFilter> filters); 27 void Apply(IList<IFilter> filters); 24 28 } 25 29 }
Note: See TracChangeset
for help on using the changeset viewer.