Ignore:
Timestamp:
07/09/14 10:37:01 (8 years ago)
Author:
gkronber
Message:

#2206: made several changes / improvements to the data-preprocessing code while reviewing the code

File:
1 edited

Legend:

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

    r11114 r11156  
    115115    }
    116116
    117     public override bool IsType<T>(int columnIndex) {
     117    public override bool VariableHasType<T>(int columnIndex) {
    118118      return variableValues[columnIndex] is List<T>;
    119119    }
     
    138138    public override void SetValues<T>(int columnIndex, IList<T> values) {
    139139      SaveSnapshot(DataPreprocessingChangedEventType.ChangeColumn, columnIndex, -1);
    140       if (IsType<T>(columnIndex)) {
     140      if (VariableHasType<T>(columnIndex)) {
    141141        variableValues[columnIndex] = (IList)values;
    142142      } else {
     
    149149    public override bool SetValue(string value, int columnIndex, int rowIndex) {
    150150      bool valid = false;
    151       if (IsType<double>(columnIndex)) {
     151      if (VariableHasType<double>(columnIndex)) {
    152152        double val;
    153153        valid = double.TryParse(value, out val);
    154154        SetValueIfValid(columnIndex, rowIndex, valid, val);
    155       } else if (IsType<string>(columnIndex)) {
     155      } else if (VariableHasType<string>(columnIndex)) {
    156156        valid = value != null;
    157157        SetValueIfValid(columnIndex, rowIndex, valid, value);
    158       } else if (IsType<DateTime>(columnIndex)) {
     158      } else if (VariableHasType<DateTime>(columnIndex)) {
    159159        DateTime date;
    160160        valid = DateTime.TryParse(value, out date);
     
    177177      bool valid = false;
    178178      errorMessage = string.Empty;
    179       if (IsType<double>(columnIndex)) {
     179      if (VariableHasType<double>(columnIndex)) {
    180180        double val;
    181181        valid = double.TryParse(value, out val);
     
    183183          errorMessage = "Invalid Value (Valid Value Format: \"" + FormatPatterns.GetDoubleFormatPattern() + "\")";
    184184        }
    185       } else if (IsType<string>(columnIndex)) {
     185      } else if (VariableHasType<string>(columnIndex)) {
    186186        valid = value != null;
    187187        if (!valid) {
    188188          errorMessage = "Invalid Value (string must not be null)";
    189189        }
    190       } else if (IsType<DateTime>(columnIndex)) {
     190      } else if (VariableHasType<DateTime>(columnIndex)) {
    191191        DateTime date;
    192192        valid = DateTime.TryParse(value, out date);
     
    207207
    208208    public override bool AreAllStringColumns(IEnumerable<int> columnIndices) {
    209       return columnIndices.All(x => IsType<string>(x));
     209      return columnIndices.All(x => VariableHasType<string>(x));
    210210    }
    211211
Note: See TracChangeset for help on using the changeset viewer.