/** * Check whether two Spans in the same document are ordered with possible overlap. * * @return true iff spans1 starts before spans2 or the spans start at the same position, and * spans1 ends before spans2. */ static boolean positionsOrdered(Spans spans1, Spans spans2) { assert spans1.docID() == spans2.docID() : "doc1 " + spans1.docID() + " != doc2 " + spans2.docID(); int start1 = spans1.startPosition(); int start2 = spans2.startPosition(); return (start1 == start2) ? (spans1.endPosition() < spans2.endPosition()) : (start1 < start2); }
@Override public int endPosition() { return in.endPosition(); }