Increments the value at the given index by the given value. @param index the index of the value to alter @param val the value to be added to the index
(int index, double val)
| 201 | * @param val the value to be added to the index |
| 202 | */ |
| 203 | @Override |
| 204 | public void increment(int index, double val) |
| 205 | { |
| 206 | if (index > length - 1 || index < 0) |
| 207 | throw new IndexOutOfBoundsException("Can not access an index larger then the vector or a negative index"); |
| 208 | if(val == 0)//donst want to insert a zero, and a zero changes nothing |
| 209 | return; |
| 210 | int location = Arrays.binarySearch(indexes, 0, used, index); |
| 211 | if(location < 0) |
| 212 | insertValue(location, index, val); |
| 213 | else |
| 214 | { |
| 215 | values[location]+=val; |
| 216 | if(values[location] == 0.0) |
| 217 | removeNonZero(location); |
| 218 | } |
| 219 | } |
| 220 | |
| 221 | @Override |
| 222 | public double get(int index) |
no test coverage detected