uima-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Eckart de Castilho (JIRA)" <...@uima.apache.org>
Subject [jira] [Commented] (UIMA-3097) Split JCasIterable into iterable and iterator parts
Date Sun, 04 Aug 2013 12:15:49 GMT

    [ https://issues.apache.org/jira/browse/UIMA-3097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13728863#comment-13728863
] 

Richard Eckart de Castilho commented on UIMA-3097:
--------------------------------------------------

The main code was moved to JCasIterator. This implements Iterator<JCas> so that it can
be used in extended for loops.

the name JCasIterable was left as is, but changed the constructor signature. Since the iterator()
method of the Java Iterable interface does not declare any exceptions, the IOException and
UIMAExceptions that could be thrown from the JCasIterator constructor are wrapped as IllegalStateExceptions
and re-thrown. We already used that strategy before (and use it still) in next() and hasNext().

The new uimaFIT JCasIterator has the name as a UIMA core interface. The UIMA core JCasIterator
hasNext() and next() methods declare exceptions and, thus, it does not implement the Java
Iterator interface. It cannot be used in extended for loops.
                
> Split JCasIterable into iterable and iterator parts
> ---------------------------------------------------
>
>                 Key: UIMA-3097
>                 URL: https://issues.apache.org/jira/browse/UIMA-3097
>             Project: UIMA
>          Issue Type: Improvement
>          Components: uimaFIT
>            Reporter: Richard Eckart de Castilho
>            Assignee: Richard Eckart de Castilho
>             Fix For: 2.0.0uimaFIT
>
>
> The JCasIterable is an Iterable and an Iterator at the same time. The iterator() method
returns just "this". This goes against the expectation that an Iterable should return a fresh
iterator when iterator() is called.
> JCasIterable should therefore be split. The JCasIterable should only be creatable with
descriptions.
> Calling iterator should create a new JCasIterator which then is based on concrete reader
and AE instances.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message