- Timestamp:
- 03/12/14 17:03:45 (11 years ago)
- Location:
- branches/DataPreprocessing
- Files:
-
- 11 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/DataPreprocessingView.cs
r10558 r10586 64 64 65 65 //create content items 66 I PreprocessingData data = Content.Data;66 ITransactionalPreprocessingData data = Content.Data; 67 67 ISearchLogic searchLogic = new SearchLogic(data); 68 68 var dataGridLogic = new DataGridLogic(data); -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/HeuristicLab.DataPreprocessing-3.3.csproj
r10559 r10586 71 71 </ItemGroup> 72 72 <ItemGroup> 73 <Compile Include="Implementations\PreprocessingData.cs" /> 73 74 <Compile Include="Implementations\DataGridLogic.cs" /> 74 75 <Compile Include="Implementations\DataPreprocessingChangedEvent.cs" /> … … 76 77 <Compile Include="Implementations\Filter\IFilter.cs" /> 77 78 <Compile Include="Implementations\ManipulationLogic.cs" /> 79 <Compile Include="Interfaces\IPreprocessingData.cs" /> 78 80 <Compile Include="Interfaces\IDataGridLogic.cs" /> 79 81 <Compile Include="Implementations\FilterContent.cs" /> … … 95 97 <Compile Include="Implementations\DataGridContent.cs" /> 96 98 <Compile Include="Implementations\PreprocessingContext.cs" /> 97 <Compile Include="Implementations\ PreprocessingData.cs" />99 <Compile Include="Implementations\TransactionalPreprocessingData.cs" /> 98 100 <Compile Include="Implementations\SearchLogic.cs" /> 99 101 <Compile Include="Implementations\StatisticsLogic.cs" /> … … 102 104 <Compile Include="Interfaces\ISearchLogic.cs" /> 103 105 <Compile Include="Interfaces\IStatisticsLogic.cs" /> 104 <Compile Include="Interfaces\I PreprocessingData.cs" />106 <Compile Include="Interfaces\ITransactionalPreprocessingData.cs" /> 105 107 <Compile Include="Plugin.cs" /> 106 108 <Compile Include="Properties\AssemblyInfo.cs" /> -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/DataGridLogic.cs
r10571 r10586 29 29 public class DataGridLogic : IDataGridLogic { 30 30 31 private I PreprocessingData preprocessingData;31 private ITransactionalPreprocessingData preprocessingData; 32 32 33 public DataGridLogic(I PreprocessingData preprocessingData) {33 public DataGridLogic(ITransactionalPreprocessingData preprocessingData) { 34 34 this.preprocessingData = preprocessingData; 35 35 } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/HistogramLogic.cs
r10581 r10586 26 26 namespace HeuristicLab.DataPreprocessing { 27 27 public class HistogramLogic : IHistogramLogic { 28 private I PreprocessingData preprocessingData;28 private ITransactionalPreprocessingData preprocessingData; 29 29 private DataTable dataTable; 30 30 31 public HistogramLogic(I PreprocessingData preprocessingData) {31 public HistogramLogic(ITransactionalPreprocessingData preprocessingData) { 32 32 this.preprocessingData = preprocessingData; 33 33 dataTable = new DataTable("Histogram"); -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/LineChartLogic.cs
r10581 r10586 26 26 namespace HeuristicLab.DataPreprocessing { 27 27 public class LineChartLogic : ILineChartLogic { 28 private I PreprocessingData preprocessingData;28 private ITransactionalPreprocessingData preprocessingData; 29 29 private DataTable dataTable; 30 30 31 public LineChartLogic(I PreprocessingData preprocessingData) {31 public LineChartLogic(ITransactionalPreprocessingData preprocessingData) { 32 32 this.preprocessingData = preprocessingData; 33 33 dataTable = new DataTable("LineChart"); -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/ManipulationLogic.cs
r10580 r10586 27 27 namespace HeuristicLab.DataPreprocessing { 28 28 public class ManipulationLogic : IManipulationLogic { 29 private I PreprocessingData preprocessingData;29 private ITransactionalPreprocessingData preprocessingData; 30 30 private IStatisticsLogic statisticInfo; 31 31 private ISearchLogic searchLogic; 32 32 33 public ManipulationLogic(I PreprocessingData _prepocessingData, ISearchLogic theSearchLogic, IStatisticsLogic theStatisticsLogic) {33 public ManipulationLogic(ITransactionalPreprocessingData _prepocessingData, ISearchLogic theSearchLogic, IStatisticsLogic theStatisticsLogic) { 34 34 preprocessingData = _prepocessingData; 35 35 searchLogic = theSearchLogic; -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/PreprocessingContext.cs
r10536 r10586 32 32 33 33 public PreprocessingContext(IDataAnalysisProblemData dataAnalysisProblemData, IAlgorithm algorithm, IDataAnalysisProblem problem) { 34 Data = new PreprocessingData(dataAnalysisProblemData);34 Data = new TransactionalPreprocessingData(dataAnalysisProblemData); 35 35 DataAnalysisProblemData = dataAnalysisProblemData; 36 36 Algorithm = algorithm; … … 46 46 } 47 47 48 public I PreprocessingData Data { get; private set; }48 public ITransactionalPreprocessingData Data { get; private set; } 49 49 50 50 public IDataAnalysisProblemData DataAnalysisProblemData { get; private set; } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/PreprocessingData.cs
r10581 r10586 31 31 namespace HeuristicLab.DataPreprocessing { 32 32 33 internal class PDSnapshot {34 public IDictionary<int, IList> VariableValues { get; set; }35 36 public IList<string> VariableNames { get; set; }37 38 public double TrainingToTestRatio { get; set; }39 40 public DataPreprocessingChangedEventType ChangedType { get; set; }41 42 public int ChangedColumn { get; set; }43 44 public int ChangedRow { get; set; }45 }46 47 33 [Item("PreprocessingData", "Represents data used for preprocessing.")] 48 34 public class PreprocessingData : NamedItem, IPreprocessingData { 49 35 50 private const int MAX_UNDO_DEPTH = 5; 51 52 private IDictionary<int, IList> variableValues; 53 54 private IList<string> variableNames; 55 56 private double trainingToTestRatio; 57 58 private IList<PDSnapshot> undoHistory; 59 60 //TODO: refactor extract Transaction logic in a own class 61 private int transactionDepth = 0; 62 63 private PreprocessingData(PreprocessingData original, Cloner cloner) 36 protected IDictionary<int, IList> variableValues; 37 38 protected IList<string> variableNames; 39 40 protected double trainingToTestRatio; 41 42 protected PreprocessingData(PreprocessingData original, Cloner cloner) 64 43 : base(original, cloner) { 65 44 variableValues = CopyVariableValues(original.variableValues); 66 45 variableNames = new List<string>(original.variableNames); 67 46 trainingToTestRatio = original.trainingToTestRatio; 68 undoHistory = new List<PDSnapshot>();69 47 } 70 48 … … 92 70 93 71 trainingToTestRatio = (double)problemData.TrainingPartition.Size / Math.Max(problemData.Dataset.Rows, double.Epsilon); 94 undoHistory = new List<PDSnapshot>();95 72 } 96 73 … … 103 80 } 104 81 105 pr ivateIDictionary<int, IList> CopyVariableValues(IDictionary<int, IList> original) {82 protected IDictionary<int, IList> CopyVariableValues(IDictionary<int, IList> original) { 106 83 var copy = new Dictionary<int, IList>(variableValues); 107 84 for (int i = 0; i < original.Count; i++) { … … 111 88 } 112 89 113 private void SaveSnapshot(DataPreprocessingChangedEventType changedType, int column, int row) {114 if (transactionDepth > 0) return;115 116 PDSnapshot currentSnapshot = new PDSnapshot();117 currentSnapshot.VariableValues = CopyVariableValues(variableValues);118 currentSnapshot.VariableNames = new List<string>(variableNames);119 currentSnapshot.TrainingToTestRatio = trainingToTestRatio;120 currentSnapshot.ChangedType = changedType;121 currentSnapshot.ChangedColumn = column;122 currentSnapshot.ChangedRow = row;123 124 if (undoHistory.Count >= MAX_UNDO_DEPTH)125 undoHistory.RemoveAt(0);126 127 undoHistory.Add(currentSnapshot);128 }129 130 90 #region NamedItem abstract Member Implementations 131 91 … … 143 103 144 104 145 public void SetCell<T>(int columnIndex, int rowIndex, T value) { 146 SaveSnapshot(DataPreprocessingChangedEventType.ChangeItem, columnIndex, rowIndex); 105 public virtual void SetCell<T>(int columnIndex, int rowIndex, T value) { 147 106 variableValues[columnIndex][rowIndex] = value; 148 if (transactionDepth <= 0)149 OnChanged(DataPreprocessingChangedEventType.ChangeItem, columnIndex, rowIndex);150 107 } 151 108 … … 165 122 } 166 123 167 public v oid SetValues<T>(int columnIndex, IList<T> values) {124 public virtual void SetValues<T>(int columnIndex, IList<T> values) { 168 125 if (IsType<T>(columnIndex)) { 169 SaveSnapshot(DataPreprocessingChangedEventType.ChangeColumn, columnIndex, -1);170 126 variableValues[columnIndex] = (IList)values; 171 127 } else { 172 128 throw new ArgumentException("The datatype of column " + columnIndex + " must be of type " + variableValues[columnIndex].GetType().Name + " but was " + typeof(T).Name); 173 129 } 174 if (transactionDepth <= 0) 175 OnChanged(DataPreprocessingChangedEventType.ChangeColumn, columnIndex, -1); 176 } 177 178 public void InsertRow(int rowIndex) { 179 SaveSnapshot(DataPreprocessingChangedEventType.DeleteRow, -1, rowIndex); 130 } 131 132 public virtual void InsertRow(int rowIndex) { 180 133 foreach (IList column in variableValues.Values) { 181 134 Type type = column.GetType().GetGenericArguments()[0]; 182 135 column.Insert(rowIndex, type.IsValueType ? Activator.CreateInstance(type) : null); 183 136 } 184 if (transactionDepth <= 0) 185 OnChanged(DataPreprocessingChangedEventType.AddRow, -1, rowIndex); 186 } 187 188 public void DeleteRow(int rowIndex) { 189 SaveSnapshot(DataPreprocessingChangedEventType.AddRow, -1, rowIndex); 137 } 138 139 public virtual void DeleteRow(int rowIndex) { 190 140 foreach (IList column in variableValues.Values) { 191 141 column.RemoveAt(rowIndex); 192 142 } 193 if (transactionDepth <= 0) 194 OnChanged(DataPreprocessingChangedEventType.DeleteRow, -1, rowIndex); 195 } 196 197 public void InsertColumn<T>(string variableName, int columnIndex) { 198 SaveSnapshot(DataPreprocessingChangedEventType.DeleteColumn, columnIndex, -1); 143 } 144 145 public virtual void InsertColumn<T>(string variableName, int columnIndex) { 199 146 variableValues.Add(columnIndex, new List<T>(Rows)); 200 147 variableNames.Insert(columnIndex, variableName); 201 if (transactionDepth <= 0) 202 OnChanged(DataPreprocessingChangedEventType.AddColumn, columnIndex, -1); 203 } 204 205 public void DeleteColumn(int columnIndex) { 206 SaveSnapshot(DataPreprocessingChangedEventType.AddColumn, columnIndex, -1); 148 } 149 150 public virtual void DeleteColumn(int columnIndex) { 207 151 variableValues.Remove(columnIndex); 208 152 variableNames.RemoveAt(columnIndex); 209 if (transactionDepth <= 0)210 OnChanged(DataPreprocessingChangedEventType.DeleteColumn, columnIndex, -1);211 153 } 212 154 … … 252 194 var dataset = new Dataset(variableNames, values); 253 195 return dataset; 254 }255 256 public event DataPreprocessingChangedEventHandler Changed;257 protected virtual void OnChanged(DataPreprocessingChangedEventType type, int column, int row) {258 var listeners = Changed;259 if (listeners != null) listeners(this, new DataPreprocessingChangedEventArgs(type, column, row));260 }261 262 public bool IsUndoAvailable {263 get { return undoHistory.Count > 0; }264 }265 266 public void Undo() {267 if (IsUndoAvailable) {268 PDSnapshot previousSnapshot = undoHistory[undoHistory.Count - 1];269 variableValues = previousSnapshot.VariableValues;270 variableNames = previousSnapshot.VariableNames;271 trainingToTestRatio = previousSnapshot.TrainingToTestRatio;272 undoHistory.Remove(previousSnapshot);273 OnChanged(previousSnapshot.ChangedType,274 previousSnapshot.ChangedColumn,275 previousSnapshot.ChangedRow);276 }277 }278 279 public void BeginTransaction() {280 SaveSnapshot(DataPreprocessingChangedEventType.Any, -1, -1);281 transactionDepth++;282 }283 284 public void EndTransaction() {285 transactionDepth--;286 if (transactionDepth < 0)287 throw new InvalidOperationException("There is no open transaction that can be ended.");288 if (transactionDepth == 0)289 OnChanged(DataPreprocessingChangedEventType.Any, -1, -1);290 196 } 291 197 -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/SearchLogic.cs
r10557 r10586 26 26 namespace HeuristicLab.DataPreprocessing { 27 27 public class SearchLogic : ISearchLogic { 28 private readonly I PreprocessingData preprocessingData;28 private readonly ITransactionalPreprocessingData preprocessingData; 29 29 30 public SearchLogic(I PreprocessingData thePreprocessingData) {30 public SearchLogic(ITransactionalPreprocessingData thePreprocessingData) { 31 31 preprocessingData = thePreprocessingData; 32 32 } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/StatisticsLogic.cs
r10551 r10586 29 29 public class StatisticsLogic : IStatisticsLogic { 30 30 31 private readonly I PreprocessingData preprocessingData;31 private readonly ITransactionalPreprocessingData preprocessingData; 32 32 private readonly ISearchLogic searchLogic; 33 33 34 public StatisticsLogic(I PreprocessingData thePreprocessingData, ISearchLogic theSearchLogic) {34 public StatisticsLogic(ITransactionalPreprocessingData thePreprocessingData, ISearchLogic theSearchLogic) { 35 35 preprocessingData = thePreprocessingData; 36 36 searchLogic = theSearchLogic; -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/TransactionalPreprocessingData.cs
r10585 r10586 23 23 using System.Collections; 24 24 using System.Collections.Generic; 25 using System.Linq;26 25 using HeuristicLab.Common; 27 26 using HeuristicLab.Core; 28 using HeuristicLab.Data;29 27 using HeuristicLab.Problems.DataAnalysis; 30 28 … … 46 44 47 45 [Item("PreprocessingData", "Represents data used for preprocessing.")] 48 public class PreprocessingData : NamedItem, IPreprocessingData {46 public class TransactionalPreprocessingData : PreprocessingData, ITransactionalPreprocessingData { 49 47 50 48 private const int MAX_UNDO_DEPTH = 5; 51 49 52 private IDictionary<int, IList> variableValues;53 54 private IList<string> variableNames;55 56 private double trainingToTestRatio;57 58 50 private IList<PDSnapshot> undoHistory; 59 51 60 //TODO: refactor extract Transaction logic in a own class61 52 private int transactionDepth = 0; 62 53 63 private PreprocessingData(PreprocessingData original, Cloner cloner)54 private TransactionalPreprocessingData(TransactionalPreprocessingData original, Cloner cloner) 64 55 : base(original, cloner) { 65 variableValues = CopyVariableValues(original.variableValues);66 variableNames = new List<string>(original.variableNames);67 trainingToTestRatio = original.trainingToTestRatio;68 56 undoHistory = new List<PDSnapshot>(); 69 57 } 70 58 71 public PreprocessingData(IDataAnalysisProblemData problemData) 72 : base() { 73 Name = "-"; 74 75 variableNames = new List<string>(problemData.Dataset.VariableNames); 76 // create dictionary from variable name to index 77 78 int columnIndex = 0; 79 variableValues = new Dictionary<int, IList>(); 80 foreach (var variableName in problemData.Dataset.VariableNames) { 81 if (problemData.Dataset.IsType<double>(variableName)) { 82 variableValues[columnIndex] = problemData.Dataset.GetDoubleValues(variableName).ToList(); 83 } else if (problemData.Dataset.IsType<string>(variableName)) { 84 variableValues[columnIndex] = CreateColumn<string>(problemData.Dataset, columnIndex, x => x); 85 } else if (problemData.Dataset.IsType<DateTime>(variableName)) { 86 variableValues[columnIndex] = CreateColumn<DateTime>(problemData.Dataset, columnIndex, x => DateTime.Parse(x)); 87 } else { 88 throw new ArgumentException("The datatype of column " + variableName + " must be of type List<double>, List<string> or List<DateTime>"); 89 } 90 ++columnIndex; 91 } 92 93 trainingToTestRatio = (double)problemData.TrainingPartition.Size / Math.Max(problemData.Dataset.Rows, double.Epsilon); 59 public TransactionalPreprocessingData(IDataAnalysisProblemData problemData) 60 : base(problemData) { 94 61 undoHistory = new List<PDSnapshot>(); 95 }96 97 private static IList CreateColumn<T>(Dataset ds, int column, Func<string, T> selector) {98 var list = new List<T>(ds.Rows);99 for (int row = 0; row < ds.Rows; ++row) {100 list.Add(selector(ds.GetValue(row, column)));101 }102 return list;103 }104 105 private IDictionary<int, IList> CopyVariableValues(IDictionary<int, IList> original) {106 var copy = new Dictionary<int, IList>(variableValues);107 for (int i = 0; i < original.Count; i++) {108 variableValues[i] = (IList)Activator.CreateInstance(original[i].GetType(), original[i]);109 }110 return copy;111 62 } 112 63 … … 131 82 132 83 public override IDeepCloneable Clone(Cloner cloner) { 133 return new PreprocessingData(this, cloner);84 return new TransactionalPreprocessingData(this, cloner); 134 85 } 135 86 136 87 #endregion 137 88 138 #region IPreprocessingData Members89 #region Overridden IPreprocessingData Members 139 90 140 public T GetCell<T>(int columnIndex, int rowIndex) { 141 return (T)variableValues[columnIndex][rowIndex]; 142 } 143 144 145 public void SetCell<T>(int columnIndex, int rowIndex, T value) { 91 public override void SetCell<T>(int columnIndex, int rowIndex, T value) { 146 92 SaveSnapshot(DataPreprocessingChangedEventType.ChangeItem, columnIndex, rowIndex); 147 variableValues[columnIndex][rowIndex] = value;93 base.SetCell<T>(columnIndex, rowIndex, value); 148 94 if (transactionDepth <= 0) 149 95 OnChanged(DataPreprocessingChangedEventType.ChangeItem, columnIndex, rowIndex); 150 96 } 151 97 152 153 public string GetCellAsString(int columnIndex, int rowIndex) { 154 return variableValues[columnIndex][rowIndex].ToString(); 155 } 156 157 158 [Obsolete("use the index based variant, is faster")] 159 public IList<T> GetValues<T>(string variableName) { 160 return GetValues<T>(GetColumnIndex(variableName)); 161 } 162 163 public IList<T> GetValues<T>(int columnIndex) { 164 return (IList<T>)variableValues[columnIndex]; 165 } 166 167 public void SetValues<T>(int columnIndex, IList<T> values) { 168 if (IsType<T>(columnIndex)) { 169 SaveSnapshot(DataPreprocessingChangedEventType.ChangeColumn, columnIndex, -1); 170 variableValues[columnIndex] = (IList)values; 171 } else { 172 throw new ArgumentException("The datatype of column " + columnIndex + " must be of type " + variableValues[columnIndex].GetType().Name + " but was " + typeof(T).Name); 173 } 98 public override void SetValues<T>(int columnIndex, IList<T> values) { 99 SaveSnapshot(DataPreprocessingChangedEventType.ChangeColumn, columnIndex, -1); 100 base.SetValues<T>(columnIndex, values); 174 101 if (transactionDepth <= 0) 175 102 OnChanged(DataPreprocessingChangedEventType.ChangeColumn, columnIndex, -1); 176 103 } 177 104 178 public void InsertRow(int rowIndex) {105 public override void InsertRow(int rowIndex) { 179 106 SaveSnapshot(DataPreprocessingChangedEventType.DeleteRow, -1, rowIndex); 180 foreach (IList column in variableValues.Values) { 181 Type type = column.GetType().GetGenericArguments()[0]; 182 column.Insert(rowIndex, type.IsValueType ? Activator.CreateInstance(type) : null); 183 } 107 base.InsertRow(rowIndex); 184 108 if (transactionDepth <= 0) 185 109 OnChanged(DataPreprocessingChangedEventType.AddRow, -1, rowIndex); 186 110 } 187 111 188 public void DeleteRow(int rowIndex) {112 public override void DeleteRow(int rowIndex) { 189 113 SaveSnapshot(DataPreprocessingChangedEventType.AddRow, -1, rowIndex); 190 foreach (IList column in variableValues.Values) { 191 column.RemoveAt(rowIndex); 192 } 114 base.DeleteRow(rowIndex); 193 115 if (transactionDepth <= 0) 194 116 OnChanged(DataPreprocessingChangedEventType.DeleteRow, -1, rowIndex); 195 117 } 196 118 197 public void InsertColumn<T>(string variableName, int columnIndex) {119 public override void InsertColumn<T>(string variableName, int columnIndex) { 198 120 SaveSnapshot(DataPreprocessingChangedEventType.DeleteColumn, columnIndex, -1); 199 variableValues.Add(columnIndex, new List<T>(Rows)); 200 variableNames.Insert(columnIndex, variableName); 121 base.InsertColumn<T>(variableName, columnIndex); 201 122 if (transactionDepth <= 0) 202 123 OnChanged(DataPreprocessingChangedEventType.AddColumn, columnIndex, -1); 203 124 } 204 125 205 public void DeleteColumn(int columnIndex) {126 public override void DeleteColumn(int columnIndex) { 206 127 SaveSnapshot(DataPreprocessingChangedEventType.AddColumn, columnIndex, -1); 207 variableValues.Remove(columnIndex); 208 variableNames.RemoveAt(columnIndex); 128 base.DeleteColumn(columnIndex); 209 129 if (transactionDepth <= 0) 210 130 OnChanged(DataPreprocessingChangedEventType.DeleteColumn, columnIndex, -1); 211 131 } 212 132 213 public IntRange TrainingPartition { 214 get { return new IntRange(0, (int)(Rows * trainingToTestRatio)); } 215 } 133 #endregion 216 134 217 public IntRange TestPartition { 218 get { return new IntRange((int)(Rows * trainingToTestRatio), Rows); } 219 } 220 221 public string GetVariableName(int columnIndex) { 222 return variableNames[columnIndex]; 223 } 224 225 public IEnumerable<string> VariableNames { 226 get { return variableNames; } 227 } 228 229 public int GetColumnIndex(string variableName) { 230 return variableNames.IndexOf(variableName); 231 } 232 233 public bool IsType<T>(int columnIndex) { 234 return variableValues[columnIndex] is List<T>; 235 } 236 237 public int Columns { 238 get { return variableNames.Count; } 239 } 240 241 public int Rows { 242 get { return variableValues.Count > 0 ? variableValues[0].Count : 0; } 243 } 244 245 public Dataset ExportToDataset() { 246 IList<IList> values = new List<IList>(); 247 248 for (int i = 0; i < Columns; ++i) { 249 values.Add(variableValues[i]); 250 } 251 252 var dataset = new Dataset(variableNames, values); 253 return dataset; 254 } 135 #region TransactionalPreprocessingData members 255 136 256 137 public event DataPreprocessingChangedEventHandler Changed; -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/TransformationLogic.cs
r10558 r10586 26 26 public class TransformationLogic : ITransformationLogic { 27 27 28 private readonly I PreprocessingData preprocessingData;28 private readonly ITransactionalPreprocessingData preprocessingData; 29 29 private readonly ISearchLogic searchLogic; 30 30 private readonly IStatisticsLogic statisticsLogic; 31 31 32 public TransformationLogic(I PreprocessingData thePreprocessingData, ISearchLogic theSearchLogic, IStatisticsLogic theStatisticsLogic) {32 public TransformationLogic(ITransactionalPreprocessingData thePreprocessingData, ISearchLogic theSearchLogic, IStatisticsLogic theStatisticsLogic) { 33 33 preprocessingData = thePreprocessingData; 34 34 searchLogic = theSearchLogic; -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Interfaces/IPreprocessingContext.cs
r10383 r10586 29 29 : IItem { 30 30 31 I PreprocessingData Data { get; }31 ITransactionalPreprocessingData Data { get; } 32 32 33 33 [Obsolete] -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Interfaces/IPreprocessingData.cs
r10580 r10586 61 61 62 62 Dataset ExportToDataset(); 63 64 event DataPreprocessingChangedEventHandler Changed;65 66 bool IsUndoAvailable { get; }67 void Undo();68 void BeginTransaction();69 void EndTransaction();70 63 } 71 64 } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Interfaces/ITransactionalPreprocessingData.cs
r10580 r10586 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using HeuristicLab.Core;25 using HeuristicLab.Data;26 using HeuristicLab.Problems.DataAnalysis;27 22 28 23 namespace HeuristicLab.DataPreprocessing { 29 24 30 public interface IPreprocessingData : INamedItem { 31 T GetCell<T>(int columnIndex, int rowIndex); 32 33 void SetCell<T>(int columnIndex, int rowIndex, T value); 34 35 string GetCellAsString(int columnIndex, int rowIndex); 36 37 [Obsolete("use the index based variant, is faster")] 38 IList<T> GetValues<T>(string variableName); 39 IList<T> GetValues<T>(int columnIndex); 40 41 void SetValues<T>(int columnIndex, IList<T> values); 42 43 void InsertRow(int rowIndex); 44 void DeleteRow(int rowIndex); 45 46 void InsertColumn<T>(string variableName, int columnIndex); 47 48 void DeleteColumn(int columnIndex); 49 50 IntRange TrainingPartition { get; } 51 IntRange TestPartition { get; } 52 53 IEnumerable<string> VariableNames { get; } 54 string GetVariableName(int columnIndex); 55 int GetColumnIndex(string variableName); 56 57 bool IsType<T>(int columnIndex); 58 59 int Columns { get; } 60 int Rows { get; } 61 62 Dataset ExportToDataset(); 25 public interface ITransactionalPreprocessingData : IPreprocessingData { 63 26 64 27 event DataPreprocessingChangedEventHandler Changed;
Note: See TracChangeset
for help on using the changeset viewer.