Free cookie consent management tool by TermsFeed Policy Generator

Changeset 10547


Ignore:
Timestamp:
03/05/14 16:06:44 (11 years ago)
Author:
tsteinre
Message:
  • started work on undo-feature of PreprocessingData
Location:
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/PreprocessingData.cs

    r10544 r10547  
    8787    #region IPreprocessingData Members
    8888
    89     [Obsolete("use the index based variant, is faster")]
    90     public T GetCell<T>(string variableName, int rowIndex) {
    91       return GetCell<T>(GetColumnIndex(variableName), rowIndex);
    92     }
    93 
    9489    public T GetCell<T>(int columnIndex, int rowIndex) {
    9590      return (T)variableValues[columnIndex][rowIndex];
    9691    }
    9792
    98     [Obsolete("use the index based variant, is faster")]
    99     public void SetCell<T>(string variableName, int rowIndex, T value) {
    100       SetCell<T>(GetColumnIndex(variableName), rowIndex, value);
    101     }
    102 
    103     public void SetCell<T>(int columnIndex, int rowIndex, T value) {
     93
     94    public void SetCell<T>(int columnIndex, int rowIndex, T value) {    // Undo-sensitive
    10495      variableValues[columnIndex][rowIndex] = value;
    10596      OnChanged(DataPreprocessingChangedEventType.ChangeItem, columnIndex, rowIndex);
    10697    }
    10798
    108     [Obsolete("use the index based variant, is faster")]
    109     public string GetCellAsString(string variableName, int rowIndex) {
    110       return GetCellAsString(GetColumnIndex(variableName), rowIndex);
    111     }
    11299
    113100    public string GetCellAsString(int columnIndex, int rowIndex) {
    114101      return variableValues[columnIndex][rowIndex].ToString();
    115102    }
     103
    116104
    117105    [Obsolete("use the index based variant, is faster")]
     
    124112    }
    125113
    126     [Obsolete("use the index based variant, is faster")]
    127     public void SetValues<T>(string variableName, IList<T> values) {
    128       SetValues<T>(GetColumnIndex(variableName), values);
    129     }
    130 
    131     public void SetValues<T>(int columnIndex, IList<T> values) {
     114    public void SetValues<T>(int columnIndex, IList<T> values) {    // Undo-sensitive
    132115      if (IsType<T>(columnIndex)) {
    133116        variableValues[columnIndex] = (IList)values;
     
    138121    }
    139122
    140     public void InsertRow(int rowIndex) {
     123    public void InsertRow(int rowIndex) {    // Undo-sensitive
    141124      foreach (IList column in variableValues.Values) {
    142125        Type type = column.GetType().GetGenericArguments()[0];
     
    146129    }
    147130
    148     public void DeleteRow(int rowIndex) {
     131    public void DeleteRow(int rowIndex) {    // Undo-sensitive
    149132      foreach (IList column in variableValues.Values) {
    150133        column.RemoveAt(rowIndex);
     
    153136    }
    154137
    155     public void InsertColumn<T>(string variableName, int columnIndex) {
     138    public void InsertColumn<T>(string variableName, int columnIndex) {    // Undo-sensitive
    156139      variableValues.Add(columnIndex, new List<T>(Rows));
    157       variableNames.Insert(columnIndex, variableName); 
    158       OnChanged(DataPreprocessingChangedEventType.AddColumn, columnIndex , -1);
    159     }
    160 
    161     public void DeleteColumn(int columnIndex) {
     140      variableNames.Insert(columnIndex, variableName);
     141      OnChanged(DataPreprocessingChangedEventType.AddColumn, columnIndex, -1);
     142    }
     143
     144    public void DeleteColumn(int columnIndex) {    // Undo-sensitive
    162145      variableValues.Remove(columnIndex);
    163146      variableNames.RemoveAt(columnIndex);
     
    165148    }
    166149
    167     [Obsolete("use the index based variant, is faster")]
    168     public void DeleteColumn(string variableName) {
    169       DeleteColumn(GetColumnIndex(variableName));
    170     }
    171150
    172151    public IntRange TrainingPartition {
     
    178157    }
    179158
     159    public string GetVariableName(int columnIndex) {
     160      return variableNames[columnIndex];
     161    }
     162
    180163    public IEnumerable<string> VariableNames {
    181164      get { return variableNames; }
    182165    }
    183166
    184     [Obsolete("use the index based variant, is faster")]
    185     public string GetVariableName(int columnIndex) {
    186       return variableNames[columnIndex];
    187     }
    188167    public int GetColumnIndex(string variableName) {
    189168      return variableNames.IndexOf(variableName);
    190169    }
    191170
    192     [Obsolete("use the index based variant, is faster")]
    193     public bool IsType<T>(string variableName) {
    194       return IsType<T>(GetColumnIndex(variableName));
    195 
    196     }
    197171    public bool IsType<T>(int columnIndex) {
    198172      return variableValues[columnIndex] is List<T>;
     
    224198    }
    225199
     200    public bool IsUndoAvailable {
     201      get { throw new NotImplementedException(); }
     202    }
     203
     204    public void Undo() {
     205      throw new NotImplementedException();
     206    }
     207
    226208    #endregion
    227209  }
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Interfaces/IPreprocessingData.cs

    r10544 r10547  
    2929
    3030  public interface IPreprocessingData : INamedItem {
    31     [Obsolete("use the index based variant, is faster")]
    32     T GetCell<T>(string variableName, int rowIndex);
    3331    T GetCell<T>(int columnIndex, int rowIndex);
    3432
    35     [Obsolete("use the index based variant, is faster")]
    36     void SetCell<T>(string variableName, int rowIndex, T value);
    3733    void SetCell<T>(int columnIndex, int rowIndex, T value);
    3834
    39     [Obsolete("use the index based variant, is faster")]
    40     string GetCellAsString(string variableName, int rowIndex);
    4135    string GetCellAsString(int columnIndex, int rowIndex);
    4236
     
    4539    IList<T> GetValues<T>(int columnIndex);
    4640
    47     [Obsolete("use the index based variant, is faster")]
    48     void SetValues<T>(string variableName, IList<T> values);
    4941    void SetValues<T>(int columnIndex, IList<T> values);
    5042
     
    5446    void InsertColumn<T>(string variableName, int columnIndex);
    5547
    56     [Obsolete("use the index based variant, is faster")]
    57     void DeleteColumn(string variableName);
    5848    void DeleteColumn(int columnIndex);
    5949
     
    6555    int GetColumnIndex(string variableName);
    6656
    67     [Obsolete("use the index based variant, is faster")]
    68     bool IsType<T>(string variableName);
    6957    bool IsType<T>(int columnIndex);
    70 
    7158
    7259    int Columns { get; }
     
    7663
    7764    event DataPreprocessingChangedEventHandler Changed;
     65
     66    bool IsUndoAvailable { get; }
     67    void Undo();
    7868  }
    7969}
Note: See TracChangeset for help on using the changeset viewer.