Changeset 15274 for branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Logic/ManipulationLogic.cs
- Timestamp:
- 07/19/17 14:32:57 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Logic/ManipulationLogic.cs
r15270 r15274 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using HeuristicLab.Common; 26 using HeuristicLab.Core; 25 27 using HeuristicLab.Data; 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 29 using HeuristicLab.Random; 27 30 28 31 namespace HeuristicLab.DataPreprocessing { 29 public class ManipulationLogic { 30 private readonly IPreprocessingData preprocessingData; 32 [Item("ManipulationLogic", "")] 33 [StorableClass] 34 public class ManipulationLogic : Item { 35 36 [Storable] 37 private readonly IFilteredPreprocessingData preprocessingData; 38 39 [Storable] 31 40 private readonly StatisticsLogic statisticsLogic; 32 41 … … 35 44 } 36 45 37 public I PreprocessingData PreProcessingData {46 public IFilteredPreprocessingData PreProcessingData { 38 47 get { return preprocessingData; } 39 48 } 40 49 41 public ManipulationLogic(IPreprocessingData preprocessingData, StatisticsLogic theStatisticsLogic) { 50 #region Constructor, Cloning & Persistence 51 public ManipulationLogic(IFilteredPreprocessingData preprocessingData, StatisticsLogic theStatisticsLogic) { 42 52 this.preprocessingData = preprocessingData; 43 53 statisticsLogic = theStatisticsLogic; 44 54 } 55 public ManipulationLogic(ManipulationLogic original, Cloner cloner) 56 : base(original, cloner) { 57 preprocessingData = cloner.Clone(original.preprocessingData); 58 statisticsLogic = cloner.Clone(original.statisticsLogic); 59 } 60 public override IDeepCloneable Clone(Cloner cloner) { 61 return new ManipulationLogic(this, cloner); 62 } 63 64 [StorableConstructor] 65 protected ManipulationLogic(bool deserializing) 66 : base(deserializing) { } 67 #endregion 45 68 46 69 public void ReplaceIndicesByValue<T>(int columnIndex, IEnumerable<int> rowIndices, T value) { … … 123 146 for (int i = 0; i < count; ++i) { 124 147 if (start == int.MinValue) { 125 start = indexOfPrevPresentValue(column.Key, rowIndices[i]);148 start = IndexOfPrevPresentValue(column.Key, rowIndices[i]); 126 149 } 127 150 if (i + 1 == count || (i + 1 < count && rowIndices[i + 1] - rowIndices[i] > 1)) { 128 int next = indexOfNextPresentValue(column.Key, rowIndices[i]);151 int next = IndexOfNextPresentValue(column.Key, rowIndices[i]); 129 152 if (start > 0 && next < preprocessingData.Rows) { 130 153 startEndings.Add(new Tuple<int, int>(start, next)); … … 144 167 // dont replace first or last values 145 168 if (index > 0 && index < countValues) { 146 int prevIndex = indexOfPrevPresentValue(column.Key, index);147 int nextIndex = indexOfNextPresentValue(column.Key, index);169 int prevIndex = IndexOfPrevPresentValue(column.Key, index); 170 int nextIndex = IndexOfNextPresentValue(column.Key, index); 148 171 149 172 // no neighbours found … … 183 206 } 184 207 185 private int indexOfPrevPresentValue(int columnIndex, int start) {208 private int IndexOfPrevPresentValue(int columnIndex, int start) { 186 209 int offset = start - 1; 187 210 while (offset >= 0 && preprocessingData.IsCellEmpty(columnIndex, offset)) { … … 192 215 } 193 216 194 private int indexOfNextPresentValue(int columnIndex, int start) {217 private int IndexOfNextPresentValue(int columnIndex, int start) { 195 218 int offset = start + 1; 196 219 while (offset < preprocessingData.Rows && preprocessingData.IsCellEmpty(columnIndex, offset)) {
Note: See TracChangeset
for help on using the changeset viewer.