Lines 263-286
Link Here
|
263 |
} |
263 |
} |
264 |
|
264 |
|
265 |
// insert newly created LineAnnotations into sorted array |
265 |
// insert newly created LineAnnotations into sorted array |
266 |
boolean inserted = false; |
266 |
int pos = Collections.binarySearch(lineAnnotationsArray, lineAnnos, new LineAnnotationsComparator()); |
267 |
for (int i=0; i < lineAnnotationsArray.size(); i++) { |
|
|
268 |
if (((LineAnnotations)lineAnnotationsArray.get(i)).getLine() > lineAnnos.getLine()) { |
269 |
lastGetLineAnnotationsIdx = -1; |
270 |
lastGetLineAnnotationsLine = -1; |
271 |
lastGetLineAnnotationsResult = null; |
272 |
lineAnnotationsArray.add(i, lineAnnos); |
273 |
inserted = true; |
274 |
break; |
275 |
} |
276 |
} |
277 |
if (!inserted) { |
278 |
lastGetLineAnnotationsIdx = -1; |
279 |
lastGetLineAnnotationsLine = -1; |
280 |
lastGetLineAnnotationsResult = null; |
281 |
lineAnnotationsArray.add(lineAnnos); |
282 |
} |
283 |
|
267 |
|
|
|
268 |
lineAnnotationsArray.add(-pos - 1, lineAnnos); |
269 |
lastGetLineAnnotationsIdx = -1; |
270 |
lastGetLineAnnotationsLine = -1; |
271 |
lastGetLineAnnotationsResult = null; |
284 |
} |
272 |
} |
285 |
else { |
273 |
else { |
286 |
lineAnnos.addAnnotation(anno); |
274 |
lineAnnos.addAnnotation(anno); |
Lines 1441-1445
Link Here
|
1441 |
return menuOneText.compareTo(menuTwoText); |
1429 |
return menuOneText.compareTo(menuTwoText); |
1442 |
} |
1430 |
} |
1443 |
} // End of MenuComparator class |
1431 |
} // End of MenuComparator class |
|
|
1432 |
|
1433 |
private static class LineAnnotationsComparator implements Comparator<LineAnnotations> { |
1434 |
@Override |
1435 |
public int compare(LineAnnotations o1, LineAnnotations o2) { |
1436 |
return o1.getLine() - o2.getLine(); |
1437 |
} |
1438 |
} |
1444 |
|
1439 |
|
1445 |
} |
1440 |
} |