++annotCount;
this.cas.getIndexRepository().addFS(this.cas.createAnnotation(this.sentenceType, i, i + 10));
}
int count;
AnnotationIndex annotIndex = this.cas.getAnnotationIndex();
FSIterator it = annotIndex.iterator(true);
count = 0;
while (it.isValid()) {
++count;
it.moveToNext();
}
assertTrue(annotCount == count);
// System.out.println("Size of ambiguous iterator: " + count);
it = annotIndex.iterator(false);
count = 0;
while (it.isValid()) {
++count;
it.moveToNext();
}
assertTrue(count == 1);
// System.out.println("Size of unambiguous iterator: " + count);
AnnotationFS bigAnnot = this.cas.createAnnotation(this.sentenceType, 10, 41);
it = annotIndex.subiterator(bigAnnot, true, true);
count = 0;
while (it.isValid()) {
++count;
// AnnotationFS a = (AnnotationFS) it.get();
// System.out.println("Annotation from " + a.getBegin() + " to " + a.getEnd());
it.moveToNext();
}
assertTrue(count == 32);
count = 0;
for (it.moveToLast(); it.isValid(); it.moveToPrevious()) {
++count;
}
assertTrue(count == 32);
// System.out.println("Size of subiterator(true, true): " + count);
it = annotIndex.subiterator(bigAnnot, false, true);
count = 0;
while (it.isValid()) {
++count;
// AnnotationFS a = (AnnotationFS) it.get();
// System.out.println("Annotation from " + a.getBegin() + " to " + a.getEnd());
it.moveToNext();
}
assertTrue(count == 3);
// System.out.println("Size of subiterator(false, true): " + count);
count = 0;
for (it.moveToLast(); it.isValid(); it.moveToPrevious()) {
++count;
}
assertTrue(count == 3);
it = annotIndex.subiterator(bigAnnot, true, false);
count = 0;
while (it.isValid()) {
++count;
// AnnotationFS a = (AnnotationFS) it.get();
// System.out.println("Annotation from " + a.getBegin() + " to " + a.getEnd());
it.moveToNext();
}
assertTrue(count == 39);
// System.out.println("Size of subiterator(true, false): " + count);
count = 0;
for (it.moveToLast(); it.isValid(); it.moveToPrevious()) {
++count;
}
assertTrue(count == 39);
it = annotIndex.subiterator(bigAnnot, false, false);
count = 0;
while (it.isValid()) {
++count;
// AnnotationFS a = (AnnotationFS) it.get();
// System.out.println("Annotation from " + a.getBegin() + " to " + a.getEnd());
it.moveToNext();
}
assertTrue(count == 4);
// System.out.println("Size of subiterator(false, false): " + count);
count = 0;
for (it.moveToLast(); it.isValid(); it.moveToPrevious()) {
++count;
}
assertTrue(count == 4);
AnnotationFS sent = (AnnotationFS) this.cas.getAnnotationIndex(this.sentenceType).iterator().get();
it = annotIndex.subiterator(sent, false, true);
count = 0;
while (it.isValid()) {
++count;
// AnnotationFS a = (AnnotationFS) it.get();
// System.out.println("Annotation from " + a.getBegin() + " to " + a.getEnd());