Package org.apache.uima.cas

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


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

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


      this.ae.process(jcas);
      AnnotationIndex tokenIndex = jcas.getAnnotationIndex(jcas.getCasType(Token.type));
      AnnotationFS sentence = (AnnotationFS) jcas.getAnnotationIndex(jcas.getCasType(Sentence.type)).iterator().next();
      FSIterator tokenIterator = tokenIndex.subiterator(sentence);
      AnnotationFS token = (AnnotationFS) tokenIndex.iterator().next();
      tokenIterator.moveTo(token); //throws ClassCastException   
    } catch (AnalysisEngineProcessException e) {
      e.printStackTrace();
      assertTrue(false);
    } catch (ClassCastException e) {
      // UIMA-464: Subiterator.moveTo() throws ClassCastException.
View Full Code Here

      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

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.