Changeset 10616


Ignore:
Timestamp:
03/19/14 12:47:42 (6 years ago)
Author:
rstoll
Message:

Changed row and columnIndex in order to be consistent with PreprocessingData

Location:
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3
Files:
3 edited

Legend:

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

    r10614 r10616  
    120120
    121121    public string GetValue(int rowIndex, int columnIndex) {
    122       return dataGridLogic.GetValue(rowIndex, columnIndex);
     122      return dataGridLogic.GetValue(columnIndex, rowIndex);
    123123    }
    124124
    125     public bool SetValue(string value, int rowIndex, int columnIndex) {
    126       return dataGridLogic.SetValue(value, rowIndex, columnIndex);
     125    public bool SetValue(string value,int columnIndex,int rowIndex, ) {
     126      return dataGridLogic.SetValue(value, columnIndex, rowIndex);
    127127    }
    128128
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/DataGridLogic.cs

    r10586 r10616  
    9191    }
    9292
    93     public string GetValue(int rowIndex, int columnIndex) {
     93    public string GetValue(int columnIndex, int rowIndex) {
    9494      return preprocessingData.GetCellAsString(columnIndex, rowIndex);
    9595    }
    9696
    97     public bool SetValue(string value, int rowIndex, int columnIndex) {
     97    public bool SetValue(string value, int columnIndex, int rowIndex) {
    9898      bool valid = false;
    9999      if (preprocessingData.IsType<double>(columnIndex)) {
    100100        double val;
    101101        valid = double.TryParse(value, out val);
    102         if (valid) {
    103           preprocessingData.SetCell<double>(columnIndex, rowIndex, val);
    104         }
     102        SetValueIfValid(columnIndex, rowIndex, valid, value);
    105103      } else if (preprocessingData.IsType<string>(columnIndex)) {
    106104        valid = value != null;
    107         if (valid) {
    108           preprocessingData.SetCell<string>(columnIndex, rowIndex, value);
    109         }
     105        SetValueIfValid(columnIndex, rowIndex, valid, value);
    110106      } else if (preprocessingData.IsType<DateTime>(columnIndex)) {
    111107        DateTime date;
    112108        valid = DateTime.TryParse(value, out date);
    113         if (valid) {
    114           preprocessingData.SetCell<DateTime>(columnIndex, rowIndex, date);
    115         }
     109        SetValueIfValid(columnIndex, rowIndex, valid, value);
    116110      } else {
    117111        throw new ArgumentException("column " + columnIndex + " contains a non supported type.");
    118112      }
     113      return valid;
     114    }
    119115
    120       return valid;
     116    private void SetValueIfValid<T>(int columnIndex, int rowIndex, bool valid, T value) {
     117      if (valid) {
     118        preprocessingData.SetCell<T>(columnIndex, rowIndex, value);
     119      }
    121120    }
    122121
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Interfaces/IDataGridLogic.cs

    r10571 r10616  
    2929    int Rows { get; }
    3030
    31     string GetValue(int rowIndex, int columnIndex);
    32     bool SetValue(string value, int rowIndex, int columnIndex);
     31    string GetValue(int columnIndex, int rowIndex);
     32    bool SetValue(string value, int columnIndex, int rowIndex);
    3333    bool Validate(string value, out string errorMessage, int columnIndex);
    3434
Note: See TracChangeset for help on using the changeset viewer.