Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/06/15 16:41:59 (9 years ago)
Author:
pfleck
Message:

#2486
Allows pasting of multiple values that extend the current data limits (rows and/or columns).
In case, additional rows and columns are added with the default value of the column's type.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.DataPreprocessing/3.4/Implementations/TransactionalPreprocessingData.cs

    r12012 r12983  
    9898    public override void SetCell<T>(int columnIndex, int rowIndex, T value) {
    9999      SaveSnapshot(DataPreprocessingChangedEventType.ChangeItem, columnIndex, rowIndex);
     100
     101      for (int i = Rows; i <= rowIndex; i++)
     102        InsertRow(i);
     103      for (int i = Columns; i <= columnIndex; i++)
     104        InsertColumn<T>(i.ToString(), i);
     105
    100106      variableValues[columnIndex][rowIndex] = value;
    101107      if (!IsInTransaction)
     
    116122
    117123    public override bool VariableHasType<T>(int columnIndex) {
    118       return variableValues[columnIndex] is List<T>;
     124      return columnIndex >= variableValues.Count || variableValues[columnIndex] is List<T>;
    119125    }
    120126
     
    242248    public override void InsertColumn<T>(string variableName, int columnIndex) {
    243249      SaveSnapshot(DataPreprocessingChangedEventType.DeleteColumn, columnIndex, -1);
    244       variableValues.Insert(columnIndex, new List<T>(Rows));
     250      variableValues.Insert(columnIndex, new List<T>(Enumerable.Repeat(default(T), Rows)));
    245251      variableNames.Insert(columnIndex, variableName);
    246252      if (!IsInTransaction)
Note: See TracChangeset for help on using the changeset viewer.