Changeset 11156 for trunk/sources/HeuristicLab.DataPreprocessing/3.4/Implementations/TransactionalPreprocessingData.cs
- Timestamp:
- 07/09/14 10:37:01 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.DataPreprocessing/3.4/Implementations/TransactionalPreprocessingData.cs
r11114 r11156 115 115 } 116 116 117 public override bool IsType<T>(int columnIndex) {117 public override bool VariableHasType<T>(int columnIndex) { 118 118 return variableValues[columnIndex] is List<T>; 119 119 } … … 138 138 public override void SetValues<T>(int columnIndex, IList<T> values) { 139 139 SaveSnapshot(DataPreprocessingChangedEventType.ChangeColumn, columnIndex, -1); 140 if ( IsType<T>(columnIndex)) {140 if (VariableHasType<T>(columnIndex)) { 141 141 variableValues[columnIndex] = (IList)values; 142 142 } else { … … 149 149 public override bool SetValue(string value, int columnIndex, int rowIndex) { 150 150 bool valid = false; 151 if ( IsType<double>(columnIndex)) {151 if (VariableHasType<double>(columnIndex)) { 152 152 double val; 153 153 valid = double.TryParse(value, out val); 154 154 SetValueIfValid(columnIndex, rowIndex, valid, val); 155 } else if ( IsType<string>(columnIndex)) {155 } else if (VariableHasType<string>(columnIndex)) { 156 156 valid = value != null; 157 157 SetValueIfValid(columnIndex, rowIndex, valid, value); 158 } else if ( IsType<DateTime>(columnIndex)) {158 } else if (VariableHasType<DateTime>(columnIndex)) { 159 159 DateTime date; 160 160 valid = DateTime.TryParse(value, out date); … … 177 177 bool valid = false; 178 178 errorMessage = string.Empty; 179 if ( IsType<double>(columnIndex)) {179 if (VariableHasType<double>(columnIndex)) { 180 180 double val; 181 181 valid = double.TryParse(value, out val); … … 183 183 errorMessage = "Invalid Value (Valid Value Format: \"" + FormatPatterns.GetDoubleFormatPattern() + "\")"; 184 184 } 185 } else if ( IsType<string>(columnIndex)) {185 } else if (VariableHasType<string>(columnIndex)) { 186 186 valid = value != null; 187 187 if (!valid) { 188 188 errorMessage = "Invalid Value (string must not be null)"; 189 189 } 190 } else if ( IsType<DateTime>(columnIndex)) {190 } else if (VariableHasType<DateTime>(columnIndex)) { 191 191 DateTime date; 192 192 valid = DateTime.TryParse(value, out date); … … 207 207 208 208 public override bool AreAllStringColumns(IEnumerable<int> columnIndices) { 209 return columnIndices.All(x => IsType<string>(x));209 return columnIndices.All(x => VariableHasType<string>(x)); 210 210 } 211 211
Note: See TracChangeset
for help on using the changeset viewer.