Changeset 10814 for branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/TransactionalPreprocessingData.cs
- Timestamp:
- 05/07/14 14:22:08 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/TransactionalPreprocessingData.cs
r10805 r10814 26 26 using HeuristicLab.Core; 27 27 using HeuristicLab.Problems.DataAnalysis; 28 using HeuristicLab.Problems.DataAnalysis.Transformations; 28 29 29 30 namespace HeuristicLab.DataPreprocessing { 30 31 31 internal class PDSnapshot {32 internal class Snapshot { 32 33 public IList<IList> VariableValues { get; set; } 33 34 … … 35 36 36 37 public double TrainingToTestRatio { get; set; } 38 39 public IList<ITransformation> Transformations { get; set; } 37 40 38 41 public DataPreprocessingChangedEventType ChangedType { get; set; } … … 48 51 private const int MAX_UNDO_DEPTH = 5; 49 52 50 private IList< PDSnapshot> undoHistory;53 private IList<Snapshot> undoHistory; 51 54 52 55 private Stack<DataPreprocessingChangedEventType> eventStack = new Stack<DataPreprocessingChangedEventType>(); … … 58 61 public TransactionalPreprocessingData(IDataAnalysisProblemData problemData) 59 62 : base(problemData) { 60 undoHistory = new List< PDSnapshot>();63 undoHistory = new List<Snapshot>(); 61 64 } 62 65 63 66 private TransactionalPreprocessingData(TransactionalPreprocessingData original, Cloner cloner) 64 67 : base(original, cloner) { 65 undoHistory = new List< PDSnapshot>();68 undoHistory = new List<Snapshot>(); 66 69 } 67 70 … … 69 72 if (eventStack.Count > 0) return; 70 73 71 PDSnapshot currentSnapshot = new PDSnapshot(); 72 currentSnapshot.VariableValues = CopyVariableValues(variableValues); 73 currentSnapshot.VariableNames = new List<string>(variableNames); 74 currentSnapshot.TrainingToTestRatio = trainingToTestRatio; 75 currentSnapshot.ChangedType = changedType; 76 currentSnapshot.ChangedColumn = column; 77 currentSnapshot.ChangedRow = row; 74 var currentSnapshot = new Snapshot { 75 VariableValues = CopyVariableValues(variableValues), 76 VariableNames = new List<string>(variableNames), 77 TrainingToTestRatio = trainingToTestRatio, 78 Transformations = new List<ITransformation>(transformations), 79 ChangedType = changedType, 80 ChangedColumn = column, 81 ChangedRow = row 82 }; 78 83 79 84 if (undoHistory.Count >= MAX_UNDO_DEPTH) … … 151 156 public void Undo() { 152 157 if (IsUndoAvailable) { 153 PDSnapshot previousSnapshot = undoHistory[undoHistory.Count - 1];158 Snapshot previousSnapshot = undoHistory[undoHistory.Count - 1]; 154 159 variableValues = previousSnapshot.VariableValues; 155 160 variableNames = previousSnapshot.VariableNames; 156 161 trainingToTestRatio = previousSnapshot.TrainingToTestRatio; 162 transformations = previousSnapshot.Transformations; 157 163 undoHistory.Remove(previousSnapshot); 158 164 OnChanged(previousSnapshot.ChangedType, … … 176 182 if (eventStack.Count == 0) 177 183 throw new InvalidOperationException("There is no open transaction that can be ended."); 178 184 179 185 var @event = eventStack.Pop(); 180 186 OnChanged(@event, -1, -1);
Note: See TracChangeset
for help on using the changeset viewer.