You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by "Adam Lally (JIRA)" <ui...@incubator.apache.org> on 2008/03/17 22:52:24 UTC
[jira] Commented: (UIMA-911) CasMultiplier's hasNext() called twice
without an intervening next()
[ https://issues.apache.org/jira/browse/UIMA-911?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12579625#action_12579625 ]
Adam Lally commented on UIMA-911:
---------------------------------
I don't think this is a bug. This is meant to work the same as Java Iterators. If you call an iterator's hasNext() method twice, it gives you the same value and does not advance the iterator.
> CasMultiplier's hasNext() called twice without an intervening next()
> --------------------------------------------------------------------
>
> Key: UIMA-911
> URL: https://issues.apache.org/jira/browse/UIMA-911
> Project: UIMA
> Issue Type: Bug
> Components: Core Java Framework
> Reporter: Burn Lewis
> Priority: Minor
> Attachments: UIMA-911.patch
>
>
> In org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl the hasNext method calls the AnalysisComponent's hasNext but then its next method calls the AnalysisComponent's hasNext again before calling next.
> Makes it difficult to split the processing between hasNext & next.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
Re: [jira] Commented: (UIMA-911) CasMultiplier's hasNext() called twice without an intervening next()
Posted by Burn Lewis <bu...@gmail.com>.
At various times in our docs we indicate that the framework always calls
next after hasNext, and indicate that it doesn't matter in which the
processing is done, e.g. in the tutorial:
Note that if it is more convenient you can request an empty CAS during
the process or
hasNext methods, not just during the next method.
.......
Instead, you should spread your processing out across the calls to the
hasNext or next methods.
>
> I see no contract that says hasNext may be called more than once before
next, only implicit examples of next always being called after hasNext
returns true. So we're not violating anything with the current
implementation but with one small change we can make things much easier for
CAS Multiplier writers and reduce their errors. I have had to work around
this in the past but managed to forget it last week and wasted time
rediscovering the problem.
Burn.
Re: [jira] Commented: (UIMA-911) CasMultiplier's hasNext() called
twice without an intervening next()
Posted by Marshall Schor <ms...@schor.com>.
Adam Lally (JIRA) wrote:
> [ https://issues.apache.org/jira/browse/UIMA-911?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12579625#action_12579625 ]
>
> Adam Lally commented on UIMA-911:
> ---------------------------------
>
> I don't think this is a bug. This is meant to work the same as Java Iterators. If you call an iterator's hasNext() method twice, it gives you the same value and does not advance the iterator.
>
+1. I don't think we want to change the contract for this to one which
guarantees hasNext can only be called once.
-Marshall