Return-Path: X-Original-To: apmail-lucene-lucene-net-dev-archive@www.apache.org Delivered-To: apmail-lucene-lucene-net-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 92B0D9E37 for ; Tue, 24 Jan 2012 06:38:20 +0000 (UTC) Received: (qmail 4898 invoked by uid 500); 24 Jan 2012 06:38:17 -0000 Delivered-To: apmail-lucene-lucene-net-dev-archive@lucene.apache.org Received: (qmail 3646 invoked by uid 500); 24 Jan 2012 06:38:06 -0000 Mailing-List: contact lucene-net-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: lucene-net-dev@lucene.apache.org Delivered-To: mailing list lucene-net-dev@lucene.apache.org Received: (qmail 3601 invoked by uid 99); 24 Jan 2012 06:38:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Jan 2012 06:38:02 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Jan 2012 06:38:01 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 5B81915F8F3 for ; Tue, 24 Jan 2012 06:37:41 +0000 (UTC) Date: Tue, 24 Jan 2012 06:37:41 +0000 (UTC) From: "Christopher Currens (Created) (JIRA)" To: lucene-net-dev@lucene.apache.org Message-ID: <405113201.70621.1327387061376.JavaMail.tomcat@hel.zones.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Subject: [Lucene.Net] [jira] [Created] (LUCENENET-469) Convert Java Iterator classes to implement IEnumerable Convert Java Iterator classes to implement IEnumerable --------------------------------------------------------- Key: LUCENENET-469 URL: https://issues.apache.org/jira/browse/LUCENENET-469 Project: Lucene.Net Issue Type: Sub-task Components: Lucene.Net Contrib, Lucene.Net Core Affects Versions: Lucene.Net 2.9.4, Lucene.Net 3.0.3, Lucene.Net 2.9.4g Environment: all Reporter: Christopher Currens Fix For: Lucene.Net 3.0.3 The Iterator pattern in Java is equivalent to IEnumerable in .NET. Classes that were directly ported in Java using the Iterator pattern, cannot be used with Linq or foreach blocks in .NET. {{Next()}} would be equivalent to .NET's {{MoveNext()}}, and in the below case, {{Term()}} would be as .NET's {{Current}} property. In cases as below, it will require {{TermEnum}} to become an abstract class with {{Term}} and {{DocFreq}} properties, which would be returned from another class or method that implemented {{IEnumerable}}. {noformat} public abstract class TermEnum : IDisposable { public abstract bool Next(); public abstract Term Term(); public abstract int DocFreq(); public abstract void Close(); public abstract void Dispose(); } {noformat} would instead look something like: {noformat} public class TermFreq { public abstract Term { get; } public abstract int { get; } } public abstract class TermEnum : IEnumerable, IDisposable { // ... } {noformat} Keep in mind that it is important that if the class being converted implements {{IDisposable}}, the class that is enumerating the terms (in this case {{TermEnum}}) should inherit from both {{IEnumerable}} *and* {{IDisposable}}. This won't be any change to the user, as the compiler automatically calls {{IDisposable}} when used in a {{foreach}} loop. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira