Free cookie consent management tool by TermsFeed Policy Generator

Changeset 10814


Ignore:
Timestamp:
05/07/14 14:22:08 (10 years ago)
Author:
pfleck
Message:
  • Considered Transformations in Undo.
  • Renamed PDSnapshot in Snapshot.
Location:
branches/DataPreprocessing
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/TransformationView.cs

    r10786 r10814  
    2121
    2222using System;
     23using System.Windows.Forms;
     24using HeuristicLab.Data;
    2325using HeuristicLab.MainForm;
    2426using HeuristicLab.MainForm.WindowsForms;
     
    5456      bool success = transformator.ApplyTransformations(transformations);
    5557      if (success) {
     58        //foreach (var transformation in transformations)
     59        //  Content.CheckedTransformationCollection.SetItemCheckedState(transformation, false);
    5660        Content.CheckedTransformationCollection.Clear();
     61        MessageBox.Show(this, "Transformations applied.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
    5762      }
    5863    }
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/TransactionalPreprocessingData.cs

    r10805 r10814  
    2626using HeuristicLab.Core;
    2727using HeuristicLab.Problems.DataAnalysis;
     28using HeuristicLab.Problems.DataAnalysis.Transformations;
    2829
    2930namespace HeuristicLab.DataPreprocessing {
    3031
    31   internal class PDSnapshot {
     32  internal class Snapshot {
    3233    public IList<IList> VariableValues { get; set; }
    3334
     
    3536
    3637    public double TrainingToTestRatio { get; set; }
     38
     39    public IList<ITransformation> Transformations { get; set; }
    3740
    3841    public DataPreprocessingChangedEventType ChangedType { get; set; }
     
    4851    private const int MAX_UNDO_DEPTH = 5;
    4952
    50     private IList<PDSnapshot> undoHistory;
     53    private IList<Snapshot> undoHistory;
    5154
    5255    private Stack<DataPreprocessingChangedEventType> eventStack = new Stack<DataPreprocessingChangedEventType>();
     
    5861    public TransactionalPreprocessingData(IDataAnalysisProblemData problemData)
    5962      : base(problemData) {
    60       undoHistory = new List<PDSnapshot>();
     63      undoHistory = new List<Snapshot>();
    6164    }
    6265
    6366    private TransactionalPreprocessingData(TransactionalPreprocessingData original, Cloner cloner)
    6467      : base(original, cloner) {
    65       undoHistory = new List<PDSnapshot>();
     68      undoHistory = new List<Snapshot>();
    6669    }
    6770
     
    6972      if (eventStack.Count > 0) return;
    7073
    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      };
    7883
    7984      if (undoHistory.Count >= MAX_UNDO_DEPTH)
     
    151156    public void Undo() {
    152157      if (IsUndoAvailable) {
    153         PDSnapshot previousSnapshot = undoHistory[undoHistory.Count - 1];
     158        Snapshot previousSnapshot = undoHistory[undoHistory.Count - 1];
    154159        variableValues = previousSnapshot.VariableValues;
    155160        variableNames = previousSnapshot.VariableNames;
    156161        trainingToTestRatio = previousSnapshot.TrainingToTestRatio;
     162        transformations = previousSnapshot.Transformations;
    157163        undoHistory.Remove(previousSnapshot);
    158164        OnChanged(previousSnapshot.ChangedType,
     
    176182      if (eventStack.Count == 0)
    177183        throw new InvalidOperationException("There is no open transaction that can be ended.");
    178      
     184
    179185      var @event = eventStack.Pop();
    180186      OnChanged(@event, -1, -1);
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/TransformationContent.cs

    r10772 r10814  
    2323using HeuristicLab.Common;
    2424using HeuristicLab.Core;
    25 using HeuristicLab.Problems.DataAnalysis;
    2625using HeuristicLab.Problems.DataAnalysis.Transformations;
    2726
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/PreprocessingTransformator.cs

    r10811 r10814  
    2323using System.Collections.Generic;
    2424using System.Linq;
    25 using HeuristicLab.Problems.DataAnalysis.Symbolic;
    2625using HeuristicLab.Problems.DataAnalysis.Transformations;
    2726
     
    4342
    4443      if (!success) {
    45         // TODO: check undo remove transformations
    4644        preprocessingData.Undo();
    4745      }
  • branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/DataAnalysisProblemData.cs

    r10772 r10814  
    121121      if (!Parameters.ContainsKey(TransformationsParameterName)) {
    122122        Parameters.Add(new FixedValueParameter<ReadOnlyItemCollection<ITransformation>>(TransformationsParameterName, "", new ItemCollection<ITransformation>().AsReadOnly()));
     123        TransformationsParameter.Hidden = true;
    123124      }
    124125      RegisterEventHandlers();
     
    151152      Parameters.Add(new FixedValueParameter<ReadOnlyItemCollection<ITransformation>>(TransformationsParameterName, "", transformationsCollection.AsReadOnly()));
    152153
     154      TransformationsParameter.Hidden = true;
     155
    153156      ((ValueParameter<Dataset>)DatasetParameter).ReactOnValueToStringChangedAndValueItemImageChanged = false;
    154157      RegisterEventHandlers();
Note: See TracChangeset for help on using the changeset viewer.