Changeset 1983 for trunk/sources/HeuristicLab.Visualization
- Timestamp:
- 05/31/09 21:26:27 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Visualization/3.2/DataRow.cs
r1982 r1983 2 2 using System.Drawing; 3 3 using System.Collections.Generic; 4 using HeuristicLab.Visualization.LabelProvider;5 4 6 5 namespace HeuristicLab.Visualization { … … 76 75 77 76 public override void AddValues(double[] values, int index) { 78 int j = index; 79 80 //check if index to start changes is valid 81 if (index >=0 && (index + values.Length) < dataRow.Count) { 82 foreach (double d in values) { 83 dataRow.Insert(j, d); 84 j++; 77 if (index >= 0 && index < dataRow.Count) { 78 for (int i = 0; i < values.Length; i++) { 79 double value = values[i]; 80 UpdateMinMaxValue(value); 81 dataRow.Insert(index + i, value); 85 82 } 86 83 OnValuesChanged(values, index, Action.Added); … … 93 90 //check if index is valid 94 91 if (index >= 0 && index < dataRow.Count) { 92 UpdateMinMaxValue(value, index); // bad runtime but works 95 93 dataRow[index] = value; 96 94 OnValueChanged(value, index, Action.Modified); … … 101 99 102 100 public override void ModifyValues(double[] values, int index) { 103 int startInd = index;104 int modInd = index;105 106 101 //check if index to start modification is valid 107 if (startInd >=0 && startInd + values.Length < dataRow.Count) { 108 foreach (double d in values) { 109 dataRow[modInd] = d; 110 modInd++; 102 if (index >= 0 && index + values.Length < dataRow.Count) { 103 for (int i = 0; i < values.Length; i++) { 104 double value = values[i]; 105 UpdateMinMaxValue(value, index + i); // bad runtime but works 106 dataRow[index+i] = value; 111 107 } 112 OnValuesChanged(values, startInd, Action.Modified);108 OnValuesChanged(values, index, Action.Modified); 113 109 } else { 114 110 throw new IndexOutOfRangeException(); … … 169 165 } 170 166 167 private void UpdateMinMaxValue(double newValue, int oldValueIndex) { 168 if (minValue != dataRow[oldValueIndex] && maxValue != dataRow[oldValueIndex]) 169 UpdateMinMaxValue(newValue); 170 else { 171 minValue = double.MaxValue; 172 maxValue = double.MinValue; 173 174 for (int i = 0; i < dataRow.Count; i++) { 175 double value = oldValueIndex != i ? dataRow[i] : newValue; 176 UpdateMinMaxValue(value); 177 } 178 } 179 } 180 171 181 private void UpdateMinMaxValue(double value) { 172 182 maxValue = Math.Max(value, maxValue);
Note: See TracChangeset
for help on using the changeset viewer.