org.apache.uima.fit.pipeline

## Class JCasIterable

- java.lang.Object
- - org.apache.uima.fit.pipeline.JCasIterable

- All Implemented Interfaces:
    Iterable<JCas>

      public class JCasIterable
      extends Object
      implements Iterable<JCas>

  A class implementing iteration over a the documents of a collection. Each element in the Iterable is a JCas containing a single document. The documents have been loaded by the CollectionReader and processed by the AnalysisEngine (if any).

  NOTE:If any exception is generated while using the iterator generated by `iterator()`, an unchecked `IllegalStateException` is thrown!

  External resources can be shared between the reader and the analysis engines.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `JCasIterable(CollectionReaderDescription aReader, AnalysisEngineDescription... aEngines)` Iterate over the documents loaded by the collection reader, running the analysis engines on each one before yielding them.
    `JCasIterable(ResourceManager aResMgr, CollectionReaderDescription aReader, AnalysisEngineDescription... aEngines)` Iterate over the documents loaded by the collection reader, running the analysis engines on each one before yielding them.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `JCasIterator` | `iterator()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach, spliterator`

- - ### Constructor Detail

    - #### JCasIterable

          public JCasIterable(CollectionReaderDescription aReader,
                              AnalysisEngineDescription... aEngines)

      Iterate over the documents loaded by the collection reader, running the analysis engines on each one before yielding them. When created with this constructor, analysis engines by default receive a collectionProcessComplete call when all documents have been read from the reader and all components get destroyed.
      Parameters:
        `aReader` - The collection reader for loading documents.
        `aEngines` - The analysis engines for processing documents.

    - #### JCasIterable

          public JCasIterable(ResourceManager aResMgr,
                              CollectionReaderDescription aReader,
                              AnalysisEngineDescription... aEngines)

      Iterate over the documents loaded by the collection reader, running the analysis engines on each one before yielding them. When created with this constructor, analysis engines by default receive a collectionProcessComplete call when all documents have been read from the reader and all components get destroyed.
      Parameters:
        `aResMgr` - The `ResourceManager` used to create the components and the JCas. If this parameter is `null` then `ResourceManagerFactory.newResourceManager()` will be used to obtain a resource manager. If a new resource manager was internally created, it is destroyed at the end of the pipeline.
        `aReader` - The collection reader for loading documents.
        `aEngines` - The analysis engines for processing documents.

  - ### Method Detail

    - #### iterator

          public JCasIterator iterator()

      Specified by:
        `iterator` in interface `Iterable<JCas>`

Copyright © 2012–2021 The Apache Software Foundation. All rights reserved.