lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ccurr...@apache.org
Subject [Lucene.Net] svn commit: r1294875 [16/45] - in /incubator/lucene.net/trunk: ./ build/ build/vs2010/contrib/ build/vs2010/test/ doc/ src/ src/contrib/Analyzers/ src/contrib/Analyzers/AR/ src/contrib/Analyzers/BR/ src/contrib/Analyzers/CJK/ src/contrib/Analyzers/Cn/ ...
Date Tue, 28 Feb 2012 22:43:28 GMT
Modified: incubator/lucene.net/trunk/src/core/Index/FreqProxTermsWriter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/FreqProxTermsWriter.cs?rev=1294875&r1=1294874&r2=1294875&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/FreqProxTermsWriter.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/FreqProxTermsWriter.cs Tue Feb 28 22:43:08 2012
@@ -16,17 +16,13 @@
  */
 
 using System;
-
-using IndexInput = Lucene.Net.Store.IndexInput;
-using IndexOutput = Lucene.Net.Store.IndexOutput;
+using System.Collections.Generic;
 using UnicodeUtil = Lucene.Net.Util.UnicodeUtil;
 
 namespace Lucene.Net.Index
 {
-	
-	sealed class FreqProxTermsWriter:TermsHashConsumer
+	sealed class FreqProxTermsWriter : TermsHashConsumer
 	{
-		
 		public override TermsHashConsumerPerThread AddThread(TermsHashPerThread perThread)
 		{
 			return new FreqProxTermsWriterPerThread(perThread);
@@ -71,27 +67,20 @@ namespace Lucene.Net.Index
 		// FreqProxFieldMergeState, and code to visit all Fields
 		// under the same FieldInfo together, up into TermsHash*.
 		// Other writers would presumably share alot of this...
-		
-		public override void  Flush(System.Collections.IDictionary threadsAndFields, SegmentWriteState state)
+        public override void Flush(IDictionary<TermsHashConsumerPerThread, ICollection<TermsHashConsumerPerField>> threadsAndFields, SegmentWriteState state)
 		{
 			
 			// Gather all FieldData's that have postings, across all
 			// ThreadStates
-			System.Collections.ArrayList allFields = new System.Collections.ArrayList();
+			var allFields = new List<FreqProxTermsWriterPerField>();
 
-            System.Collections.IEnumerator it = new System.Collections.Hashtable(threadsAndFields).GetEnumerator();
-			while (it.MoveNext())
+            foreach(var entry in threadsAndFields)
 			{
+				var fields = entry.Value;
 				
-				System.Collections.DictionaryEntry entry = (System.Collections.DictionaryEntry) it.Current;
-				
-				System.Collections.ICollection fields = (System.Collections.ICollection) entry.Value;
-				
-				System.Collections.IEnumerator fieldsIt = fields.GetEnumerator();
-				
-				while (fieldsIt.MoveNext())
+				foreach(var i in fields)
 				{
-					FreqProxTermsWriterPerField perField = (FreqProxTermsWriterPerField) ((System.Collections.DictionaryEntry) fieldsIt.Current).Key;
+					FreqProxTermsWriterPerField perField = (FreqProxTermsWriterPerField)i;
 					if (perField.termsHashPerField.numPostings > 0)
 						allFields.Add(perField);
 				}
@@ -118,17 +107,17 @@ namespace Lucene.Net.Index
 			int start = 0;
 			while (start < numAllFields)
 			{
-				FieldInfo fieldInfo = ((FreqProxTermsWriterPerField) allFields[start]).fieldInfo;
+				FieldInfo fieldInfo = allFields[start].fieldInfo;
 				System.String fieldName = fieldInfo.name;
 				
 				int end = start + 1;
-				while (end < numAllFields && ((FreqProxTermsWriterPerField) allFields[end]).fieldInfo.name.Equals(fieldName))
+				while (end < numAllFields && allFields[end].fieldInfo.name.Equals(fieldName))
 					end++;
 				
 				FreqProxTermsWriterPerField[] fields = new FreqProxTermsWriterPerField[end - start];
 				for (int i = start; i < end; i++)
 				{
-					fields[i - start] = (FreqProxTermsWriterPerField) allFields[i];
+					fields[i - start] = allFields[i];
 					
 					// Aggregate the storePayload as seen by the same
 					// field across multiple threads
@@ -151,10 +140,8 @@ namespace Lucene.Net.Index
 				start = end;
 			}
 
-            it = new System.Collections.Hashtable(threadsAndFields).GetEnumerator();
-			while (it.MoveNext())
+            foreach(var entry in threadsAndFields)
 			{
-				System.Collections.DictionaryEntry entry = (System.Collections.DictionaryEntry) it.Current;
 				FreqProxTermsWriterPerThread perThread = (FreqProxTermsWriterPerThread) entry.Key;
 				perThread.termsHashPerThread.Reset(true);
 			}
@@ -297,15 +284,9 @@ namespace Lucene.Net.Index
 			
 			termsConsumer.Finish();
 		}
-		
-		private TermInfo termInfo = new TermInfo(); // minimize consing
-		
+
 		internal UnicodeUtil.UTF8Result termsUTF8 = new UnicodeUtil.UTF8Result();
 		
-		internal void  Files(System.Collections.ICollection files)
-		{
-		}
-		
 		internal sealed class PostingList:RawPostingList
 		{
 			internal int docFreq; // # times this term occurs in the current doc

Modified: incubator/lucene.net/trunk/src/core/Index/FreqProxTermsWriterPerField.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/FreqProxTermsWriterPerField.cs?rev=1294875&r1=1294874&r2=1294875&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/FreqProxTermsWriterPerField.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/FreqProxTermsWriterPerField.cs Tue Feb 28 22:43:08 2012
@@ -26,7 +26,7 @@ namespace Lucene.Net.Index
 	// TODO: break into separate freq and prox writers as
 	// codecs; make separate container (tii/tis/skip/*) that can
 	// be configured as any number of files 1..N
-	sealed class FreqProxTermsWriterPerField:TermsHashConsumerPerField, System.IComparable
+	sealed class FreqProxTermsWriterPerField:TermsHashConsumerPerField, System.IComparable<FreqProxTermsWriterPerField>
 	{
 		
 		internal FreqProxTermsWriterPerThread perThread;
@@ -65,9 +65,8 @@ namespace Lucene.Net.Index
 		{
 		}
 		
-		public int CompareTo(System.Object other0)
+		public int CompareTo(FreqProxTermsWriterPerField other)
 		{
-			FreqProxTermsWriterPerField other = (FreqProxTermsWriterPerField) other0;
 			return String.CompareOrdinal(fieldInfo.name, other.fieldInfo.name);
 		}
 		
@@ -89,9 +88,9 @@ namespace Lucene.Net.Index
 		
 		internal override void  Start(Fieldable f)
 		{
-			if (fieldState.attributeSource.HasAttribute(typeof(PayloadAttribute)))
+            if (fieldState.attributeSource.HasAttribute<PayloadAttribute>())
 			{
-				payloadAttribute = (PayloadAttribute) fieldState.attributeSource.GetAttribute(typeof(PayloadAttribute));
+                payloadAttribute = fieldState.attributeSource.GetAttribute<PayloadAttribute>();
 			}
 			else
 			{

Modified: incubator/lucene.net/trunk/src/core/Index/IndexCommit.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/IndexCommit.cs?rev=1294875&r1=1294874&r2=1294875&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/IndexCommit.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/IndexCommit.cs Tue Feb 28 22:43:08 2012
@@ -16,7 +16,7 @@
  */
 
 using System;
-
+using System.Collections.Generic;
 using Directory = Lucene.Net.Store.Directory;
 
 namespace Lucene.Net.Index
@@ -40,7 +40,7 @@ namespace Lucene.Net.Index
 	/// may suddenly change. <p/>
 	/// </summary>
 	
-	public abstract class IndexCommit : IndexCommitPoint
+	public abstract class IndexCommit
 	{
 		
 		/// <summary> Get the segments file (<c>segments_N</c>) associated 
@@ -49,7 +49,7 @@ namespace Lucene.Net.Index
 		public abstract System.String GetSegmentsFileName();
 		
 		/// <summary> Returns all index files referenced by this commit point.</summary>
-		public abstract System.Collections.Generic.ICollection<string> GetFileNames();
+		public abstract ICollection<string> GetFileNames();
 		
 		/// <summary> Returns the <see cref="Directory" /> for the index.</summary>
 		public abstract Directory GetDirectory();
@@ -114,6 +114,6 @@ namespace Lucene.Net.Index
         /// <see cref="IndexWriter.Commit(System.Collections.Generic.IDictionary{string, string})" />
 		/// for this commit.  IDictionary is String -> String. 
 		/// </summary>
-        public abstract System.Collections.Generic.IDictionary<string, string> GetUserData();
+        public abstract IDictionary<string, string> GetUserData();
 	}
 }
\ No newline at end of file

Modified: incubator/lucene.net/trunk/src/core/Index/IndexDeletionPolicy.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/IndexDeletionPolicy.cs?rev=1294875&r1=1294874&r2=1294875&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/IndexDeletionPolicy.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/IndexDeletionPolicy.cs Tue Feb 28 22:43:08 2012
@@ -16,6 +16,7 @@
  */
 
 using System;
+using System.Collections.Generic;
 
 namespace Lucene.Net.Index
 {
@@ -70,7 +71,7 @@ namespace Lucene.Net.Index
 		/// <see cref="IndexCommit">point-in-time commits</see>,
 		/// sorted by age (the 0th one is the oldest commit).
 		/// </param>
-		void  OnInit(System.Collections.IList commits);
+		void  OnInit<T>(IList<T> commits) where T : IndexCommit;
 		
 		/// <summary> <p/>This is called each time the writer completed a commit.
 		/// This gives the policy a chance to remove old commit points
@@ -97,6 +98,6 @@ namespace Lucene.Net.Index
 		/// <param name="commits">List of <see cref="IndexCommit" />,
 		/// sorted by age (the 0th one is the oldest commit).
 		/// </param>
-		void  OnCommit(System.Collections.IList commits);
+		void  OnCommit<T>(IList<T> commits) where T : IndexCommit;
 	}
 }
\ No newline at end of file

Modified: incubator/lucene.net/trunk/src/core/Index/IndexFileDeleter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/IndexFileDeleter.cs?rev=1294875&r1=1294874&r2=1294875&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/IndexFileDeleter.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/IndexFileDeleter.cs Tue Feb 28 22:43:08 2012
@@ -16,7 +16,8 @@
 */
 
 using System;
-
+using System.Collections.Generic;
+using Lucene.Net.Support;
 using Directory = Lucene.Net.Store.Directory;
 
 namespace Lucene.Net.Index
@@ -31,13 +32,6 @@ namespace Lucene.Net.Index
     /// not yet committed.  This class uses simple reference
     /// counting to map the live SegmentInfos instances to
     /// individual files in the Directory.</para>
-    ///
-    /// <para>When autoCommit=true, IndexWriter currently commits only
-    /// on completion of a merge (though this may change with
-    /// time: it is not a guarantee).  When autoCommit=false,
-    /// IndexWriter only commits when it is closed.  Regardless
-    /// of autoCommit, the user may call IndexWriter.commit() to
-    /// force a blocking commit.</para>
     /// 
     /// <para>The same directory file may be referenced by more than
     /// one IndexCommit, i.e. more than one SegmentInfos.
@@ -66,32 +60,32 @@ namespace Lucene.Net.Index
     /// directly with no retry logic.</para>
     /// </summary>
 	
-	public sealed class IndexFileDeleter
+	public sealed class IndexFileDeleter : IDisposable
 	{
 		
 		//// Files that we tried to delete but failed (likely
 		/// because they are open and we are running on Windows),
 		/// so we will retry them again later: ////
-		private System.Collections.Generic.IList<string> deletable;
+		private IList<string> deletable;
 		
 		//// Reference count for all files in the index.  
 		/// Counts how many existing commits reference a file.
 		/// Maps String to RefCount (class below) instances: ////
-		private System.Collections.Generic.Dictionary<System.String, RefCount> refCounts = new System.Collections.Generic.Dictionary<System.String, RefCount>();
+		private IDictionary<string, RefCount> refCounts = new HashMap<string, RefCount>();
 		
 		//// Holds all commits (segments_N) currently in the index.
 		/// This will have just 1 commit if you are using the
 		/// default delete policy (KeepOnlyLastCommitDeletionPolicy).
 		/// Other policies may leave commit points live for longer
 		/// in which case this list would be longer than 1: ////
-		private System.Collections.ArrayList commits = new System.Collections.ArrayList();
+        private List<CommitPoint> commits = new List<CommitPoint>();
 		
 		//// Holds files we had incref'd from the previous
 		/// non-commit checkpoint: ////
-        private System.Collections.Generic.IList<string> lastFiles = new System.Collections.Generic.List<string>();
+        private List<ICollection<string>> lastFiles = new List<ICollection<string>>();
 		
 		//// Commits that the IndexDeletionPolicy have decided to delete: ////
-		private System.Collections.ArrayList commitsToDelete = new System.Collections.ArrayList();
+        private List<CommitPoint> commitsToDelete = new List<CommitPoint>();
 		
 		private System.IO.StreamWriter infoStream;
 		private Directory directory;
@@ -101,7 +95,7 @@ namespace Lucene.Net.Index
 		internal bool startingCommitDeleted;
         private SegmentInfos lastSegmentInfos;
 
-        private System.Collections.Generic.Dictionary<string, string> synced;
+        private HashSet<string> synced;
 		
 		/// <summary>Change to true to see details of reference counts when
 		/// infoStream != null 
@@ -119,7 +113,7 @@ namespace Lucene.Net.Index
 		
 		private void  Message(System.String message)
 		{
-            infoStream.WriteLine("IFD [" + new DateTime().ToString() + "; " + SupportClass.ThreadClass.Current().Name + "]: " + message);
+            infoStream.WriteLine("IFD [" + new DateTime().ToString() + "; " + ThreadClass.Current().Name + "]: " + message);
 		}
 		
 		/// <summary> Initialize the deleter: find all previous commits in
@@ -129,7 +123,7 @@ namespace Lucene.Net.Index
 		/// </summary>
 		/// <throws>  CorruptIndexException if the index is corrupt </throws>
 		/// <throws>  IOException if there is a low-level IO error </throws>
-        public IndexFileDeleter(Directory directory, IndexDeletionPolicy policy, SegmentInfos segmentInfos, System.IO.StreamWriter infoStream, DocumentsWriter docWriter, System.Collections.Generic.Dictionary<string, string> synced)
+        public IndexFileDeleter(Directory directory, IndexDeletionPolicy policy, SegmentInfos segmentInfos, System.IO.StreamWriter infoStream, DocumentsWriter docWriter, HashSet<string> synced)
 		{
 			
 			this.docWriter = docWriter;
@@ -198,7 +192,7 @@ namespace Lucene.Net.Index
                         {
                             if (SegmentInfos.GenerationFromSegmentsFileName(fileName) <= currentGen)
                             {
-                                throw e;
+                                throw;
                             }
                             else
                             {
@@ -210,7 +204,7 @@ namespace Lucene.Net.Index
                         }
                         if (sis != null)
                         {
-                            CommitPoint commitPoint = new CommitPoint(this,commitsToDelete, directory, sis);
+                            CommitPoint commitPoint = new CommitPoint(this, commitsToDelete, directory, sis);
                             if (sis.GetGeneration() == segmentInfos.GetGeneration())
                             {
                                 currentCommitPoint = commitPoint;
@@ -258,11 +252,10 @@ namespace Lucene.Net.Index
 			// Now delete anything with ref count at 0.  These are
 			// presumably abandoned files eg due to crash of
 			// IndexWriter.
-			System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<System.String, RefCount>> it = refCounts.GetEnumerator();
-			while (it.MoveNext())
+			foreach(KeyValuePair<string, RefCount> entry in refCounts)
 			{
-				System.String fileName = (System.String) it.Current.Key;
-				RefCount rc = (RefCount) refCounts[fileName];
+                string fileName = entry.Key;
+				RefCount rc = refCounts[fileName];
 				if (0 == rc.count)
 				{
 					if (infoStream != null)
@@ -306,15 +299,14 @@ namespace Lucene.Net.Index
 				// the now-deleted commits:
 				for (int i = 0; i < size; i++)
 				{
-					CommitPoint commit = (CommitPoint) commitsToDelete[i];
+					CommitPoint commit = commitsToDelete[i];
 					if (infoStream != null)
 					{
 						Message("deleteCommits: now decRef commit \"" + commit.GetSegmentsFileName() + "\"");
 					}
-					System.Collections.Generic.IEnumerator<string> it = commit.files.GetEnumerator();
-					while (it.MoveNext())
+					foreach(string file in commit.files)
 					{
-						DecRef(it.Current);
+						DecRef(file);
 					}
 				}
 				commitsToDelete.Clear();
@@ -325,7 +317,7 @@ namespace Lucene.Net.Index
 				int writeTo = 0;
 				while (readFrom < size)
 				{
-					CommitPoint commit = (CommitPoint) commits[readFrom];
+					CommitPoint commit = commits[readFrom];
 					if (!commit.deleted)
 					{
 						if (writeTo != readFrom)
@@ -389,8 +381,9 @@ namespace Lucene.Net.Index
 			Refresh(null);
 		}
 		
-		public void  Close()
+		public void Dispose()
 		{
+            // Move to protected method if class becomes unsealed
 			// DecRef old files from the last checkpoint, if any:
 			int size = lastFiles.Count;
 			if (size > 0)
@@ -407,7 +400,7 @@ namespace Lucene.Net.Index
 		{
 			if (deletable != null)
 			{
-				System.Collections.Generic.IList<string> oldDeletable = deletable;
+				IList<string> oldDeletable = deletable;
 				deletable = null;
 				int size = oldDeletable.Count;
 				for (int i = 0; i < size; i++)
@@ -469,7 +462,7 @@ namespace Lucene.Net.Index
 			else
 			{
 				
-				System.Collections.Generic.IList<string> docWriterFiles;
+				IList<string> docWriterFiles;
 				if (docWriter != null)
 				{
 					docWriterFiles = docWriter.OpenFiles();
@@ -492,17 +485,11 @@ namespace Lucene.Net.Index
 				}
 				
 				// Save files so we can decr on next checkpoint/commit:
-                foreach (string fname in segmentInfos.Files(directory, false))
-                {
-                    lastFiles.Add(fname);
-                }
+                lastFiles.Add(segmentInfos.Files(directory, false));
 				
                 if (docWriterFiles != null)
                 {
-                    foreach (string fname in docWriterFiles)
-                    {
-                        lastFiles.Add(fname);
-                    }
+                    lastFiles.Add(docWriterFiles);
                 }
 			}
 		}
@@ -511,23 +498,21 @@ namespace Lucene.Net.Index
 		{
 			// If this is a commit point, also incRef the
 			// segments_N file:
-			System.Collections.Generic.IEnumerator<string> it = segmentInfos.Files(directory, isCommit).GetEnumerator();
-			while (it.MoveNext())
+			foreach(string fileName in segmentInfos.Files(directory, isCommit))
 			{
-				IncRef(it.Current);
+				IncRef(fileName);
 			}
 		}
-		
-		internal void  IncRef(System.Collections.Generic.IList<string> files)
+
+        internal void IncRef(ICollection<string> files)
 		{
-			int size = files.Count;
-			for (int i = 0; i < size; i++)
+            foreach(string file in files)
 			{
-				IncRef((System.String) files[i]);
+                IncRef(file);
 			}
 		}
 		
-		internal void  IncRef(System.String fileName)
+		internal void  IncRef(string fileName)
 		{
 			RefCount rc = GetRefCount(fileName);
 			if (infoStream != null && VERBOSE_REF_COUNTS)
@@ -537,12 +522,11 @@ namespace Lucene.Net.Index
 			rc.IncRef();
 		}
 		
-		internal void  DecRef(System.Collections.Generic.ICollection<string> files)
+		internal void  DecRef(ICollection<string> files)
 		{
-            System.Collections.Generic.IEnumerator<string> it = files.GetEnumerator();
-            while (it.MoveNext())
+            foreach(string file in files)
             {
-                DecRef(it.Current);
+                DecRef(file);
             }
 		}
 		
@@ -571,10 +555,9 @@ namespace Lucene.Net.Index
 		
 		internal void  DecRef(SegmentInfos segmentInfos)
 		{
-			System.Collections.Generic.IEnumerator<string> it = segmentInfos.Files(directory, false).GetEnumerator();
-			while (it.MoveNext())
+			foreach(string file in segmentInfos.Files(directory, false))
 			{
-				DecRef(it.Current);
+				DecRef(file);
 			}
 		}
 
@@ -600,16 +583,15 @@ namespace Lucene.Net.Index
 			}
 			else
 			{
-				rc = (RefCount) refCounts[fileName];
+				rc = refCounts[fileName];
 			}
 			return rc;
 		}
 		
-		internal void  DeleteFiles(System.Collections.IList files)
+		internal void  DeleteFiles(System.Collections.Generic.IList<string> files)
 		{
-			int size = files.Count;
-			for (int i = 0; i < size; i++)
-				DeleteFile((System.String) files[i]);
+			foreach(string file in files)
+				DeleteFile(file);
 		}
 		
 		/// <summary>Deletes the specified files, but only if they are new
@@ -617,10 +599,8 @@ namespace Lucene.Net.Index
 		/// </summary>
         internal void DeleteNewFiles(System.Collections.Generic.ICollection<string> files)
 		{
-			System.Collections.IEnumerator it = files.GetEnumerator();
-			while (it.MoveNext())
+			foreach(string fileName in files)
 			{
-				System.String fileName = (System.String) it.Current;
                 if (!refCounts.ContainsKey(fileName))
                 {
                     if (infoStream != null)
@@ -661,7 +641,7 @@ namespace Lucene.Net.Index
 					}
 					if (deletable == null)
 					{
-                        deletable = new System.Collections.Generic.List<string>();
+                        deletable = new List<string>();
 					}
 					deletable.Add(fileName); // add to deletable
 				}
@@ -708,7 +688,7 @@ namespace Lucene.Net.Index
 		/// equals.
 		/// </summary>
 		
-		sealed private class CommitPoint:IndexCommit, System.IComparable
+		sealed private class CommitPoint:IndexCommit, System.IComparable<CommitPoint>
 		{
             private void InitBlock(IndexFileDeleter enclosingInstance)
             {
@@ -725,17 +705,17 @@ namespace Lucene.Net.Index
             }
 			
 			internal long gen;
-            internal System.Collections.Generic.ICollection<string> files;
-			internal System.String segmentsFileName;
+            internal ICollection<string> files;
+			internal string segmentsFileName;
 			internal bool deleted;
 			internal Directory directory;
-			internal System.Collections.ICollection commitsToDelete;
+            internal ICollection<CommitPoint> commitsToDelete;
 			internal long version;
 			internal long generation;
 			internal bool isOptimized;
-            internal System.Collections.Generic.IDictionary<string, string> userData;
+            internal IDictionary<string, string> userData;
 			
-			public CommitPoint(IndexFileDeleter enclosingInstance, System.Collections.ICollection commitsToDelete, Directory directory, SegmentInfos segmentInfos)
+			public CommitPoint(IndexFileDeleter enclosingInstance, ICollection<CommitPoint> commitsToDelete, Directory directory, SegmentInfos segmentInfos)
 			{
 				InitBlock(enclosingInstance);
 				this.directory = directory;
@@ -766,7 +746,7 @@ namespace Lucene.Net.Index
 				return segmentsFileName;
 			}
 
-            public override System.Collections.Generic.ICollection<string> GetFileNames()
+            public override ICollection<string> GetFileNames()
 			{
 				return files;
 			}
@@ -786,7 +766,7 @@ namespace Lucene.Net.Index
 				return generation;
 			}
 
-            public override System.Collections.Generic.IDictionary<string, string> GetUserData()
+            public override IDictionary<string, string> GetUserData()
 			{
 				return userData;
 			}
@@ -807,10 +787,9 @@ namespace Lucene.Net.Index
 			{
 				return deleted;
 			}
-			
-			public int CompareTo(System.Object obj)
+
+            public int CompareTo(CommitPoint commit)
 			{
-				CommitPoint commit = (CommitPoint) obj;
 				if (gen < commit.gen)
 				{
 					return - 1;

Modified: incubator/lucene.net/trunk/src/core/Index/IndexFileNameFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/IndexFileNameFilter.cs?rev=1294875&r1=1294874&r2=1294875&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/IndexFileNameFilter.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/IndexFileNameFilter.cs Tue Feb 28 22:43:08 2012
@@ -16,34 +16,31 @@
  */
 
 using System;
+using System.Collections.Generic;
 
 namespace Lucene.Net.Index
 {
 	
-	/// <summary> Filename filter that accept filenames and extensions only created by Lucene.
-	/// 
-	/// </summary>
-	/// <version>  $rcs = ' $Id: Exp $ ' ;
-	/// </version>
+	/// <summary>Filename filter that accept filenames and extensions only created by Lucene. </summary>
 	public class IndexFileNameFilter
 	{
 		
 		private static IndexFileNameFilter singleton = new IndexFileNameFilter();
-        private System.Collections.Hashtable extensions;
-        private System.Collections.Hashtable extensionsInCFS;
+        private HashSet<String> extensions;
+        private HashSet<String> extensionsInCFS;
 		
 		// Prevent instantiation.
 		private IndexFileNameFilter()
 		{
-            extensions = new System.Collections.Hashtable();
+            extensions = new HashSet<String>();
 			for (int i = 0; i < IndexFileNames.INDEX_EXTENSIONS.Length; i++)
 			{
-				extensions.Add(IndexFileNames.INDEX_EXTENSIONS[i], IndexFileNames.INDEX_EXTENSIONS[i]);
+				extensions.Add(IndexFileNames.INDEX_EXTENSIONS[i]);
 			}
-            extensionsInCFS = new System.Collections.Hashtable();
+            extensionsInCFS = new HashSet<String>();
 			for (int i = 0; i < IndexFileNames.INDEX_EXTENSIONS_IN_COMPOUND_FILE.Length; i++)
 			{
-				extensionsInCFS.Add(IndexFileNames.INDEX_EXTENSIONS_IN_COMPOUND_FILE[i], IndexFileNames.INDEX_EXTENSIONS_IN_COMPOUND_FILE[i]);
+				extensionsInCFS.Add(IndexFileNames.INDEX_EXTENSIONS_IN_COMPOUND_FILE[i]);
 			}
 		}
 		

Modified: incubator/lucene.net/trunk/src/core/Index/IndexFileNames.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/IndexFileNames.cs?rev=1294875&r1=1294874&r2=1294875&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/IndexFileNames.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/IndexFileNames.cs Tue Feb 28 22:43:08 2012
@@ -16,15 +16,12 @@
  */
 
 using System;
+using Lucene.Net.Support;
 
 namespace Lucene.Net.Index
 {
 	
-	/// <summary> Useful constants representing filenames and extensions used by lucene
-	/// 
-	/// </summary>
-	/// <version>  $rcs = ' $Id: Exp $ ' ;
-	/// </version>
+	/// <summary>Useful constants representing filenames and extensions used by lucene</summary>
 	public sealed class IndexFileNames
 	{
 		
@@ -139,7 +136,7 @@ namespace Lucene.Net.Index
 			else
 			{
 #if !PRE_LUCENE_NET_2_0_0_COMPATIBLE
-				return base_Renamed + "_" + SupportClass.Number.ToString(gen) + extension;
+				return base_Renamed + "_" + Number.ToString(gen) + extension;
 #else
 				return base_Renamed + "_" + System.Convert.ToString(gen, 16) + extension;
 #endif

Modified: incubator/lucene.net/trunk/src/core/Index/IndexReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/IndexReader.cs?rev=1294875&r1=1294874&r2=1294875&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/IndexReader.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/IndexReader.cs Tue Feb 28 22:43:08 2012
@@ -29,7 +29,7 @@ namespace Lucene.Net.Index
 	/// index.  Search of an index is done entirely through this abstract interface,
 	/// so that any subclass which implements it is searchable.
 	/// <p/> Concrete subclasses of IndexReader are usually constructed with a call to
-	/// one of the static <c>open()</c> methods, e.g. <see cref="Open(String, bool)" />
+	/// one of the static <c>open()</c> methods, e.g. <see cref="Open(Lucene.Net.Store.Directory, bool)" />
 	///.
 	/// <p/> For efficiency, in this API documents are often referred to via
 	/// <i>document numbers</i>, non-negative integers which each name a unique
@@ -47,13 +47,10 @@ namespace Lucene.Net.Index
 	/// <p/>
 	/// <p/>
 	/// <b>NOTE</b>: as of 2.4, it's possible to open a read-only
-	/// IndexReader using one of the static open methods that
-	/// accepts the boolean readOnly parameter.  Such a reader has
-	/// better concurrency as it's not necessary to synchronize on
-	/// the isDeleted method.  Currently the default for readOnly
-	/// is false, meaning if not specified you will get a
-	/// read/write IndexReader.  But in 3.0 this default will
-	/// change to true, meaning you must explicitly specify false
+	/// IndexReader using the static open methods that accepts the
+	/// boolean readOnly parameter.  Such a reader has better
+	/// better concurrency as it's not necessary to synchronize on the
+	/// isDeleted method.  You must explicitly specify false
 	/// if you want to make changes with the resulting IndexReader.
 	/// <p/>
 	/// <a name="thread-safety"></a><p/><b>NOTE</b>: <see cref="IndexReader" />
@@ -64,11 +61,9 @@ namespace Lucene.Net.Index
 	/// <c>IndexReader</c> instance; use your own
 	/// (non-Lucene) objects instead.
 	/// </summary>
-	/// <version>  $Id: IndexReader.java 826049 2009-10-16 19:28:55Z mikemccand $
-	/// </version>
 	public abstract class IndexReader : System.ICloneable, System.IDisposable
 	{
-		private class AnonymousClassFindSegmentsFile:SegmentInfos.FindSegmentsFile
+		private class AnonymousClassFindSegmentsFile : SegmentInfos.FindSegmentsFile
 		{
 			private void  InitBlock(Lucene.Net.Store.Directory directory2)
 			{
@@ -110,10 +105,6 @@ namespace Lucene.Net.Index
 			public static readonly FieldOption STORES_PAYLOADS = new FieldOption("STORES_PAYLOADS");
 			/// <summary>All fields that omit tf </summary>
 			public static readonly FieldOption OMIT_TERM_FREQ_AND_POSITIONS = new FieldOption("OMIT_TERM_FREQ_AND_POSITIONS");
-			/// <deprecated> Renamed to <see cref="OMIT_TERM_FREQ_AND_POSITIONS" /> 
-			/// </deprecated>
-            [Obsolete("Renamed to OMIT_TERM_FREQ_AND_POSITIONS")]
-			public static readonly FieldOption OMIT_TF;
 			/// <summary>All fields which are not indexed </summary>
 			public static readonly FieldOption UNINDEXED = new FieldOption("UNINDEXED");
 			/// <summary>All fields which are indexed with termvectors enabled </summary>
@@ -128,10 +119,6 @@ namespace Lucene.Net.Index
 			public static readonly FieldOption TERMVECTOR_WITH_OFFSET = new FieldOption("TERMVECTOR_WITH_OFFSET");
 			/// <summary>All fields with termvectors with offset values and position values enabled </summary>
 			public static readonly FieldOption TERMVECTOR_WITH_POSITION_OFFSET = new FieldOption("TERMVECTOR_WITH_POSITION_OFFSET");
-			static FieldOption()
-			{
-				OMIT_TF = OMIT_TERM_FREQ_AND_POSITIONS;
-			}
 		}
 		
 		private bool closed;
@@ -139,9 +126,7 @@ namespace Lucene.Net.Index
 		
 		private int refCount;
 		
-		internal static int DEFAULT_TERMS_INDEX_DIVISOR = 1;
-		
-		private bool disableFakeNorms = false;
+		protected internal static int DEFAULT_TERMS_INDEX_DIVISOR = 1;
 		
 		/// <summary>Expert: returns the current refCount for this reader </summary>
 		public virtual int GetRefCount()
@@ -202,166 +187,30 @@ namespace Lucene.Net.Index
 			}
 		}
 		
-		/// <deprecated> will be deleted when IndexReader(Directory) is deleted
-		/// </deprecated>
-		/// <seealso cref="Directory()">
-		/// </seealso>
-        [Obsolete("will be deleted when IndexReader(Directory) is deleted")]
-		private Directory directory;
-		
-		/// <summary> Legacy Constructor for backwards compatibility.
-		/// 
-		/// <p/>
-		/// This Constructor should not be used, it exists for backwards 
-		/// compatibility only to support legacy subclasses that did not "own" 
-		/// a specific directory, but needed to specify something to be returned 
-		/// by the directory() method.  Future subclasses should delegate to the 
-		/// no arg constructor and implement the directory() method as appropriate.
-		/// 
-		/// </summary>
-		/// <param name="directory">Directory to be returned by the directory() method
-		/// </param>
-		/// <seealso cref="Directory()">
-		/// </seealso>
-		/// <deprecated> - use IndexReader()
-		/// </deprecated>
-        [Obsolete("- use IndexReader()")]
-		protected internal IndexReader(Directory directory):this()
-		{
-			this.directory = directory;
-		}
-		
 		protected internal IndexReader()
 		{
 			refCount = 1;
 		}
 		
 		/// <throws>  AlreadyClosedException if this IndexReader is closed </throws>
-		protected internal void  EnsureOpen()
-		{
-			if (refCount <= 0)
-			{
-				throw new AlreadyClosedException("this IndexReader is closed");
-			}
-		}
-		
-		/// <summary>Returns a read/write IndexReader reading the index in an FSDirectory in the named
-		/// path.
-		/// </summary>
-		/// <throws>  CorruptIndexException if the index is corrupt </throws>
-		/// <throws>  IOException if there is a low-level IO error </throws>
-		/// <deprecated> Use <see cref="Open(Directory, bool)" /> instead. 
-		/// This method will be removed in the 3.0 release.
-		/// 
-		/// </deprecated>
-		/// <param name="path">the path to the index directory 
-		/// </param>
-        [Obsolete("Use Open(Directory, boolean) instead. This method will be removed in the 3.0 release.")]
-		public static IndexReader Open(System.String path)
+        protected internal void EnsureOpen()
 		{
-			return Open(path, false);
+		    if (refCount <= 0)
+		    {
+		        throw new AlreadyClosedException("this IndexReader is closed");
+		    }
 		}
-		
-		/// <summary>Returns an IndexReader reading the index in an
-		/// FSDirectory in the named path.  You should pass
-		/// readOnly=true, since it gives much better concurrent
-		/// performance, unless you intend to do write operations
-		/// (delete documents or change norms) with the reader.
-		/// </summary>
-		/// <throws>  CorruptIndexException if the index is corrupt </throws>
-		/// <throws>  IOException if there is a low-level IO error </throws>
-		/// <param name="path">the path to the index directory
-		/// </param>
-		/// <param name="readOnly">true if this should be a readOnly
-		/// reader
-		/// </param>
-        /// <deprecated> Use <see cref="Open(Directory, bool)" /> instead.
-		/// This method will be removed in the 3.0 release.
-		/// 
-		/// </deprecated>
-        [Obsolete("Use Open(Directory, bool) instead. This method will be removed in the 3.0 release.")]
-		public static IndexReader Open(System.String path, bool readOnly)
-		{
-			Directory dir = FSDirectory.GetDirectory(path);
-			IndexReader r = null;
-			try
-			{
-				r = Open(dir, null, null, readOnly, DEFAULT_TERMS_INDEX_DIVISOR);
-			}
-			finally
-			{
-				if (r == null)
-					dir.Close();
-			}
-			return new DirectoryOwningReader(r);
-		}
-		
-		/// <summary>Returns a read/write IndexReader reading the index in an FSDirectory in the named
-		/// path.
-		/// </summary>
-		/// <param name="path">the path to the index directory
-		/// </param>
-		/// <throws>  CorruptIndexException if the index is corrupt </throws>
-		/// <throws>  IOException if there is a low-level IO error </throws>
-        /// <deprecated> Use <see cref="Open(Directory, bool)" /> instead.
-		/// This method will be removed in the 3.0 release.
-		/// 
-		/// </deprecated>
-        [Obsolete("Use Open(Directory, bool) instead.This method will be removed in the 3.0 release.")]
-		public static IndexReader Open(System.IO.FileInfo path)
-		{
-			return Open(path, false);
-		}
-		
-		/// <summary>Returns an IndexReader reading the index in an
-		/// FSDirectory in the named path.  You should pass
-		/// readOnly=true, since it gives much better concurrent
-		/// performance, unless you intend to do write operations
-		/// (delete documents or change norms) with the reader.
-		/// </summary>
-		/// <throws>  CorruptIndexException if the index is corrupt </throws>
-		/// <throws>  IOException if there is a low-level IO error </throws>
-		/// <param name="path">the path to the index directory
-		/// </param>
-		/// <param name="readOnly">true if this should be a readOnly
-		/// reader
-		/// </param>
-        /// <deprecated> Use <see cref="Open(Directory, bool)" /> instead.
-		/// This method will be removed in the 3.0 release.
-		/// 
-		/// </deprecated>
-        [Obsolete("Use Open(Directory, bool) instead. This method will be removed in the 3.0 release.")]
-		public static IndexReader Open(System.IO.FileInfo path, bool readOnly)
-		{
-			Directory dir = FSDirectory.GetDirectory(path);
-			IndexReader r = null;
-			try
-			{
-				r = Open(dir, null, null, readOnly, DEFAULT_TERMS_INDEX_DIVISOR);
-			}
-			finally
-			{
-				if (r == null)
-					dir.Close();
-			}
-			return new DirectoryOwningReader(r);
-		}
-		
-		/// <summary>Returns a read/write IndexReader reading the index in
-		/// the given Directory.
-		/// </summary>
-		/// <param name="directory">the index directory
-		/// </param>
-		/// <throws>  CorruptIndexException if the index is corrupt </throws>
-		/// <throws>  IOException if there is a low-level IO error </throws>
-        /// <deprecated> Use <see cref="Open(Directory, bool)" /> instead
-		/// This method will be removed in the 3.0 release.
-		/// 
-		/// </deprecated>
+
+        /// <summary>Returns a IndexReader reading the index in the given
+        /// Directory, with ReadOnly=true
+        /// </summary>
+        /// <param name="directory">the index directory</param>
+        /// <exception cref="CorruptIndexException">CorruptIndexException if the index is corrupt</exception>
+        /// <exception cref="System.IO.IOException">IOException if there is a low-level IO error</exception>
         [Obsolete("Use Open(Directory, bool) instead. This method will be removed in the 3.0 release.")]
 		public static IndexReader Open(Directory directory)
 		{
-			return Open(directory, null, null, false, DEFAULT_TERMS_INDEX_DIVISOR);
+			return Open(directory, null, null, true, DEFAULT_TERMS_INDEX_DIVISOR);
 		}
 		
 		/// <summary>Returns an IndexReader reading the index in the given
@@ -370,34 +219,15 @@ namespace Lucene.Net.Index
 		/// intend to do write operations (delete documents or
 		/// change norms) with the reader.
 		/// </summary>
-		/// <param name="directory">the index directory
-		/// </param>
-		/// <param name="readOnly">true if no changes (deletions, norms) will be made with this IndexReader
-		/// </param>
-		/// <throws>  CorruptIndexException if the index is corrupt </throws>
-		/// <throws>  IOException if there is a low-level IO error </throws>
+		/// <param name="directory">the index directory</param>
+        /// <param name="readOnly">true if no changes (deletions, norms) will be made with this IndexReader</param>
+        /// <exception cref="CorruptIndexException">CorruptIndexException if the index is corrupt</exception>
+        /// <exception cref="System.IO.IOException">IOException if there is a low-level IO error</exception>
 		public static IndexReader Open(Directory directory, bool readOnly)
 		{
 			return Open(directory, null, null, readOnly, DEFAULT_TERMS_INDEX_DIVISOR);
 		}
 		
-		/// <summary>Expert: returns a read/write IndexReader reading the index in the given
-		/// <see cref="IndexCommit" />.
-		/// </summary>
-		/// <param name="commit">the commit point to open
-		/// </param>
-		/// <throws>  CorruptIndexException if the index is corrupt </throws>
-        /// <deprecated> Use <see cref="Open(IndexCommit, bool)" /> instead.
-		/// This method will be removed in the 3.0 release.
-		/// 
-		/// </deprecated>
-		/// <throws>  IOException if there is a low-level IO error </throws>
-        [Obsolete("Use Open(IndexCommit, bool) instead. This method will be removed in the 3.0 release.")]
-		public static IndexReader Open(IndexCommit commit)
-		{
-			return Open(commit.GetDirectory(), null, commit, false, DEFAULT_TERMS_INDEX_DIVISOR);
-		}
-		
 		/// <summary>Expert: returns an IndexReader reading the index in the given
 		/// <see cref="IndexCommit" />.  You should pass readOnly=true, since it
 		/// gives much better concurrent performance, unless you
@@ -415,27 +245,6 @@ namespace Lucene.Net.Index
 			return Open(commit.GetDirectory(), null, commit, readOnly, DEFAULT_TERMS_INDEX_DIVISOR);
 		}
 		
-		/// <summary>Expert: returns a read/write IndexReader reading the index in the given
-		/// Directory, with a custom <see cref="IndexDeletionPolicy" />.
-		/// </summary>
-		/// <param name="directory">the index directory
-		/// </param>
-		/// <param name="deletionPolicy">a custom deletion policy (only used
-		/// if you use this reader to perform deletes or to set
-		/// norms); see <see cref="IndexWriter" /> for details.
-		/// </param>
-        /// <deprecated> Use <see cref="Open(Directory, IndexDeletionPolicy, bool)" /> instead.
-		/// This method will be removed in the 3.0 release.
-		/// 
-		/// </deprecated>
-		/// <throws>  CorruptIndexException if the index is corrupt </throws>
-		/// <throws>  IOException if there is a low-level IO error </throws>
-        [Obsolete("Use Open(Directory, IndexDeletionPolicy, bool) instead. This method will be removed in the 3.0 release.")]
-		public static IndexReader Open(Directory directory, IndexDeletionPolicy deletionPolicy)
-		{
-			return Open(directory, deletionPolicy, null, false, DEFAULT_TERMS_INDEX_DIVISOR);
-		}
-		
 		/// <summary>Expert: returns an IndexReader reading the index in
 		/// the given Directory, with a custom <see cref="IndexDeletionPolicy" />
 		///.  You should pass readOnly=true,
@@ -491,30 +300,6 @@ namespace Lucene.Net.Index
 			return Open(directory, deletionPolicy, null, readOnly, termInfosIndexDivisor);
 		}
 		
-		/// <summary>Expert: returns a read/write IndexReader reading the index in the given
-		/// Directory, using a specific commit and with a custom
-		/// <see cref="IndexDeletionPolicy" />.
-		/// </summary>
-		/// <param name="commit">the specific <see cref="IndexCommit" /> to open;
-		/// see <see cref="IndexReader.ListCommits" /> to list all commits
-		/// in a directory
-		/// </param>
-		/// <param name="deletionPolicy">a custom deletion policy (only used
-		/// if you use this reader to perform deletes or to set
-		/// norms); see <see cref="IndexWriter" /> for details.
-		/// </param>
-        /// <deprecated> Use <see cref="Open(IndexCommit, IndexDeletionPolicy, bool)" /> instead.
-		/// This method will be removed in the 3.0 release.
-		/// 
-		/// </deprecated>
-		/// <throws>  CorruptIndexException if the index is corrupt </throws>
-		/// <throws>  IOException if there is a low-level IO error </throws>
-        [Obsolete("Use Open(IndexCommit, IndexDeletionPolicy, bool) instead. This method will be removed in the 3.0 release.")]
-		public static IndexReader Open(IndexCommit commit, IndexDeletionPolicy deletionPolicy)
-		{
-			return Open(commit.GetDirectory(), deletionPolicy, commit, false, DEFAULT_TERMS_INDEX_DIVISOR);
-		}
-		
 		/// <summary>Expert: returns an IndexReader reading the index in
 		/// the given Directory, using a specific commit and with
 		/// a custom <see cref="IndexDeletionPolicy" />.  You should pass
@@ -705,53 +490,7 @@ namespace Lucene.Net.Index
 		public virtual Directory Directory()
 		{
 			EnsureOpen();
-			if (null != directory)
-			{
-				return directory;
-			}
-			else
-			{
-				throw new System.NotSupportedException("This reader does not support this method.");
-			}
-		}
-		
-		/// <summary> Returns the time the index in the named directory was last modified.
-		/// Do not use this to check whether the reader is still up-to-date, use
-		/// <see cref="IsCurrent()" /> instead. 
-		/// </summary>
-		/// <throws>  CorruptIndexException if the index is corrupt </throws>
-		/// <throws>  IOException if there is a low-level IO error </throws>
-		/// <deprecated> Use <see cref="LastModified(Lucene.Net.Store.Directory)" /> instead.
-		/// This method will be removed in the 3.0 release.
-		/// </deprecated>
-        [Obsolete("Use LastModified(Directory) instead. This method will be removed in the 3.0 release.")]
-		public static long LastModified(System.String directory)
-		{
-			return LastModified(new System.IO.FileInfo(directory));
-		}
-		
-		/// <summary> Returns the time the index in the named directory was last modified. 
-		/// Do not use this to check whether the reader is still up-to-date, use
-		/// <see cref="IsCurrent()" /> instead. 
-		/// </summary>
-		/// <throws>  CorruptIndexException if the index is corrupt </throws>
-		/// <throws>  IOException if there is a low-level IO error </throws>
-		/// <deprecated> Use <see cref="LastModified(Lucene.Net.Store.Directory)" /> instead.
-		/// This method will be removed in the 3.0 release.
-		/// 
-		/// </deprecated>
-        [Obsolete("Use LastModified(Directory) instead. This method will be removed in the 3.0 release.")]
-		public static long LastModified(System.IO.FileInfo fileDirectory)
-		{
-			Directory dir = FSDirectory.GetDirectory(fileDirectory); // use new static method here
-			try
-			{
-				return LastModified(dir);
-			}
-			finally
-			{
-				dir.Close();
-			}
+            throw new NotSupportedException("This reader does not support this method.");
 		}
 		
 		/// <summary> Returns the time the index in the named directory was last modified. 
@@ -776,54 +515,6 @@ namespace Lucene.Net.Index
 		/// </returns>
 		/// <throws>  CorruptIndexException if the index is corrupt </throws>
 		/// <throws>  IOException if there is a low-level IO error </throws>
-		/// <deprecated> Use <see cref="GetCurrentVersion(Lucene.Net.Store.Directory)" /> instead.
-		/// This method will be removed in the 3.0 release.
-		/// </deprecated>
-        [Obsolete("Use GetCurrentVersion(Directory) instead. This method will be removed in the 3.0 release.")]
-		public static long GetCurrentVersion(System.String directory)
-		{
-			return GetCurrentVersion(new System.IO.FileInfo(directory));
-		}
-		
-		/// <summary> Reads version number from segments files. The version number is
-		/// initialized with a timestamp and then increased by one for each change of
-		/// the index.
-		/// 
-		/// </summary>
-		/// <param name="directory">where the index resides.
-		/// </param>
-		/// <returns> version number.
-		/// </returns>
-		/// <throws>  CorruptIndexException if the index is corrupt </throws>
-		/// <throws>  IOException if there is a low-level IO error </throws>
-		/// <deprecated> Use <see cref="GetCurrentVersion(Lucene.Net.Store.Directory)" /> instead.
-		/// This method will be removed in the 3.0 release.
-		/// </deprecated>
-        [Obsolete("Use GetCurrentVersion(Directory) instead. This method will be removed in the 3.0 release.")]
-		public static long GetCurrentVersion(System.IO.FileInfo directory)
-		{
-			Directory dir = FSDirectory.GetDirectory(directory);
-			try
-			{
-				return GetCurrentVersion(dir);
-			}
-			finally
-			{
-				dir.Close();
-			}
-		}
-		
-		/// <summary> Reads version number from segments files. The version number is
-		/// initialized with a timestamp and then increased by one for each change of
-		/// the index.
-		/// 
-		/// </summary>
-		/// <param name="directory">where the index resides.
-		/// </param>
-		/// <returns> version number.
-		/// </returns>
-		/// <throws>  CorruptIndexException if the index is corrupt </throws>
-		/// <throws>  IOException if there is a low-level IO error </throws>
 		public static long GetCurrentVersion(Directory directory)
 		{
 			return SegmentInfos.ReadCurrentVersion(directory);
@@ -894,41 +585,6 @@ namespace Lucene.Net.Index
 			throw new System.NotSupportedException("This reader does not support this method.");
 		}
 		
-		/// <summary><p/>For IndexReader implementations that use
-		/// TermInfosReader to read terms, this sets the
-		/// indexDivisor to subsample the number of indexed terms
-		/// loaded into memory.  This has the same effect as <see cref="IndexWriter.SetTermIndexInterval" />
-		/// except that setting
-		/// must be done at indexing time while this setting can be
-		/// set per reader.  When set to N, then one in every
-		/// N*termIndexInterval terms in the index is loaded into
-		/// memory.  By setting this to a value > 1 you can reduce
-		/// memory usage, at the expense of higher latency when
-		/// loading a TermInfo.  The default value is 1.<p/>
-		/// 
-		/// <b>NOTE:</b> you must call this before the term
-		/// index is loaded.  If the index is already loaded, 
-		/// an IllegalStateException is thrown.
-		/// </summary>
-		/// <throws>  IllegalStateException if the term index has already been loaded into memory </throws>
-		/// <deprecated> Please use <see cref="IndexReader.Open(Directory, IndexDeletionPolicy, bool, int)" /> to specify the required TermInfos index divisor instead.
-		/// </deprecated>
-        [Obsolete("Please use IndexReader.Open(Directory, IndexDeletionPolicy, bool, int) to specify the required TermInfos index divisor instead.")]
-		public virtual void  SetTermInfosIndexDivisor(int indexDivisor)
-		{
-			throw new System.NotSupportedException("Please pass termInfosIndexDivisor up-front when opening IndexReader");
-		}
-		
-		/// <summary><p/>For IndexReader implementations that use
-		/// TermInfosReader to read terms, this returns the
-		/// current indexDivisor as specified when the reader was
-		/// opened.
-		/// </summary>
-		public virtual int GetTermInfosIndexDivisor()
-		{
-			throw new System.NotSupportedException("This reader does not support this method.");
-		}
-		
 		/// <summary> Check whether any new changes have occurred to the index since this
 		/// reader was opened.
 		/// 
@@ -1036,55 +692,6 @@ namespace Lucene.Net.Index
 		
 		/// <summary> Returns <c>true</c> if an index exists at the specified directory.
 		/// If the directory does not exist or if there is no index in it.
-		/// <c>false</c> is returned.
-		/// </summary>
-		/// <param name="directory">the directory to check for an index
-		/// </param>
-		/// <returns> <c>true</c> if an index exists; <c>false</c> otherwise
-		/// </returns>
-		/// <deprecated> Use <see cref="IndexExists(Lucene.Net.Store.Directory)" /> instead
-		/// This method will be removed in the 3.0 release.
-		/// 
-		/// </deprecated>
-        [Obsolete("Use IndexExists(Directory) instead. This method will be removed in the 3.0 release.")]
-		public static bool IndexExists(System.String directory)
-		{
-			return IndexExists(new System.IO.FileInfo(directory));
-		}
-		
-		/// <summary> Returns <c>true</c> if an index exists at the specified directory.
-		/// If the directory does not exist or if there is no index in it.
-		/// </summary>
-		/// <param name="directory">the directory to check for an index
-		/// </param>
-		/// <returns> <c>true</c> if an index exists; <c>false</c> otherwise
-		/// </returns>
-		/// <deprecated> Use <see cref="IndexExists(Lucene.Net.Store.Directory)" /> instead.
-		/// This method will be removed in the 3.0 release.
-		/// 
-		/// </deprecated>
-        [Obsolete("Use IndexExists(Directory) instead. This method will be removed in the 3.0 release.")]
-		public static bool IndexExists(System.IO.FileInfo directory)
-		{
-            System.String[] list = null;
-            if (System.IO.Directory.Exists(directory.FullName))
-            {
-                System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(directory.FullName);
-                System.IO.FileInfo[] fi = di.GetFiles();
-                if (fi.Length > 0)
-                {
-                    list = new System.String[fi.Length];
-                    for (int i = 0; i < fi.Length; i++)
-                    {
-                        list[i] = fi[i].Name;
-                    }
-                }
-            }
-			return SegmentInfos.GetCurrentSegmentGeneration(list) != - 1;
-		}
-		
-		/// <summary> Returns <c>true</c> if an index exists at the specified directory.
-		/// If the directory does not exist or if there is no index in it.
 		/// </summary>
 		/// <param name="directory">the directory to check for an index
 		/// </param>
@@ -1515,46 +1122,37 @@ namespace Lucene.Net.Index
 		}
 		
 		/// <summary>Implements commit.</summary>
-        /// <deprecated> Please implement 
-        /// <see cref="DoCommit(System.Collections.Generic.IDictionary{string, string})"/>
-		/// instead. 
-		/// </deprecated>
-        [Obsolete("Please implement DoCommit(IDictionary<string, string>) instead")]
-		protected internal abstract void  DoCommit();
-		
-		/// <summary>Implements commit.  NOTE: subclasses should override
-		/// this.  In 3.0 this will become an abstract method. 
-		/// </summary>
-        protected internal virtual void DoCommit(System.Collections.Generic.IDictionary<string, string> commitUserData)
-		{
-			// Default impl discards commitUserData; all Lucene
-			// subclasses override this (do not discard it).
-			DoCommit();
-		}
-		
-		/// <summary> Closes files associated with this index.
-		/// Also saves any new deletions to disk.
-		/// No other methods should be called after this has been called.
-		/// </summary>
-		/// <throws>  IOException if there is a low-level IO error </throws>
-		public void  Close()
+	    protected internal abstract void DoCommit(System.Collections.Generic.IDictionary<string, string> commitUserData);
+
+        [Obsolete("Use Dispose() instead")]
+		public void Close()
 		{
-			lock (this)
-			{
-				if (!closed)
-				{
-					DecRef();
-					closed = true;
-				}
-			}
+		    Dispose();
 		}
 
-        /// <summary>
-        /// .NET
+        /// <summary> Closes files associated with this index.
+        /// Also saves any new deletions to disk.
+        /// No other methods should be called after this has been called.
         /// </summary>
+        /// <throws>  IOException if there is a low-level IO error </throws>
         public void Dispose()
         {
-            Close();
+            Dispose(true);
+        }
+
+        protected virtual void Dispose(bool disposing)
+        {
+            if (disposing)
+            {
+                lock (this)
+                {
+                    if (!closed)
+                    {
+                        DecRef();
+                        closed = true;
+                    }
+                }
+            }
         }
 		
 		/// <summary>Implements close. </summary>
@@ -1572,62 +1170,6 @@ namespace Lucene.Net.Index
 		/// </seealso>
 		public abstract System.Collections.Generic.ICollection<string> GetFieldNames(FieldOption fldOption);
 		
-		/// <summary> Returns <c>true</c> iff the index in the named directory is
-		/// currently locked.
-		/// </summary>
-		/// <param name="directory">the directory to check for a lock
-		/// </param>
-		/// <throws>  IOException if there is a low-level IO error </throws>
-		/// <deprecated> Please use <see cref="IndexWriter.IsLocked(Directory)" /> instead.
-		/// This method will be removed in the 3.0 release.
-		/// 
-		/// </deprecated>
-        [Obsolete("Please use IndexWriter.IsLocked(Directory) instead. This method will be removed in the 3.0 release.")]
-		public static bool IsLocked(Directory directory)
-		{
-			return directory.MakeLock(IndexWriter.WRITE_LOCK_NAME).IsLocked();
-		}
-		
-		/// <summary> Returns <c>true</c> iff the index in the named directory is
-		/// currently locked.
-		/// </summary>
-		/// <param name="directory">the directory to check for a lock
-		/// </param>
-		/// <throws>  IOException if there is a low-level IO error </throws>
-		/// <deprecated> Use <see cref="IsLocked(Store.Directory)" /> instead.
-		/// This method will be removed in the 3.0 release.
-		/// 
-		/// </deprecated>
-        [Obsolete("Use IsLocked(Directory) instead. This method will be removed in the 3.0 release.")]
-		public static bool IsLocked(System.String directory)
-		{
-			Directory dir = FSDirectory.GetDirectory(directory);
-			try
-			{
-				return IsLocked(dir);
-			}
-			finally
-			{
-				dir.Close();
-			}
-		}
-		
-		/// <summary> Forcibly unlocks the index in the named directory.
-		/// <p/>
-		/// Caution: this should only be used by failure recovery code,
-		/// when it is known that no other process nor thread is in fact
-		/// currently accessing this index.
-		/// </summary>
-		/// <deprecated> Please use <see cref="IndexWriter.Unlock(Directory)" /> instead.
-		/// This method will be removed in the 3.0 release.
-		/// 
-		/// </deprecated>
-        [Obsolete("Please use IndexWriter.Unlock(Directory) instead. This method will be removed in the 3.0 release.")]
-		public static void  Unlock(Directory directory)
-		{
-			directory.MakeLock(IndexWriter.WRITE_LOCK_NAME).Release();
-		}
-		
 		/// <summary> Expert: return the IndexCommit that this reader has
 		/// opened.  This method is only implemented by those
 		/// readers that correspond to a Directory with its own
@@ -1680,10 +1222,10 @@ namespace Lucene.Net.Index
 				System.IO.FileInfo file = new System.IO.FileInfo(filename);
 				System.String dirname = new System.IO.FileInfo(file.FullName).DirectoryName;
 				filename = file.Name;
-				dir = FSDirectory.Open(new System.IO.FileInfo(dirname));
+				dir = FSDirectory.Open(new System.IO.DirectoryInfo(dirname));
 				cfr = new CompoundFileReader(dir, filename);
 				
-				System.String[] files = cfr.List();
+				System.String[] files = cfr.ListAll();
 				System.Array.Sort(files); // sort the array of filename so that the output is more readable
 				
 				for (int i = 0; i < files.Length; ++i)
@@ -1741,14 +1283,14 @@ namespace Lucene.Net.Index
 		/// one commit point.  But if you're using a custom <see cref="IndexDeletionPolicy" />
 		/// then there could be many commits.
 		/// Once you have a given commit, you can open a reader on
-		/// it by calling <see cref="IndexReader.Open(IndexCommit)" />
+		/// it by calling <see cref="IndexReader.Open(IndexCommit,bool)" />
 		/// There must be at least one commit in
 		/// the Directory, else this method throws <see cref="System.IO.IOException" />.  
 		/// Note that if a commit is in
 		/// progress while this method is running, that commit
 		/// may or may not be returned array.  
 		/// </summary>
-		public static System.Collections.ICollection ListCommits(Directory dir)
+		public static System.Collections.Generic.ICollection<IndexCommit> ListCommits(Directory dir)
 		{
 			return DirectoryReader.ListCommits(dir);
 		}
@@ -1774,10 +1316,7 @@ namespace Lucene.Net.Index
 			return null;
 		}
 		
-		/// <summary>Expert    </summary>
-		/// <deprecated> 
-		/// </deprecated>
-        [Obsolete]
+		/// <summary>Expert</summary>
 		public virtual System.Object GetFieldCacheKey()
 		{
 			return this;
@@ -1809,34 +1348,17 @@ namespace Lucene.Net.Index
 		{
 			throw new System.NotSupportedException("this reader does not implement getUniqueTermCount()");
 		}
-		
-		/// <summary>Expert: Return the state of the flag that disables fakes norms in favor of representing the absence of field norms with null.</summary>
-		/// <returns> true if fake norms are disabled
-		/// </returns>
-		/// <deprecated> This currently defaults to false (to remain
-		/// back-compatible), but in 3.0 it will be hardwired to
-		/// true, meaning the norms() methods will return null for
-		/// fields that had disabled norms.
-		/// </deprecated>
-        [Obsolete("This currently defaults to false (to remain back-compatible), but in 3.0 it will be hardwired to true, meaning the norms() methods will return null for fields that had disabled norms.")]
-		public virtual bool GetDisableFakeNorms()
-		{
-			return disableFakeNorms;
-		}
-		
-		/// <summary>Expert: Set the state of the flag that disables fakes norms in favor of representing the absence of field norms with null.</summary>
-		/// <param name="disableFakeNorms">true to disable fake norms, false to preserve the legacy behavior
-		/// </param>
-		/// <deprecated> This currently defaults to false (to remain
-		/// back-compatible), but in 3.0 it will be hardwired to
-		/// true, meaning the norms() methods will return null for
-		/// fields that had disabled norms.
-		/// </deprecated>
-        [Obsolete("This currently defaults to false (to remain back-compatible), but in 3.0 it will be hardwired to true, meaning the norms() methods will return null for fields that had disabled norms.")]
-		public virtual void  SetDisableFakeNorms(bool disableFakeNorms)
-		{
-			this.disableFakeNorms = disableFakeNorms;
-		}
+
+        /// <summary>
+        /// For IndexReader implementations that use
+        /// TermInfosReader to read terms, this returns the
+        /// current indexDivisor as specified when the reader was
+        /// opened.
+        /// </summary>
+        public virtual int GetTermInfosIndexDivisor()
+        {
+            throw new NotSupportedException("This reader does not support this method.");
+        }
 
         public bool hasChanges_ForNUnit
         {



Mime
View raw message