Return-Path: X-Original-To: apmail-lucene-lucene-net-commits-archive@www.apache.org Delivered-To: apmail-lucene-lucene-net-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C77C929A1 for ; Sun, 1 May 2011 20:32:34 +0000 (UTC) Received: (qmail 83667 invoked by uid 500); 1 May 2011 20:32:34 -0000 Delivered-To: apmail-lucene-lucene-net-commits-archive@lucene.apache.org Received: (qmail 83640 invoked by uid 500); 1 May 2011 20:32:34 -0000 Mailing-List: contact lucene-net-commits-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-commits@lucene.apache.org Received: (qmail 83633 invoked by uid 99); 1 May 2011 20:32:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 01 May 2011 20:32:34 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 01 May 2011 20:32:30 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id E19682388980; Sun, 1 May 2011 20:32:09 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Date: Sun, 01 May 2011 20:32:09 -0000 To: lucene-net-commits@lucene.apache.org From: digy@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110501203209.E19682388980@eris.apache.org> Subject: [Lucene.Net] svn commit: r1098404 - in /incubator/lucene.net/branches/Lucene.Net_2_9_4g: src/core/ src/core/Search/ src/core/Search/Spans/ src/core/Store/ test/core/Index/ test/core/Store/ Author: digy Date: Sun May 1 20:32:09 2011 New Revision: 1098404 URL: http://svn.apache.org/viewvc?rev=1098404&view=rev Log: [LUCENENET-412] Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/MultiSearcher.cs incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Query.cs incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/FieldMaskingSpanQuery.cs incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Store/FileSwitchDirectory.cs incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Store/NativeFSLockFactory.cs incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Store/RAMDirectory.cs incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Store/SingleInstanceLockFactory.cs incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/SupportClass.cs incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestIndexWriter.cs incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Store/TestFileSwitchDirectory.cs Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/MultiSearcher.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/MultiSearcher.cs?rev=1098404&r1=1098403&r2=1098404&view=diff ============================================================================== --- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/MultiSearcher.cs (original) +++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/MultiSearcher.cs Sun May 1 20:32:09 2011 @@ -16,6 +16,7 @@ */ using System; +using System.Collections.Generic; using Document = Lucene.Net.Documents.Document; using FieldSelector = Lucene.Net.Documents.FieldSelector; @@ -81,10 +82,10 @@ namespace Lucene.Net.Search /// private class CachedDfSource:Searcher { - private System.Collections.IDictionary dfMap; // Map from Terms to corresponding doc freqs + private IDictionary dfMap; // Map from Terms to corresponding doc freqs private int maxDoc; // document count - - public CachedDfSource(System.Collections.IDictionary dfMap, int maxDoc, Similarity similarity) + + public CachedDfSource(IDictionary dfMap, int maxDoc, Similarity similarity) { this.dfMap = dfMap; this.maxDoc = maxDoc; @@ -96,7 +97,7 @@ namespace Lucene.Net.Search int df; try { - df = ((System.Int32) dfMap[term]); + df = dfMap[term]; } catch (System.NullReferenceException e) { @@ -414,11 +415,11 @@ namespace Lucene.Net.Search aggregatedDfs[j] += dfs[j]; } } - - System.Collections.Hashtable dfMap = new System.Collections.Hashtable(); + + IDictionary dfMap = new SupportClass.Dictionary(); for (int i = 0; i < allTermsArray.Length; i++) { - dfMap[allTermsArray[i]] = (System.Int32) aggregatedDfs[i]; + dfMap[allTermsArray[i]] = aggregatedDfs[i]; } // step4 Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Query.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Query.cs?rev=1098404&r1=1098403&r2=1098404&view=diff ============================================================================== --- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Query.cs (original) +++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Query.cs Sun May 1 20:32:09 2011 @@ -134,7 +134,7 @@ namespace Lucene.Net.Search /// public virtual Query Combine(Query[] queries) { - System.Collections.Hashtable uniques = new System.Collections.Hashtable(); + SupportClass.Set uniques = new SupportClass.Set(); for (int i = 0; i < queries.Length; i++) { Query query = queries[i]; @@ -155,26 +155,26 @@ namespace Lucene.Net.Search { for (int j = 0; j < clauses.Length; j++) { - SupportClass.CollectionsHelper.AddIfNotContains(uniques, clauses[j].GetQuery()); + uniques.Add(clauses[j].GetQuery()); } } else { - SupportClass.CollectionsHelper.AddIfNotContains(uniques, query); + uniques.Add(query); } } // optimization: if we have just one query, just return it if (uniques.Count == 1) { - foreach (object key in uniques.Keys) + foreach (Query key in uniques) { return (Query) key; } } BooleanQuery result = new BooleanQuery(true); - foreach (object key in uniques.Keys) + foreach (Query key in uniques) { - result.Add((Query) key, BooleanClause.Occur.SHOULD); + result.Add(key, BooleanClause.Occur.SHOULD); } return result; } @@ -200,22 +200,21 @@ namespace Lucene.Net.Search /// public static Query MergeBooleanQueries(BooleanQuery[] queries) { - System.Collections.Hashtable allClauses = new System.Collections.Hashtable(); + SupportClass.Set allClauses = new SupportClass.Set(); for (int i = 0; i < queries.Length; i++) { BooleanClause[] clauses = queries[i].GetClauses(); for (int j = 0; j < clauses.Length; j++) { - SupportClass.CollectionsHelper.AddIfNotContains(allClauses, clauses[j]); + allClauses.Add(clauses[j]); } } bool coordDisabled = queries.Length == 0?false:queries[0].IsCoordDisabled(); BooleanQuery result = new BooleanQuery(coordDisabled); - System.Collections.IEnumerator i2 = allClauses.GetEnumerator(); - while (i2.MoveNext()) + foreach(BooleanClause bc in allClauses) { - result.Add((BooleanClause) i2.Current); + result.Add(bc); } return result; } Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/FieldMaskingSpanQuery.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/FieldMaskingSpanQuery.cs?rev=1098404&r1=1098403&r2=1098404&view=diff ============================================================================== --- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/FieldMaskingSpanQuery.cs (original) +++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Spans/FieldMaskingSpanQuery.cs Sun May 1 20:32:09 2011 @@ -101,7 +101,7 @@ namespace Lucene.Net.Search.Spans /// use {@link #ExtractTerms(Set)} instead. /// - [Obsolete("use ExtractTerms(Hashtable) instead.")] + [Obsolete("use ExtractTerms instead.")] public override IList GetTerms() { return maskedQuery.GetTerms(); Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Store/FileSwitchDirectory.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Store/FileSwitchDirectory.cs?rev=1098404&r1=1098403&r2=1098404&view=diff ============================================================================== --- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Store/FileSwitchDirectory.cs (original) +++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Store/FileSwitchDirectory.cs Sun May 1 20:32:09 2011 @@ -16,6 +16,7 @@ */ using System; +using System.Collections.Generic; namespace Lucene.Net.Store { @@ -36,10 +37,10 @@ namespace Lucene.Net.Store { private Directory secondaryDir; private Directory primaryDir; - private System.Collections.Hashtable primaryExtensions; + private IList primaryExtensions; private bool doClose; - - public FileSwitchDirectory(System.Collections.Hashtable primaryExtensions, Directory primaryDir, Directory secondaryDir, bool doClose) + + public FileSwitchDirectory(IList primaryExtensions, Directory primaryDir, Directory secondaryDir, bool doClose) { this.primaryExtensions = primaryExtensions; this.primaryDir = primaryDir; Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Store/NativeFSLockFactory.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Store/NativeFSLockFactory.cs?rev=1098404&r1=1098403&r2=1098404&view=diff ============================================================================== --- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Store/NativeFSLockFactory.cs (original) +++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Store/NativeFSLockFactory.cs Sun May 1 20:32:09 2011 @@ -168,7 +168,7 @@ namespace Lucene.Net.Store * one JVM (each with their own NativeFSLockFactory * instance) have set the same lock dir and lock prefix. */ - private static System.Collections.Hashtable LOCK_HELD = new System.Collections.Hashtable(); + private static SupportClass.Set LOCK_HELD = new SupportClass.Set(); [System.Obsolete("Use the constructor that takes a DirectoryInfo, this will be removed in the 3.0 release")] public NativeFSLock(System.IO.FileInfo lockDir, System.String lockFileName):this(new System.IO.DirectoryInfo(lockDir.FullName), lockFileName) @@ -245,7 +245,7 @@ namespace Lucene.Net.Store // thread trying to obtain this lock, so we own // the only instance of a channel against this // file: - LOCK_HELD.Add(canonicalPath, canonicalPath); + LOCK_HELD.Add(canonicalPath); markedHeld = true; } } Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Store/RAMDirectory.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Store/RAMDirectory.cs?rev=1098404&r1=1098403&r2=1098404&view=diff ============================================================================== --- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Store/RAMDirectory.cs (original) +++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Store/RAMDirectory.cs Sun May 1 20:32:09 2011 @@ -32,8 +32,8 @@ namespace Lucene.Net.Store { private const long serialVersionUID = 1L; - - internal protected System.Collections.Hashtable fileMap = new System.Collections.Hashtable(); + + internal protected SupportClass.Dictionary fileMap = new SupportClass.Dictionary(); internal protected long sizeInBytes = 0; // ***** @@ -126,13 +126,11 @@ namespace Lucene.Net.Store lock (this) { EnsureOpen(); - System.Collections.ICollection fileNames = fileMap.Keys; - System.String[] result = new System.String[fileNames.Count]; + System.String[] result = new System.String[fileMap.Count]; int i = 0; - System.Collections.IEnumerator it = fileNames.GetEnumerator(); - while (it.MoveNext()) + foreach(string key in fileMap.Keys) { - result[i++] = ((System.String) it.Current); + result[i++] = key; } return result; } @@ -317,11 +315,6 @@ namespace Lucene.Net.Store Close(); } - public System.Collections.Hashtable fileMap_ForNUnit - { - get { return fileMap; } - } - public long sizeInBytes_ForNUnitTest { get { return sizeInBytes; } Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Store/SingleInstanceLockFactory.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Store/SingleInstanceLockFactory.cs?rev=1098404&r1=1098403&r2=1098404&view=diff ============================================================================== --- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Store/SingleInstanceLockFactory.cs (original) +++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Store/SingleInstanceLockFactory.cs Sun May 1 20:32:09 2011 @@ -34,7 +34,7 @@ namespace Lucene.Net.Store public class SingleInstanceLockFactory:LockFactory { - private System.Collections.Hashtable locks = new System.Collections.Hashtable(); + private SupportClass.Set locks = new SupportClass.Set(); public override Lock MakeLock(System.String lockName) { @@ -61,9 +61,9 @@ namespace Lucene.Net.Store { internal System.String lockName; - private System.Collections.Hashtable locks; - - public SingleInstanceLock(System.Collections.Hashtable locks, System.String lockName) + private SupportClass.Set locks; + + public SingleInstanceLock(SupportClass.Set locks, System.String lockName) { this.locks = locks; this.lockName = lockName; @@ -75,7 +75,7 @@ namespace Lucene.Net.Store { if (locks.Contains(lockName) == false) { - locks.Add(lockName, lockName); + locks.Add(lockName); return true; } Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/SupportClass.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/SupportClass.cs?rev=1098404&r1=1098403&r2=1098404&view=diff ============================================================================== --- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/SupportClass.cs (original) +++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/SupportClass.cs Sun May 1 20:32:09 2011 @@ -1406,6 +1406,7 @@ public class SupportClass } #endregion + [Serializable] public class Dictionary : System.Collections.Generic.IDictionary { System.Collections.Generic.IDictionary _Dict = null; Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestIndexWriter.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestIndexWriter.cs?rev=1098404&r1=1098403&r2=1098404&view=diff ============================================================================== --- incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestIndexWriter.cs (original) +++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestIndexWriter.cs Sun May 1 20:32:09 2011 @@ -5955,11 +5955,11 @@ namespace Lucene.Net.Index // open "first" with IndexWriter IndexCommit commit = null; - System.Collections.IEnumerator it = IndexReader.ListCommits(dir).GetEnumerator(); - while (it.MoveNext()) + foreach (IndexCommit c in IndexReader.ListCommits(dir)) { - IndexCommit c = (IndexCommit)it.Current; - string tag = (String)c.GetUserData()["tag"]; + string tag = null; + if(c.GetUserData().ContainsKey("tag")) + tag = c.GetUserData()["tag"]; if ("first".Equals(tag)) { commit = c; @@ -5981,11 +5981,11 @@ namespace Lucene.Net.Index // make sure "second" commit is still there commit = null; - it = IndexReader.ListCommits(dir).GetEnumerator(); - while (it.MoveNext()) + foreach (IndexCommit c in IndexReader.ListCommits(dir)) { - IndexCommit c = (IndexCommit)it.Current; - string tag = (String)c.GetUserData()["tag"]; + string tag = null; + if (c.GetUserData().ContainsKey("tag")) + tag = c.GetUserData()["tag"]; if ("second".Equals(tag)) { commit = c; @@ -6010,11 +6010,11 @@ namespace Lucene.Net.Index // make sure "third" commit is still there commit = null; - it = IndexReader.ListCommits(dir).GetEnumerator(); - while (it.MoveNext()) + foreach (IndexCommit c in IndexReader.ListCommits(dir)) { - IndexCommit c = (IndexCommit)it.Current; - string tag = (String)c.GetUserData()["tag"]; + string tag = null; + if (c.GetUserData().ContainsKey("tag")) + tag = c.GetUserData()["tag"]; if ("third".Equals(tag)) { commit = c; Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Store/TestFileSwitchDirectory.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Store/TestFileSwitchDirectory.cs?rev=1098404&r1=1098403&r2=1098404&view=diff ============================================================================== --- incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Store/TestFileSwitchDirectory.cs (original) +++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Store/TestFileSwitchDirectory.cs Sun May 1 20:32:09 2011 @@ -16,6 +16,7 @@ */ using System; +using System.Collections.Generic; using NUnit.Framework; @@ -36,9 +37,9 @@ namespace Lucene.Net.Store [Test] public virtual void TestBasic() { - System.Collections.Hashtable fileExtensions = new System.Collections.Hashtable(); - SupportClass.CollectionsHelper.AddIfNotContains(fileExtensions, "fdt"); - SupportClass.CollectionsHelper.AddIfNotContains(fileExtensions, "fdx"); + IList fileExtensions = new SupportClass.Set(); + fileExtensions.Add("fdt"); + fileExtensions.Add("fdx"); Directory primaryDir = new MockRAMDirectory(); RAMDirectory secondaryDir = new MockRAMDirectory();