1 |
1 |
package org.txm.annotation.kr.rcp.concordance;
|
2 |
2 |
|
3 |
3 |
import java.util.ArrayList;
|
|
4 |
import java.util.Collections;
|
4 |
5 |
import java.util.HashMap;
|
5 |
6 |
import java.util.List;
|
|
7 |
import java.util.TreeMap;
|
6 |
8 |
|
7 |
9 |
import org.txm.annotation.kr.core.Annotation;
|
8 |
10 |
import org.txm.annotation.kr.core.AnnotationManager;
|
... | ... | |
48 |
50 |
|
49 |
51 |
this.concordanceLines = concordanceLines;
|
50 |
52 |
|
51 |
|
ArrayList<Match> matches = new ArrayList<Match>();
|
|
53 |
HashMap<Match, Line> matches = new HashMap<Match, Line>();
|
52 |
54 |
for (Line line : concordanceLines) {
|
53 |
|
matches.add(line.getMatch());
|
|
55 |
matches.put(line.getMatch(), line);
|
54 |
56 |
}
|
|
57 |
ArrayList<Match> sorted_matches = new ArrayList<Match>(matches.keySet());
|
|
58 |
Collections.sort(sorted_matches);
|
55 |
59 |
|
56 |
|
List<Annotation> ann = getAnnotationForMatches(matches, overlapAnnotation);
|
57 |
|
|
|
60 |
List<Annotation> ann = getAnnotationForMatches(sorted_matches, overlapAnnotation);
|
58 |
61 |
lines = new HashMap<Line, AnnotationLine>();
|
59 |
62 |
|
60 |
63 |
for (int i = 0 ; i < ann.size() ; i++) {
|
61 |
64 |
Annotation a = ann.get(i);
|
62 |
65 |
AnnotationLine aline = new AnnotationLine(a, getAnnotationTypedValue(a));
|
63 |
|
lines.put(concordanceLines.get(i), aline);
|
|
66 |
lines.put(matches.get(sorted_matches.get(i)), aline);
|
64 |
67 |
}
|
65 |
68 |
|
66 |
69 |
return lines; // TODO find a way to add with lazy method
|