Changeset 10814
- Timestamp:
- 05/07/14 14:22:08 (10 years ago)
- Location:
- branches/DataPreprocessing
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/TransformationView.cs
r10786 r10814 21 21 22 22 using System; 23 using System.Windows.Forms; 24 using HeuristicLab.Data; 23 25 using HeuristicLab.MainForm; 24 26 using HeuristicLab.MainForm.WindowsForms; … … 54 56 bool success = transformator.ApplyTransformations(transformations); 55 57 if (success) { 58 //foreach (var transformation in transformations) 59 // Content.CheckedTransformationCollection.SetItemCheckedState(transformation, false); 56 60 Content.CheckedTransformationCollection.Clear(); 61 MessageBox.Show(this, "Transformations applied.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); 57 62 } 58 63 } -
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); -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/TransformationContent.cs
r10772 r10814 23 23 using HeuristicLab.Common; 24 24 using HeuristicLab.Core; 25 using HeuristicLab.Problems.DataAnalysis;26 25 using HeuristicLab.Problems.DataAnalysis.Transformations; 27 26 -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/PreprocessingTransformator.cs
r10811 r10814 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using HeuristicLab.Problems.DataAnalysis.Symbolic;26 25 using HeuristicLab.Problems.DataAnalysis.Transformations; 27 26 … … 43 42 44 43 if (!success) { 45 // TODO: check undo remove transformations46 44 preprocessingData.Undo(); 47 45 } -
branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/DataAnalysisProblemData.cs
r10772 r10814 121 121 if (!Parameters.ContainsKey(TransformationsParameterName)) { 122 122 Parameters.Add(new FixedValueParameter<ReadOnlyItemCollection<ITransformation>>(TransformationsParameterName, "", new ItemCollection<ITransformation>().AsReadOnly())); 123 TransformationsParameter.Hidden = true; 123 124 } 124 125 RegisterEventHandlers(); … … 151 152 Parameters.Add(new FixedValueParameter<ReadOnlyItemCollection<ITransformation>>(TransformationsParameterName, "", transformationsCollection.AsReadOnly())); 152 153 154 TransformationsParameter.Hidden = true; 155 153 156 ((ValueParameter<Dataset>)DatasetParameter).ReactOnValueToStringChangedAndValueItemImageChanged = false; 154 157 RegisterEventHandlers();
Note: See TracChangeset
for help on using the changeset viewer.