[
https://issues.apache.org/jira/browse/UIMA-911?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12580361#action_12580361
]
Adam Lally commented on UIMA-911:
---------------------------------
Users sometimes need to implement the Java iterator interface, in which case
they need to make sure that their hasNext method doesn't advance the iterator -
so I don't see that this is that different. I guess a difference in UIMA's
case is that there's another level of indirection (the CasIterator) between the
calling code and the CasMultiplier, so we could afford to have different
contracts at the two layers. CasIterator's hasNext could be called any number
of times, but the CasMultiplier's would be guaranteed to only get called once.
I think that's what your fix is doing. So since end users never interact with
the CasMultiplier interface directly, it's not a huge loss if it's contract
doesn't follow the standard iterator paradigm.
I guess I still have a preference for keeping the contract with the
CasMultiplier analogous to the normal Iterator contract, since I think most
people think that an interface with hasNext/next operates in this way. And who
knows, maybe someone else has written some code that directly calls a
CasMultiplier component outside of the UIMA framework, and they'd be tripped up
by this. Unlikely, but possible.
Does anyone else want to voice an opinion?
> 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-fix.patch, 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.