コード例 #1
0
        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);
        }
コード例 #2
0
 public void BeginTransaction(DataPreprocessingChangedEventType type)
 {
     if (IsFiltered)
     {
         throw new InvalidOperationException("Transaction not possible while data is filtered");
     }
     originalData.BeginTransaction(type);
 }
コード例 #3
0
 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);
 }
コード例 #4
0
        protected virtual void OnChanged(DataPreprocessingChangedEventType type, int column, int row)
        {
            var listeners = Changed;

            if (listeners != null)
            {
                listeners(this, new DataPreprocessingChangedEventArgs(type, column, row));
            }
        }
コード例 #5
0
 public void BeginTransaction(DataPreprocessingChangedEventType type)
 {
     SaveSnapshot(type, -1, -1);
     eventStack.Push(type);
 }
コード例 #6
0
 public void InTransaction(Action action, DataPreprocessingChangedEventType type = DataPreprocessingChangedEventType.Any)
 {
     BeginTransaction(type);
     action();
     EndTransaction();
 }
コード例 #7
0
 public DataPreprocessingChangedEventArgs(DataPreprocessingChangedEventType type, int column, int row) {
   Type = type;
   Column = column;
   Row = row;
 }
コード例 #8
0
 public DataPreprocessingChangedEventArgs(DataPreprocessingChangedEventType type, int column, int row)
 {
     Type   = type;
     Column = column;
     Row    = row;
 }