| Eliza Margaretha | fb25cef | 2014-06-06 14:19:07 +0000 | [diff] [blame] | 1 | package de.ids_mannheim.korap.query.spans; |
| 2 | |
| 3 | import java.io.IOException; |
| 4 | import java.nio.ByteBuffer; |
| 5 | import java.util.ArrayList; |
| 6 | import java.util.Collections; |
| 7 | import java.util.List; |
| 8 | import java.util.Map; |
| 9 | |
| Akron | 700c1eb | 2015-09-25 16:57:30 +0200 | [diff] [blame] | 10 | import org.apache.lucene.index.LeafReaderContext; |
| Eliza Margaretha | fb25cef | 2014-06-06 14:19:07 +0000 | [diff] [blame] | 11 | import org.apache.lucene.index.Term; |
| 12 | import org.apache.lucene.index.TermContext; |
| 13 | import org.apache.lucene.search.spans.Spans; |
| Eliza Margaretha | 8551e5b | 2014-12-15 16:46:18 +0000 | [diff] [blame] | 14 | import org.apache.lucene.search.spans.TermSpans; |
| Eliza Margaretha | fb25cef | 2014-06-06 14:19:07 +0000 | [diff] [blame] | 15 | import org.apache.lucene.util.Bits; |
| 16 | import org.slf4j.Logger; |
| 17 | import org.slf4j.LoggerFactory; |
| 18 | |
| Eliza Margaretha | fb25cef | 2014-06-06 14:19:07 +0000 | [diff] [blame] | 19 | import de.ids_mannheim.korap.query.SpanAttributeQuery; |
| 20 | |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 21 | /** |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 22 | * Span enumeration of attributes which are term spans with special |
| Eliza Margaretha | 9591796 | 2016-11-16 16:07:08 +0100 | [diff] [blame^] | 23 | * payload assignments referring to another span (e.g. |
| 24 | * element/relation span) to which an attribute span belongs. The |
| 25 | * class is basically a wrapper of Lucene {@link TermSpans} with |
| 26 | * additional functionality regarding element/relation |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 27 | * reference. Element/relation id is annotated ascendingly starting |
| Eliza Margaretha | 9591796 | 2016-11-16 16:07:08 +0100 | [diff] [blame^] | 28 | * from the left side. |
| 29 | * <br/><br/> |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 30 | * The enumeration is ordered firstly by the start position of the |
| Eliza Margaretha | 9591796 | 2016-11-16 16:07:08 +0100 | [diff] [blame^] | 31 | * attribute and secondly by the element/relation id descendingly. |
| 32 | * This order helps to match element and attributes faster. |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 33 | * |
| Eliza Margaretha | 9591796 | 2016-11-16 16:07:08 +0100 | [diff] [blame^] | 34 | * AttributeSpans have the same start and end positions of the |
| 35 | * element/relations they belongs to, thus querying them alone |
| 36 | * is sufficient to get "any element having a specific |
| 37 | * attribute". |
| Eliza Margaretha | 493bfa9 | 2015-01-13 16:16:38 +0000 | [diff] [blame] | 38 | * |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 39 | * @author margaretha |
| Eliza Margaretha | 6f98920 | 2016-10-14 21:48:29 +0200 | [diff] [blame] | 40 | */ |
| margaretha | 50c7633 | 2015-03-19 10:10:39 +0100 | [diff] [blame] | 41 | public class AttributeSpans extends SimpleSpans { |
| Nils Diewald | 1455e1e | 2014-08-01 16:12:43 +0000 | [diff] [blame] | 42 | |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 43 | private List<CandidateAttributeSpan> candidateList; |
| 44 | private int currentDoc, currentPosition; |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 45 | private boolean isFinish; |
| Eliza Margaretha | fb25cef | 2014-06-06 14:19:07 +0000 | [diff] [blame] | 46 | |
| Akron | 4299355 | 2016-02-04 13:24:24 +0100 | [diff] [blame] | 47 | public static enum PayloadTypeIdentifier { |
| 48 | TERM_ATTRIBUTE(16), ELEMENT_ATTRIBUTE(17), RELATION_ATTRIBUTE(18); |
| margaretha | 14f918d | 2015-12-11 11:48:07 +0100 | [diff] [blame] | 49 | |
| Akron | 4299355 | 2016-02-04 13:24:24 +0100 | [diff] [blame] | 50 | private int value; |
| margaretha | 14f918d | 2015-12-11 11:48:07 +0100 | [diff] [blame] | 51 | |
| Akron | 4299355 | 2016-02-04 13:24:24 +0100 | [diff] [blame] | 52 | |
| 53 | private PayloadTypeIdentifier (int value) { |
| 54 | this.value = value; |
| 55 | } |
| Eliza Margaretha | 9591796 | 2016-11-16 16:07:08 +0100 | [diff] [blame^] | 56 | |
| 57 | |
| 58 | public int getValue () { |
| 59 | return value; |
| 60 | } |
| Akron | 4299355 | 2016-02-04 13:24:24 +0100 | [diff] [blame] | 61 | } |
| margaretha | 14f918d | 2015-12-11 11:48:07 +0100 | [diff] [blame] | 62 | |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 63 | protected Logger logger = LoggerFactory.getLogger(AttributeSpans.class); |
| Eliza Margaretha | fb25cef | 2014-06-06 14:19:07 +0000 | [diff] [blame] | 64 | |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 65 | |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 66 | /** |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 67 | * Constructs Attributespans based on the specified |
| 68 | * SpanAttributeQuery. |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 69 | * |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 70 | * @param spanAttributeQuery |
| 71 | * a spanAttributeQuery |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 72 | * @param context |
| 73 | * @param acceptDocs |
| 74 | * @param termContexts |
| 75 | * @throws IOException |
| 76 | */ |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 77 | public AttributeSpans (SpanAttributeQuery spanAttributeQuery, |
| Akron | 700c1eb | 2015-09-25 16:57:30 +0200 | [diff] [blame] | 78 | LeafReaderContext context, Bits acceptDocs, |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 79 | Map<Term, TermContext> termContexts) |
| 80 | throws IOException { |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 81 | super(spanAttributeQuery, context, acceptDocs, termContexts); |
| margaretha | 50c7633 | 2015-03-19 10:10:39 +0100 | [diff] [blame] | 82 | this.hasSpanId = true; |
| 83 | |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 84 | candidateList = new ArrayList<>(); |
| 85 | hasMoreSpans = firstSpans.next(); |
| 86 | if (hasMoreSpans) { |
| 87 | currentDoc = firstSpans.doc(); |
| 88 | currentPosition = firstSpans.start(); |
| 89 | } |
| 90 | } |
| Eliza Margaretha | c7fb731 | 2014-07-25 14:11:36 +0000 | [diff] [blame] | 91 | |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 92 | |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 93 | @Override |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 94 | public boolean next () throws IOException { |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 95 | isStartEnumeration = false; |
| 96 | matchPayload.clear(); |
| 97 | return advance(); |
| 98 | } |
| Eliza Margaretha | fb25cef | 2014-06-06 14:19:07 +0000 | [diff] [blame] | 99 | |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 100 | |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 101 | /** |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 102 | * Moves to the next match by checking the candidate match list or |
| Eliza Margaretha | 9591796 | 2016-11-16 16:07:08 +0100 | [diff] [blame^] | 103 | * setting the list first when it is empty. |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 104 | * |
| 105 | * @return true if a match is found |
| 106 | * @throws IOException |
| 107 | */ |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 108 | private boolean advance () throws IOException { |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 109 | while (hasMoreSpans || !candidateList.isEmpty()) { |
| 110 | if (!candidateList.isEmpty()) { |
| 111 | // set the current match from the first CandidateAttributeSpan |
| 112 | // in the candidate list |
| 113 | CandidateAttributeSpan cs = candidateList.get(0); |
| 114 | this.matchDocNumber = cs.getDoc(); |
| 115 | this.matchStartPosition = cs.getStart(); |
| 116 | this.matchEndPosition = cs.getEnd(); |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 117 | this.setSpanId(cs.getSpanId()); // referentId |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 118 | candidateList.remove(0); |
| 119 | return true; |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 120 | } |
| 121 | else { |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 122 | setCandidateList(); |
| 123 | currentDoc = firstSpans.doc(); |
| 124 | currentPosition = firstSpans.start(); |
| 125 | } |
| 126 | } |
| 127 | return false; |
| 128 | } |
| Eliza Margaretha | fb25cef | 2014-06-06 14:19:07 +0000 | [diff] [blame] | 129 | |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 130 | |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 131 | /** |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 132 | * Collects all the attributes in the same start position and sort |
| Eliza Margaretha | 9591796 | 2016-11-16 16:07:08 +0100 | [diff] [blame^] | 133 | * them by element/relation Id in a reverse order (the ones with |
| 134 | * the |
| 135 | * bigger element/relation Id first). |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 136 | * |
| 137 | * @throws IOException |
| 138 | */ |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 139 | private void setCandidateList () throws IOException { |
| Eliza Margaretha | 38a9466 | 2014-11-20 13:48:00 +0000 | [diff] [blame] | 140 | |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 141 | while (hasMoreSpans && firstSpans.doc() == currentDoc |
| 142 | && firstSpans.start() == currentPosition) { |
| Eliza Margaretha | 38a9466 | 2014-11-20 13:48:00 +0000 | [diff] [blame] | 143 | |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 144 | candidateList.add(createCandidateSpan()); |
| 145 | hasMoreSpans = firstSpans.next(); |
| 146 | } |
| Eliza Margaretha | 997ccde | 2014-07-04 09:20:35 +0000 | [diff] [blame] | 147 | |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 148 | Collections.sort(candidateList); |
| 149 | Collections.reverse(candidateList); |
| 150 | } |
| Eliza Margaretha | 997ccde | 2014-07-04 09:20:35 +0000 | [diff] [blame] | 151 | |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 152 | |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 153 | /** |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 154 | * Creates a CandidateAttributeSpan based on the child span and |
| Eliza Margaretha | 9591796 | 2016-11-16 16:07:08 +0100 | [diff] [blame^] | 155 | * set the spanId and elementEnd from its payloads. |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 156 | * |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 157 | * @param firstSpans |
| 158 | * an AttributeSpans |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 159 | * @return a CandidateAttributeSpan |
| 160 | * @throws IOException |
| 161 | */ |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 162 | private CandidateAttributeSpan createCandidateSpan () throws IOException { |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 163 | List<byte[]> payload = (List<byte[]>) firstSpans.getPayload(); |
| Akron | 4299355 | 2016-02-04 13:24:24 +0100 | [diff] [blame] | 164 | ByteBuffer payloadBuffer = ByteBuffer.wrap(payload.get(0)); |
| Eliza Margaretha | fb25cef | 2014-06-06 14:19:07 +0000 | [diff] [blame] | 165 | |
| Akron | 4299355 | 2016-02-04 13:24:24 +0100 | [diff] [blame] | 166 | byte payloadTypeIdentifier = payloadBuffer.get(0); |
| 167 | short spanId = payloadBuffer.getShort(5); |
| Akron | 4299355 | 2016-02-04 13:24:24 +0100 | [diff] [blame] | 168 | int end = payloadBuffer.getInt(1); |
| Eliza Margaretha | 2db5e23 | 2015-03-04 10:20:01 +0000 | [diff] [blame] | 169 | |
| Akron | 4299355 | 2016-02-04 13:24:24 +0100 | [diff] [blame] | 170 | return new CandidateAttributeSpan(firstSpans, payloadTypeIdentifier, |
| 171 | spanId, end); |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 172 | } |
| Eliza Margaretha | fb25cef | 2014-06-06 14:19:07 +0000 | [diff] [blame] | 173 | |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 174 | |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 175 | /** |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 176 | * Tells if the enumeration of the AttributeSpans has come to an |
| 177 | * end. |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 178 | * |
| 179 | * @return true if the enumeration has finished. |
| 180 | */ |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 181 | public boolean isFinish () { |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 182 | return isFinish; |
| 183 | } |
| 184 | |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 185 | |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 186 | /** |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 187 | * Sets true if the enumeration of the AttributeSpans has come to |
| 188 | * an end. |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 189 | * |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 190 | * @param isFinish |
| 191 | * <code>true</code> if the enumeration of the |
| 192 | * AttributeSpans has come to an end, |
| 193 | * <code>false</code> otherwise. |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 194 | */ |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 195 | public void setFinish (boolean isFinish) { |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 196 | this.isFinish = isFinish; |
| 197 | } |
| 198 | |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 199 | |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 200 | @Override |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 201 | public boolean skipTo (int target) throws IOException { |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 202 | if (hasMoreSpans && (firstSpans.doc() < target)) { |
| 203 | if (!firstSpans.skipTo(target)) { |
| 204 | candidateList.clear(); |
| 205 | return false; |
| 206 | } |
| 207 | } |
| 208 | setCandidateList(); |
| 209 | matchPayload.clear(); |
| 210 | isStartEnumeration = false; |
| 211 | return advance(); |
| 212 | } |
| 213 | |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 214 | |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 215 | @Override |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 216 | public long cost () { |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 217 | return firstSpans.cost(); |
| 218 | } |
| 219 | |
| 220 | /** |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 221 | * CandidateAttributeSpan contains information about an Attribute |
| Eliza Margaretha | 9591796 | 2016-11-16 16:07:08 +0100 | [diff] [blame^] | 222 | * span. All attribute spans occurring in an identical position |
| 223 | * are collected as CandidateAttributeSpans. The list of these |
| 224 | * CandidateAttributeSpans are sorted based on the span ids to |
| 225 | * which the attributes belong to. The attributes with smaller |
| 226 | * spanIds come first on the list. |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 227 | * |
| Eliza Margaretha | 6f98920 | 2016-10-14 21:48:29 +0200 | [diff] [blame] | 228 | */ |
| 229 | class CandidateAttributeSpan extends CandidateSpan |
| 230 | implements Comparable<CandidateSpan> { |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 231 | |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 232 | /** |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 233 | * Construct a CandidateAttributeSpan based on the given span, |
| 234 | * spanId, |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 235 | * and elementEnd. |
| 236 | * |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 237 | * @param span |
| 238 | * an AttributeSpans |
| 239 | * @param spanId |
| 240 | * the element or relation span id to which the |
| 241 | * current |
| 242 | * state of the specified AttributeSpans belongs |
| 243 | * to. |
| 244 | * @param elementEnd |
| 245 | * the end position of the element or relation span |
| 246 | * to |
| 247 | * which the current state of the specified |
| 248 | * AttributeSpans |
| 249 | * belongs to. |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 250 | * @throws IOException |
| 251 | */ |
| Akron | 4299355 | 2016-02-04 13:24:24 +0100 | [diff] [blame] | 252 | public CandidateAttributeSpan (Spans span, byte payloadTypeIdenfitier, |
| 253 | short spanId, int elementEnd) |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 254 | throws IOException { |
| 255 | super(span); |
| Akron | 4299355 | 2016-02-04 13:24:24 +0100 | [diff] [blame] | 256 | this.spanId = spanId; |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 257 | this.end = elementEnd; |
| Akron | 4299355 | 2016-02-04 13:24:24 +0100 | [diff] [blame] | 258 | this.payloadTypeIdentifier = payloadTypeIdenfitier; |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 259 | } |
| 260 | |
| Eliza Margaretha | 2db5e23 | 2015-03-04 10:20:01 +0000 | [diff] [blame] | 261 | |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 262 | @Override |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 263 | public int compareTo (CandidateSpan o) { |
| Eliza Margaretha | 6a2e80b | 2014-12-02 17:03:23 +0000 | [diff] [blame] | 264 | CandidateAttributeSpan cs = (CandidateAttributeSpan) o; |
| 265 | if (this.spanId == cs.spanId) |
| 266 | return 0; |
| 267 | else if (this.spanId > cs.spanId) |
| 268 | return 1; |
| 269 | return -1; |
| 270 | } |
| 271 | } |
| Eliza Margaretha | fb25cef | 2014-06-06 14:19:07 +0000 | [diff] [blame] | 272 | } |