Free cookie consent management tool by TermsFeed Policy Generator

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

Changed row and columnIndex in order to be consistent with PreprocessingData

Location:
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations
Files:
2 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
Note: See TracChangeset for help on using the changeset viewer.