Package org.apache.uima.cas

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


      while (iter.isValid()) {
        if (iter.get().getType() == subtypeHandle) // expected
          break;
        if (iter.get().getType() == supertypeHandle) // unexpected
          fail();
        iter.moveToNext();
      }

      // test that passing an invalid object causes an error
      descList.add(new ConfigurationParameter_impl());
      try {
View Full Code Here


            + index.getType().getName() + "</font> [" + size + "]</html>";
    this.root = new FSNode(this, FSNode.DISPLAY_NODE, 0, null);
    this.fss = new ArrayList<FSNode>();
    FSIterator it = index.iterator();
    int count = 0;
    for (it.moveToFirst(); it.isValid(); it.moveToNext()) {
      FeatureStructure fs = it.get();
      this.fss.add(new FSNode(this, getNodeType(fs.getType()), fs.hashCode(), count));
      ++count;
    }
    List<FSTreeNode> kids = createArrayChildren(0, size, this.fss, this);
View Full Code Here

      FSIndex frIndex = indexes.getAnnotationIndex(Annotation.type);
      FSIterator sofaIter = jcas.getSofaIterator();
      int numSofas = 0;
      while (sofaIter.isValid()) {
        numSofas++;
        sofaIter.moveToNext();
      }
      // assertTrue(sofaIndex.size() == 3); // 3 sofas
      assertTrue(numSofas == 3);
      assertTrue(engIndex.size() == 5); // 4 annots plus documentAnnotation
      assertTrue(gerIndex.size() == 5); // 4 annots plus documentAnnotation
View Full Code Here

      assertTrue((CAS.TYPE_NAME_DOCUMENT_ANNOTATION).equals(gerAnnot.getType().getName()));
      assertTrue((CAS.TYPE_NAME_DOCUMENT_ANNOTATION).equals(frAnnot.getType().getName()));

      engIt.moveToNext();
      gerIt.moveToNext();
      frIt.moveToNext();
      engAnnot = (Annotation) engIt.get();
      CrossAnnotation gerCrossAnnot = (CrossAnnotation) gerIt.get();
      frAnnot = (Annotation) frIt.get();
      assertTrue((CAS.TYPE_NAME_ANNOTATION).equals(engAnnot.getType().getName()));
      assertTrue(("this").equals(engAnnot.getCoveredText()));
View Full Code Here

    FSIndex anIndex = englishView.getAnnotationIndex();
    FSIterator anIter = anIndex.iterator();
    Assert.assertEquals("this beer is good", ((AnnotationFS) anIter.next()).getCoveredText());
    Assert.assertEquals("this", ((AnnotationFS) anIter.next()).getCoveredText());
    if ("this".equals(((AnnotationFS) anIter.get()).getCoveredText()))
      anIter.moveToNext(); // because sometimes the test case runs 2 copies of the TransAnnotator
    Assert.assertEquals("beer", ((AnnotationFS) anIter.next()).getCoveredText());
    if ("beer".equals(((AnnotationFS) anIter.get()).getCoveredText()))
      anIter.moveToNext();
    Assert.assertEquals("is", ((AnnotationFS) anIter.next()).getCoveredText());
    if ("is".equals(((AnnotationFS) anIter.get()).getCoveredText()))
View Full Code Here

    Assert.assertEquals("this", ((AnnotationFS) anIter.next()).getCoveredText());
    if ("this".equals(((AnnotationFS) anIter.get()).getCoveredText()))
      anIter.moveToNext(); // because sometimes the test case runs 2 copies of the TransAnnotator
    Assert.assertEquals("beer", ((AnnotationFS) anIter.next()).getCoveredText());
    if ("beer".equals(((AnnotationFS) anIter.get()).getCoveredText()))
      anIter.moveToNext();
    Assert.assertEquals("is", ((AnnotationFS) anIter.next()).getCoveredText());
    if ("is".equals(((AnnotationFS) anIter.get()).getCoveredText()))
      anIter.moveToNext();
    Assert.assertEquals("good", ((AnnotationFS) anIter.next()).getCoveredText());
    if (anIter.isValid() && "good".equals(((AnnotationFS) anIter.get()).getCoveredText()))
View Full Code Here

    Assert.assertEquals("beer", ((AnnotationFS) anIter.next()).getCoveredText());
    if ("beer".equals(((AnnotationFS) anIter.get()).getCoveredText()))
      anIter.moveToNext();
    Assert.assertEquals("is", ((AnnotationFS) anIter.next()).getCoveredText());
    if ("is".equals(((AnnotationFS) anIter.get()).getCoveredText()))
      anIter.moveToNext();
    Assert.assertEquals("good", ((AnnotationFS) anIter.next()).getCoveredText());
    if (anIter.isValid() && "good".equals(((AnnotationFS) anIter.get()).getCoveredText()))
      anIter.moveToNext();
    Assert.assertFalse(anIter.hasNext());
View Full Code Here

    Assert.assertEquals("is", ((AnnotationFS) anIter.next()).getCoveredText());
    if ("is".equals(((AnnotationFS) anIter.get()).getCoveredText()))
      anIter.moveToNext();
    Assert.assertEquals("good", ((AnnotationFS) anIter.next()).getCoveredText());
    if (anIter.isValid() && "good".equals(((AnnotationFS) anIter.get()).getCoveredText()))
      anIter.moveToNext();
    Assert.assertFalse(anIter.hasNext());

    // print out annotations of the transalation SofA
    // System.out.println("\n----------------\n");
    CAS germanView = cas.getView("TranslatedDocument");
View Full Code Here

    FSIterator iter = mCAS.getAnnotationIndex().iterator();
    Hashtable checkBoxes = new Hashtable();
    HashSet checkBoxesDone = new HashSet();
    while (iter.isValid()) {
      AnnotationFS fs = (AnnotationFS) iter.get();
      iter.moveToNext();

      Type type = fs.getType();

      // have we seen this type before?
      JCheckBox checkbox = (JCheckBox) mTypeToCheckboxMap.get(type);
View Full Code Here

      throw new RuntimeException(e);
    }
    FSIterator iter = jcas.getAnnotationIndex().iterator();
    while (iter.isValid()) {
      Annotation annot = (Annotation) iter.get();
      iter.moveToNext();

      // find out what entity this annotation represents
      EntityResolver.Entity entity = mEntityResolver.getEntity(annot);

      //if not an entity, skip it
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.