Return-Path: Delivered-To: apmail-incubator-opennlp-dev-archive@minotaur.apache.org Received: (qmail 12064 invoked from network); 26 Jan 2011 17:21:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 26 Jan 2011 17:21:11 -0000 Received: (qmail 84107 invoked by uid 500); 26 Jan 2011 17:21:11 -0000 Delivered-To: apmail-incubator-opennlp-dev-archive@incubator.apache.org Received: (qmail 84061 invoked by uid 500); 26 Jan 2011 17:21:10 -0000 Mailing-List: contact opennlp-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: opennlp-dev@incubator.apache.org Delivered-To: mailing list opennlp-dev@incubator.apache.org Received: (qmail 84050 invoked by uid 99); 26 Jan 2011 17:21:09 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Jan 2011 17:21:09 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Jan 2011 17:21:07 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id p0QHKhX2009329 for ; Wed, 26 Jan 2011 17:20:46 GMT Message-ID: <12064389.219641296062443224.JavaMail.jira@thor> Date: Wed, 26 Jan 2011 12:20:43 -0500 (EST) From: "Steven Bethard (JIRA)" To: opennlp-dev@incubator.apache.org Subject: [jira] Created: (OPENNLP-99) EventStream should extend Iterator MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org EventStream should extend Iterator ----------------------------------------- Key: OPENNLP-99 URL: https://issues.apache.org/jira/browse/OPENNLP-99 Project: OpenNLP Issue Type: New Feature Components: Maxent Affects Versions: maxent-3.0.0-sourceforge Reporter: Steven Bethard [As requested, brought over from Sourceforge.] Conceptually, EventStream is just an Iterator. You would get better interoperability with other Java libraries if EventStream were declared as such. If you didn't care about backwards compatibility, I'd say just get rid of EventStream entirely and use Iterator everywhere instead. If you care about backwards compatibility, you could at least declare AbstractEventStream as implementing Iterator - it declares all of hasNext(), next() and remove(). I believe that shouldn't break anything, and should make all the current EventStream implementations into Iterators. Why do I want this? Because, when using OpenNLP maxent from Scala, if a RealValueFileEventStream were an Iterator, I could write: for (event <- stream) { ... } But since it's not, I instead have to wrap it in an Iterator: val events = new Iterator[Event] { def hasNext = stream.hasNext def next = stream.next } for (event <- events) { ... } Or write the while loop version: while (stream.hasNext) { val event = stream.next ... } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.