- Timestamp:
- 05/28/14 12:52:24 (11 years ago)
- Location:
- branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/DataGridContent.cs
r10809 r10900 123 123 } 124 124 125 public bool Validate(string value, out string errorMessage, int columnIndex) {126 return dataGridLogic.Validate(value, out errorMessage, columnIndex);127 }128 129 125 public string GetValue(int rowIndex, int columnIndex) { 130 126 return dataGridLogic.GetValue(columnIndex, rowIndex); -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/DataGridLogic.cs
r10804 r10900 69 69 throw new ArgumentOutOfRangeException("column index is out of range"); 70 70 } 71 71 72 bool valid = false; 73 errorMessage = string.Empty; 72 74 if (preprocessingData.IsType<double>(columnIndex)) { 73 75 double val; 74 76 valid = double.TryParse(value, out val); 75 errorMessage = string.Empty;76 77 if (!valid) { 77 78 errorMessage = "Invalid Value (Valid Value Format: \"" + FormatPatterns.GetDoubleFormatPattern() + "\")"; … … 79 80 } else if (preprocessingData.IsType<string>(columnIndex)) { 80 81 valid = value != null; 81 errorMessage = string.Empty;82 82 if (!valid) { 83 83 errorMessage = "Invalid Value (string must not be null)"; … … 86 86 DateTime date; 87 87 valid = DateTime.TryParse(value, out date); 88 errorMessage = string.Empty;89 88 if (!valid) { 90 89 errorMessage = "Invalid Value (Valid Value Format: \"" + CultureInfo.CurrentCulture.DateTimeFormat + "\""; -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/FilterLogic.cs
r10849 r10900 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using System.Linq; … … 37 38 38 39 if (activeFilters.Count == 0) { 39 return new bool[preprocessingData.Rows];40 return CreateBoolArray(preprocessingData.Rows, false); 40 41 } 42 return GetActiveFilterResult(activeFilters, isAndCombination); 43 } 41 44 45 private bool[] GetActiveFilterResult(IList<IFilter> activeFilters, bool isAndCombination) { 42 46 bool[] result = CreateBoolArray(preprocessingData.Rows, !isAndCombination); 43 47 … … 52 56 53 57 public bool[] Preview(IList<IFilter> filters, bool isAndCombination) { 54 var result = GetFilterResult(filters, isAndCombination); 55 preprocessingData.SetFilter(result); 56 return result; 58 IList<IFilter> activeFilters = filters.Where(f => f.Active && f.ConstraintData != null).ToList<IFilter>(); 59 if (activeFilters.Count > 0) { 60 var result = GetActiveFilterResult(activeFilters, isAndCombination); 61 preprocessingData.SetFilter(result); 62 return result; 63 } else { 64 return CreateBoolArray(preprocessingData.Rows, false); 65 } 57 66 } 58 67 … … 74 83 } 75 84 85 public bool IsFiltered() { 86 return preprocessingData.IsFiltered; 87 } 88 76 89 public IPreprocessingData PreprocessingData { 77 90 get { return preprocessingData; } 78 91 } 92 93 public event EventHandler FilterChanged { 94 add { preprocessingData.FilterChanged += value; } 95 remove { preprocessingData.FilterChanged -= value; } 96 } 79 97 } 80 98 } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/FilteredPreprocessingData.cs
r10847 r10900 118 118 } 119 119 } 120 121 OnFilterChanged(); 120 122 } 121 123 122 124 public void PersistFilter() { 123 originalData = (ITransactionalPreprocessingData)filteredData.Clone(); 125 originalData.InTransaction(() => { 126 for (int i = 0; i < filteredData.Columns; ++i) { 127 if (filteredData.IsType<double>(i)) { 128 originalData.SetValues<double>(i, filteredData.GetValues<double>(i)); 129 } else if (filteredData.IsType<string>(i)) { 130 originalData.SetValues<string>(i, filteredData.GetValues<string>(i)); 131 } else if (filteredData.IsType<DateTime>(i)) { 132 originalData.SetValues<DateTime>(i, filteredData.GetValues<DateTime>(i)); 133 } else { 134 throw new ArgumentException("Data types of columns do not match"); 135 } 136 } 137 }); 124 138 ResetFilter(); 125 139 } … … 127 141 public void ResetFilter() { 128 142 filteredData = null; 143 OnFilterChanged(); 144 } 145 146 private void OnFilterChanged() { 147 if (FilterChanged != null) { 148 FilterChanged(this, new EventArgs()); 149 } 129 150 } 130 151 … … 171 192 } 172 193 194 public event EventHandler FilterChanged; 195 173 196 #region IPreprocessingData Members 174 197
Note: See TracChangeset
for help on using the changeset viewer.