Return a List containing the annotations in the given annotation set, in document order (i.e. increasing order of start offset). @param as the annotation set @return a list containing the annotations from as in document order.
(AnnotationSet as)
| 644 | * order. |
| 645 | */ |
| 646 | public static List<Annotation> inDocumentOrder(AnnotationSet as) { |
| 647 | List<Annotation> ret = new ArrayList<Annotation>(); |
| 648 | if(as != null) { |
| 649 | ret.addAll(as); |
| 650 | Collections.sort(ret, OFFSET_COMPARATOR); |
| 651 | } |
| 652 | return ret; |
| 653 | } |
| 654 | |
| 655 | /** |
| 656 | * A single instance of {@link OffsetComparator} that can be used by any code |