Package org.apache.uima.cas

Examples of org.apache.uima.cas.FSIterator.moveTo()


      it.next(); // should throw
    } catch (ConcurrentModificationException e) {
      ok = true;
    }
    assertTrue(ok);
    it.moveTo(a);
    ok = false;
    try {
      it.next(); // should not throw
      ok = true;
    } catch (ConcurrentModificationException e) {
View Full Code Here


    }
    // AnnotationFS an;
    for (int i = 0; i < list.size(); i++) {
      // System.out.println("Iteration: " + i);
      it.moveToFirst();
      it.moveTo((FeatureStructure) list.get(i));
      assertTrue(((AnnotationFS) it.get()).getBegin() == ((AnnotationFS) list.get(i)).getBegin());
      assertTrue(((AnnotationFS) it.get()).getEnd() == ((AnnotationFS) list.get(i)).getEnd());
    }

    // Check that reverse iterator produces reverse sequence.
View Full Code Here

      it.moveToNext(); // should throw
    } catch (ConcurrentModificationException e) {
      ok = true;
    }
    assertTrue(ok);
    it.moveTo(a);
    ok = false;
    try {
      it.next(); // should not throw
      ok = true;
    } catch (ConcurrentModificationException e) {
View Full Code Here

    // For each index, check that the FSs are actually in the index.
    for (int i = 0; i < fsArray.length; i++) {
      setIt.moveTo(fsArray[i]);
      assertTrue(setIt.isValid());
      assertTrue(setIt.get().equals(fsArray[i]));
      bagIt.moveTo(fsArray[i]);
      assertTrue(bagIt.isValid());
      assertTrue(bagIt.get().equals(fsArray[i]));
      sortedIt.moveTo(fsArray[i]);
      assertTrue(sortedIt.isValid());
      assertTrue(sortedIt.get().equals(fsArray[i]));
View Full Code Here

  int oldRef = this.cas.ll_getFSRef(fsArray[i]);
  int newRef = this.cas.ll_getFSRef(setIt.get());
  assertTrue(oldRef != newRef);
  assertTrue(!setIt.get().equals(fsArray[i]));
      }
      bagIt.moveTo(fsArray[i]);
      if (bagIt.isValid()) {
  assertTrue(!bagIt.get().equals(fsArray[i]));
      }
      sortedIt.moveTo(fsArray[i]);
      if (sortedIt.isValid()) {
View Full Code Here

            .getBegin(), aCAS.getDocumentText().length());

      // get the coverFSType iterator from the CAS and move it "near" to the
      // position of the created searchFS.
      FSIterator iterator = aCAS.getAnnotationIndex(coverFsType).iterator();
      iterator.moveTo(searchFs);

      // now the iterator can either point directly to the FS we are searching
      // or it points to the next higher FS in the list. So we either have
      // already found the correct one, of we maybe have to move the iterator to
      // the previous position.
View Full Code Here

    // assumption is that annotators won't do this a lot.
    FeatureStructure fs = this.cas.createFS(this.fsVariableType);
    // Set the name of the temp var to the name we're looking for.
    fs.setStringValue(this.nameFeature, name);
    // Move the iterator, hopefully to the already existing var of that name.
    it.moveTo(fs);
    // Get the fsvar.
    if (it.isValid()) {
      return it.get();
    }
    return null;
View Full Code Here

    // then return empty list.
    if (focus.getBegin() < window.getBegin() || focus.getEnd() > window.getEnd())
      return scopeContextAnnotations;

    FSIterator subiterator = jCas.getAnnotationIndex(contextType).subiterator(window);
    subiterator.moveTo(focus);
    subiterator.moveToNext();
    if (!subiterator.isValid())
      subiterator.moveTo(focus);

    while (scopeContextAnnotations.size() < leftScopeSize) {
View Full Code Here

    FSIterator subiterator = jCas.getAnnotationIndex(contextType).subiterator(window);
    subiterator.moveTo(focus);
    subiterator.moveToNext();
    if (!subiterator.isValid())
      subiterator.moveTo(focus);

    while (scopeContextAnnotations.size() < leftScopeSize) {
      subiterator.moveToPrevious();
      if (subiterator.isValid()) {
        Annotation contextAnnotation = (Annotation) subiterator.get();
View Full Code Here

    // then return empty list.
    if (focus.getBegin() < window.getBegin() || focus.getEnd() > window.getEnd())
      return scopeContextAnnotations;

    FSIterator subiterator = jCas.getAnnotationIndex(contextType).subiterator(window);
    subiterator.moveTo(focus);
    subiterator.moveToPrevious();
    if (!subiterator.isValid())
      subiterator.moveTo(focus);

    while (scopeContextAnnotations.size() < rightScopeSize) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.