public AnnotationFS next() { if (AnnotationComboIterator.this.nextLowerChecked) { if (!AnnotationComboIterator.this.nextLowerAvailable) { throw new NoSuchElementException(); } } else if (!hasNext()) { throw new NoSuchElementException(); } AnnotationComboIterator.this.nextLowerChecked = false; final AnnotationFS rv = AnnotationComboIterator.this.lowerIt.get(); AnnotationComboIterator.this.lowerIt.moveToNext(); return rv; }
public boolean hasNext() { if (AnnotationComboIterator.this.nextLowerChecked) { return AnnotationComboIterator.this.nextLowerAvailable; } AnnotationComboIterator.this.nextLowerChecked = true; AnnotationComboIterator.this.nextLowerAvailable = false; if (AnnotationComboIterator.this.lowerIt.isValid()) { AnnotationFS lowerFS = AnnotationComboIterator.this.lowerIt.get(); int lowerBegin = lowerFS.getBegin(); while (lowerBegin < AnnotationComboIterator.this.upperBegin) { AnnotationComboIterator.this.lowerIt.moveToNext(); if (AnnotationComboIterator.this.lowerIt.isValid()) { lowerFS = AnnotationComboIterator.this.lowerIt.get(); lowerBegin = lowerFS.getBegin(); } else { return false; } } if (AnnotationComboIterator.this.upperEnd >= lowerFS.getEnd()) { AnnotationComboIterator.this.nextLowerAvailable = true; } } return AnnotationComboIterator.this.nextLowerAvailable; }
@Override public void moveToNext() { currentIt.moveToNext(); }
public void moveToNext() { currentIt.moveToNext(); }
/** * @see org.apache.uima.cas.FSIterator#moveToNext() */ public void moveToNext() { this.nonFlatIterator.moveToNext(); this.flatIterator.moveToNext(); }
public void moveToNext() { this.it.moveToNext(); adjustForConstraintForward(); }
public AnnotationFS next() { if (AnnotationComboIterator.this.nextLowerChecked) { if (!AnnotationComboIterator.this.nextLowerAvailable) { throw new NoSuchElementException(); } } else if (!hasNext()) { throw new NoSuchElementException(); } AnnotationComboIterator.this.nextLowerChecked = false; final AnnotationFS rv = AnnotationComboIterator.this.lowerIt.get(); AnnotationComboIterator.this.lowerIt.moveToNext(); return rv; }
/** * 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(); }
public static <FST extends FeatureStructure> void fill(FSIterator<FST> srcIter, Collection<FST> destCol) { srcIter.moveToFirst(); while (srcIter.isValid()) { destCol.add(srcIter.get()); srcIter.moveToNext(); } }
public List<AnnotationFS> getAllofType(Type type) { List<AnnotationFS> result = new ArrayList<AnnotationFS>(); FSIterator<AnnotationFS> iterator = cas.getAnnotationIndex(type).iterator(); while (iterator.isValid()) { FeatureStructure featureStructure = iterator.get(); result.add((AnnotationFS) featureStructure); iterator.moveToNext(); } return result; }
public List<AnnotationFS> getAllofType(Type type) { List<AnnotationFS> result = new ArrayList<AnnotationFS>(); FSIterator<AnnotationFS> iterator = cas.getAnnotationIndex(type).iterator(); while (iterator.isValid()) { FeatureStructure featureStructure = iterator.get(); result.add((AnnotationFS) featureStructure); iterator.moveToNext(); } return result; }
private void moveOn(boolean after, FSIterator<AnnotationFS> iterator, RutaStream stream) { if (after) { iterator.moveToNext(); } else { iterator.moveToPrevious(); } while (iterator.isValid() && !stream.isVisible(iterator.get())) { if (after) { iterator.moveToNext(); } else { iterator.moveToPrevious(); } } }
private void adjustForConstraintForward() { // If the iterator is valid, but doesn't match the constraint, advance. while (this.it.isValid() && !this.cons.match(this.it.get())) { this.it.moveToNext(); } }
public List<RutaBasic> getBasicsInWindow(AnnotationFS windowAnnotation) { List<RutaBasic> result = new ArrayList<RutaBasic>(); if (windowAnnotation instanceof RutaBasic) { result.add((RutaBasic) windowAnnotation); return result; } FSMatchConstraint defaultConstraint = filter.getDefaultConstraint(); FSIterator<AnnotationFS> iterator = cas.createFilteredIterator( cas.getAnnotationIndex(basicType).subiterator(windowAnnotation), defaultConstraint); while (iterator.isValid()) { result.add((RutaBasic) iterator.get()); iterator.moveToNext(); } return result; }
private <T extends AnnotationFS> T createDocumentAnnotation(int length) { final TypeSystemImpl ts = this.svd.casMetadata.ts; // Remove any existing document annotations. FSIterator<T> it = this.<T>getAnnotationIndex(ts.docType).iterator(); List<T> list = new ArrayList<T>(); while (it.isValid()) { list.add(it.get()); it.moveToNext(); } for (int i = 0; i < list.size(); i++) { getIndexRepository().removeFS(list.get(i)); } return this.<T>ll_getFSForRef(ll_createDocumentAnnotation(length)); }
public static FeatureStructure getTcasFS(CAS aCasView, String aTypeS) { org.apache.uima.cas.FeatureStructure idFS = null; Type type = aCasView.getTypeSystem().getType(aTypeS); if (type != null) { FSIterator<AnnotationFS> idIter = aCasView.getAnnotationIndex(type).iterator(); while (idIter.isValid()) { idFS = idIter.get(); idIter.moveToNext(); } } return idFS; }
private void addChildren(AnnotationTreeNodeImpl<T> node, FSIterator<T> it) { AnnotationTreeNodeImpl<T> dtr; T annot; while (it.isValid()) { annot = it.get(); it.moveToNext(); dtr = new AnnotationTreeNodeImpl<T>(); dtr.set(annot); node.addChild(dtr); addChildren(dtr, subiterator(annot, false, true)); } }
private boolean check(AnnotationFS annotation, RutaStream stream, Type t) { boolean result = false; FSIterator<AnnotationFS> it = stream.getCas().getAnnotationIndex(t).iterator(annotation); while (it.isValid()) { AnnotationFS a = it.get(); if (a.getEnd() >= annotation.getBegin()) { result = true; break; } it.moveToNext(); } return result; }
private boolean check(AnnotationFS annotation, TextMarkerStream stream, Type t) { boolean result = false; FSIterator<AnnotationFS> it = stream.getCas().getAnnotationIndex(t).iterator(annotation); while (it.isValid()) { AnnotationFS a = (AnnotationFS) it.get(); if (a.getEnd() >= annotation.getBegin()) { result = true; break; } it.moveToNext(); } return result; }
public static boolean areAdjoining(Token t1, Token t2) { JCas jCas = getJCas(t1); FSIterator<Annotation> tokenIter = jCas.getAnnotationIndex(Token.typeIndexID).iterator(); tokenIter.moveTo(t1); assert (t1.equals(tokenIter.get())); tokenIter.moveToNext(); return tokenIter.isValid() && tokenIter.get().equals(t2); }