private void SaveSnapshot(DataPreprocessingChangedEventType changedType, int column, int row)
        {
            if (IsInTransaction)
            {
                return;
            }

            var currentSnapshot = new Snapshot {
                VariableValues    = CopyVariableValues(variableValues),
                VariableNames     = new List <string>(variableNames),
                TrainingPartition = new IntRange(TrainingPartition.Start, TrainingPartition.End),
                TestPartition     = new IntRange(TestPartition.Start, TestPartition.End),
                Transformations   = new List <ITransformation>(transformations),
                ChangedType       = changedType,
                ChangedColumn     = column,
                ChangedRow        = row
            };

            if (undoHistory.Count >= MAX_UNDO_DEPTH)
            {
                undoHistory.RemoveAt(0);
            }

            undoHistory.Add(currentSnapshot);
        }
 public void BeginTransaction(DataPreprocessingChangedEventType type)
 {
     if (IsFiltered)
     {
         throw new InvalidOperationException("Transaction not possible while data is filtered");
     }
     originalData.BeginTransaction(type);
 }
 public void InTransaction(Action action, DataPreprocessingChangedEventType type = DataPreprocessingChangedEventType.Any)
 {
     if (IsFiltered)
     {
         throw new InvalidOperationException("Transaction not possible while data is filtered");
     }
     originalData.InTransaction(action, type);
 }
        protected virtual void OnChanged(DataPreprocessingChangedEventType type, int column, int row)
        {
            var listeners = Changed;

            if (listeners != null)
            {
                listeners(this, new DataPreprocessingChangedEventArgs(type, column, row));
            }
        }
 public void BeginTransaction(DataPreprocessingChangedEventType type)
 {
     SaveSnapshot(type, -1, -1);
     eventStack.Push(type);
 }
 public void InTransaction(Action action, DataPreprocessingChangedEventType type = DataPreprocessingChangedEventType.Any)
 {
     BeginTransaction(type);
     action();
     EndTransaction();
 }
 public DataPreprocessingChangedEventArgs(DataPreprocessingChangedEventType type, int column, int row) {
   Type = type;
   Column = column;
   Row = row;
 }
 public DataPreprocessingChangedEventArgs(DataPreprocessingChangedEventType type, int column, int row)
 {
     Type   = type;
     Column = column;
     Row    = row;
 }