Changeset 1984 for trunk/sources/HeuristicLab.Visualization
- Timestamp:
- 05/31/09 21:47:55 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Visualization/3.2/DataRow.cs
r1983 r1984 113 113 114 114 public override void RemoveValue(int index) { 115 double remVal = dataRow[index];116 //check if index is valid117 115 if (index >= 0 && index < dataRow.Count) { 116 UpdateMinMaxValueForRemovedValue(index); // bad runtime but works 117 double removedValue = dataRow[index]; 118 118 dataRow.RemoveAt(index); 119 OnValueChanged(rem Val, index, Action.Deleted);119 OnValueChanged(removedValue, index, Action.Deleted); 120 120 } else { 121 121 throw new IndexOutOfRangeException(); … … 124 124 125 125 public override void RemoveValues(int index, int count) { 126 double[] remValues = new double[count]; //removed values127 int j = 0;128 129 //check if count is valid130 126 if (count > 0) { 131 //check if index is valid132 127 if ((index >= 0) && (index + count <= dataRow.Count)) { 133 for (int i = index; i < (index + count); i++) { 134 remValues.SetValue(i, j); 135 dataRow.RemoveAt(i); 136 j++; 128 double[] removedValues = new double[count]; 129 for (int i = 0; i < count; i++) { 130 removedValues[i] = dataRow[index + i]; 131 UpdateMinMaxValueForRemovedValue(index); // bad runtime but works 132 dataRow.RemoveAt(index); 137 133 } 138 OnValuesChanged(rem Values, index, Action.Deleted);134 OnValuesChanged(removedValues, index, Action.Deleted); 139 135 } else { 140 136 throw new IndexOutOfRangeException(); … … 165 161 } 166 162 163 private void UpdateMinMaxValueForRemovedValue(int removedValueIndex) { 164 if (minValue == dataRow[removedValueIndex] || maxValue == dataRow[removedValueIndex]) { 165 minValue = double.MaxValue; 166 maxValue = double.MinValue; 167 168 for (int i = 0; i < dataRow.Count; i++) { 169 if (i != removedValueIndex) { 170 UpdateMinMaxValue(dataRow[i]); 171 } 172 } 173 } 174 } 175 167 176 private void UpdateMinMaxValue(double newValue, int oldValueIndex) { 168 177 if (minValue != dataRow[oldValueIndex] && maxValue != dataRow[oldValueIndex])
Note: See TracChangeset
for help on using the changeset viewer.