@Override public void moveToLast() { currentIt.moveToLast(); }
public void moveToLast() { currentIt.moveToLast(); }
/** * Move the iterator so that the next call to {@link #previous() previous()} will return the first * element in the index (for a non-empty index). */ public void moveToEnd() { // Move the back pointer to point at the last element. this.back.moveToLast(); // Move the forward pointer past the end. this.forward.moveToLast(); this.forward.moveToNext(); }
/** * @see org.apache.uima.cas.FSIterator#moveToLast() */ public void moveToLast() { this.nonFlatIterator.moveToLast(); this.flatIterator.moveToLast(); }
public void moveToLast() { // See comments on moveToFirst() this.iteratorIndex = this.iterators.size() - 1; while (this.iteratorIndex >= 0) { FSIterator<T> it = this.iterators.get(this.iteratorIndex); it.moveToLast(); if (it.isValid()) { return; } --this.iteratorIndex; } }
public void moveToLast() { this.it.moveToLast(); adjustForConstraintBackward(); }
public void moveToPrevious() { // No point in going anywhere if iterator is not valid. if (!isValid()) { return; } // Grab current iterator and dec. FSIterator<T> current = this.iterators.get(this.iteratorIndex); current.moveToPrevious(); // If we're ok with the current iterator, return. if (current.isValid()) { return; } --this.iteratorIndex; while (this.iteratorIndex >= 0) { current = this.iterators.get(this.iteratorIndex); current.moveToLast(); if (current.isValid()) { return; } --this.iteratorIndex; } // If we get here, the iterator is no longer valid, there are no more elements. Set internal // counter to the invalid position. this.iteratorIndex = this.iterators.size(); }
/** * @see ListIterator#previous() */ public T previous() throws NoSuchElementException { // See comments for next(). if (!this.back.isValid()) { throw new NoSuchElementException(); } this.back.moveToPrevious(); if (this.forward.isValid()) { this.forward.moveToPrevious(); } else { this.forward.moveToLast(); } return this.forward.get(); }
/** * Return next element if exists. Always save iterator position. * * @param iter * iterator * @return next element if exists or null otherwise */ private static <T extends FeatureStructure> T lookupNext(FSIterator<T> iter) { iter.moveToNext(); T result; if (iter.isValid()) { result = iter.get(); iter.moveToPrevious(); } else { result = null; iter.moveToLast(); } return result; }
public List<AnnotationFS> getOverappingAnnotations(AnnotationFS window, Type type) { List<AnnotationFS> result = new ArrayList<AnnotationFS>(); AnnotationFS newWindow = cas.createAnnotation(type, window.getBegin(), window.getEnd() - 1); FSIterator<AnnotationFS> iterator = cas.getAnnotationIndex(type).iterator(newWindow); if (!iterator.isValid()) { iterator.moveToLast(); } while (iterator.isValid()) { FeatureStructure fs = iterator.get(); if (fs instanceof AnnotationFS) { AnnotationFS a = (AnnotationFS) fs; if (a.getEnd() >= window.getEnd() && a.getBegin() <= window.getBegin()) { result.add(a); } } iterator.moveToPrevious(); } return result; }
public List<AnnotationFS> getOverappingAnnotations(AnnotationFS window, Type type) { List<AnnotationFS> result = new ArrayList<AnnotationFS>(); AnnotationFS newWindow = cas.createAnnotation(type, window.getBegin(), window.getEnd() - 1); FSIterator<AnnotationFS> iterator = cas.getAnnotationIndex(type).iterator(newWindow); if (!iterator.isValid()) { iterator.moveToLast(); } while (iterator.isValid()) { FeatureStructure fs = iterator.get(); if (fs instanceof AnnotationFS) { AnnotationFS a = (AnnotationFS) fs; if (a.getEnd() >= window.getEnd() && a.getBegin() <= window.getBegin()) { result.add(a); } } iterator.moveToPrevious(); } return result; }
private boolean check(AnnotationFS annotation, RutaStream stream, Type t) { boolean result = false; FSIterator<AnnotationFS> it = stream.getCas().getAnnotationIndex(t).iterator(annotation); if (!it.isValid()) { it.moveToLast(); } while (it.isValid()) { AnnotationFS a = it.get(); if (a.getBegin() <= annotation.getBegin()) { result = true; break; } it.moveToPrevious(); } return result; }
private boolean check(AnnotationFS annotation, TextMarkerStream stream, Type t) { boolean result = false; FSIterator<AnnotationFS> it = stream.getCas().getAnnotationIndex(t).iterator(annotation); if (!it.isValid()) { it.moveToLast(); } while (it.isValid()) { AnnotationFS a = (AnnotationFS) it.get(); if (a.getBegin() <= annotation.getBegin()) { result = true; break; } it.moveToPrevious(); } return result; }
itr.moveToLast(); if (!itr.isValid()) { return precedingAnnotations;
private void addHeadAnnotation(Constituent cons, Span headSpan) throws CASRuntimeException, CASException { FSIterator tokens = cons.getCAS().getJCas().getAnnotationIndex(Token.type).subiterator(cons); int headStart = offsetMap.getMapping(headSpan.getStart()); int headEnd = offsetMap.getMapping(headSpan.getEnd()); while (tokens.hasNext()) { Token token = (Token) tokens.next(); if (token.getBegin() == headStart && token.getEnd() == headEnd) { cons.setHead(token); tokens.moveToLast(); tokens.next(); } } }
i.moveToLast(); while (n < -1 && i.isValid()) { i.moveToPrevious();
private Annotation getNextBestAnnotation(Annotation source, JCas jcas) { FSIterator<Annotation> iterator = jcas.getAnnotationIndex().iterator(source); Annotation best = null; if (iterator.isValid()) { Annotation annotation = iterator.get(); best = annotation; } else { Annotation dummy = new Annotation(jcas, source.getBegin(), source.getBegin() + 1); iterator = jcas.getAnnotationIndex().iterator(dummy); if (!iterator.isValid()) { if ((jcas.getDocumentText().length() / 2) > source.getBegin()) { iterator.moveToFirst(); if (iterator.isValid()) { Annotation annotation = iterator.get(); best = annotation; } } else { iterator.moveToLast(); if (iterator.isValid()) { Annotation annotation = iterator.get(); best = annotation; } } } } return best; }
FSIterator<AnnotationFS> completeIt = getCas().getAnnotationIndex(type).iterator(); if (getDocumentAnnotation().getEnd() < windowAnnotation.getEnd()) { completeIt.moveToLast(); } else { completeIt.moveTo(windowAnnotation);
FSIterator<AnnotationFS> completeIt = getCas().getAnnotationIndex(type).iterator(); if (getDocumentAnnotation().getEnd() < windowAnnotation.getEnd()) { completeIt.moveToLast(); } else { completeIt.moveTo(windowAnnotation);
it.moveTo(annotation); if (!it.isValid()) { it.moveToLast(); if (!it.isValid()) { return false;