Changeset 3468 for trunk/sources/HeuristicLab.DataAnalysis/3.2
- Timestamp:
- 04/21/10 18:34:03 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.DataAnalysis/3.2/Dataset.cs
r2375 r3468 156 156 } 157 157 158 public void SetValue(int i, int j, double v) {159 if ( v != samples[columns * i + j]) {160 samples[columns * i + j] = v;158 public void SetValue(int row, int column, double newValue) { 159 if (newValue != samples[columns * row + column]) { 160 samples[columns * row + column] = newValue; 161 161 cachedValuesInvalidated = true; 162 162 if (fireChangeEvents) FireChanged(); … … 440 440 } 441 441 442 string[] tokens = node.InnerText.Split(';'); 443 if (tokens.Length != rows * columns) throw new FormatException(); 442 var startPoint = 0; 444 443 samples = new double[rows * columns]; 445 444 for (int row = 0; row < rows; row++) { 446 445 for (int column = 0; column < columns; column++) { 447 if (double.TryParse(tokens[row * columns + column], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out samples[row * columns + column]) == false) { 448 throw new FormatException("Can't parse " + tokens[row * columns + column] + " as double value."); 446 if (startPoint >= node.InnerText.Length) throw new FormatException("Not enough elements parsed."); 447 int endPoint = node.InnerText.IndexOf(';', startPoint); 448 if (endPoint < 0) 449 endPoint = node.InnerText.Length; 450 var curToken = node.InnerText.Substring(startPoint, endPoint - startPoint); 451 startPoint = endPoint + 1; 452 if (double.TryParse(curToken, NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out samples[row * columns + column]) == false) { 453 throw new FormatException("Can't parse " + curToken + " as double value."); 449 454 } 450 455 } 451 456 } 457 if (startPoint < node.InnerText.Length) throw new FormatException("More elements available"); 452 458 } 453 459
Note: See TracChangeset
for help on using the changeset viewer.