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: r1199962 [12/14] - in /incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk: src/core/ src/core/Analysis/ src/core/Analysis/Standard/ src/core/Document/ src/core/Index/ src/core/QueryParser/ src/core/Search/ src/core/Search/Function/ src/co...
Date Wed, 09 Nov 2011 21:03:52 GMT
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Spans/SpanQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Spans/SpanQuery.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Spans/SpanQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Spans/SpanQuery.cs Wed Nov  9 21:03:47 2011
@@ -37,14 +37,6 @@ namespace Lucene.Net.Search.Spans
 		/// <summary>Returns the name of the field matched by this query.</summary>
 		public abstract System.String GetField();
 		
-		/// <summary>Returns a collection of all terms matched by this query.</summary>
-		/// <deprecated> use extractTerms instead
-		/// </deprecated>
-		/// <seealso cref="Query.ExtractTerms(System.Collections.Hashtable)">
-		/// </seealso>
-        [Obsolete("use ExtractTerms instead")]
-		public abstract System.Collections.ICollection GetTerms();
-		
 		public override Weight CreateWeight(Searcher searcher)
 		{
 			return new SpanWeight(this, searcher);

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Spans/SpanScorer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Spans/SpanScorer.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Spans/SpanScorer.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Spans/SpanScorer.cs Wed Nov  9 21:03:47 2011
@@ -33,10 +33,6 @@ namespace Lucene.Net.Search.Spans
 		protected internal byte[] norms;
 		protected internal float value_Renamed;
 		
-		/// <deprecated> not needed anymore 
-		/// </deprecated>
-        [Obsolete("not needed anymore ")]
-		protected internal bool firstTime = true;
 		protected internal bool more = true;
 		
 		protected internal int doc;
@@ -59,14 +55,6 @@ namespace Lucene.Net.Search.Spans
 			}
 		}
 		
-		/// <deprecated> use <see cref="NextDoc()" /> instead. 
-		/// </deprecated>
-        [Obsolete("use NextDoc() instead.")]
-		public override bool Next()
-		{
-			return NextDoc() != NO_MORE_DOCS;
-		}
-		
 		public override int NextDoc()
 		{
 			if (!SetFreqCurrentDoc())
@@ -76,14 +64,6 @@ namespace Lucene.Net.Search.Spans
 			return doc;
 		}
 		
-		/// <deprecated> use <see cref="Advance(int)" /> instead. 
-		/// </deprecated>
-        [Obsolete("use Advance(int) instead. ")]
-		public override bool SkipTo(int target)
-		{
-			return Advance(target) != NO_MORE_DOCS;
-		}
-		
 		public override int Advance(int target)
 		{
 			if (!more)
@@ -120,14 +100,6 @@ namespace Lucene.Net.Search.Spans
 			return true;
 		}
 		
-		/// <deprecated> use <see cref="DocID()" /> instead. 
-		/// </deprecated>
-        [Obsolete("use DocID() instead. ")]
-		public override int Doc()
-		{
-			return doc;
-		}
-		
 		public override int DocID()
 		{
 			return doc;
@@ -139,6 +111,10 @@ namespace Lucene.Net.Search.Spans
 			return norms == null?raw:raw * Similarity.DecodeNorm(norms[doc]); // normalize
 		}
 		
+        /// <summary>
+        /// This method is no longer an official member of <see cref="Scorer"/>
+        /// but it is needed by SpanWeight to build an explanation.
+        /// </summary>
 		public override Explanation Explain(int doc)
 		{
 			Explanation tfExplanation = new Explanation();

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Spans/SpanTermQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Spans/SpanTermQuery.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Spans/SpanTermQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Spans/SpanTermQuery.cs Wed Nov  9 21:03:47 2011
@@ -46,22 +46,10 @@ namespace Lucene.Net.Search.Spans
 		{
 			return term.Field();
 		}
-		
-		/// <summary>Returns a collection of all terms matched by this query.</summary>
-		/// <deprecated> use extractTerms instead
-		/// </deprecated>
-        /// <seealso cref="ExtractTerms(System.Collections.Hashtable)">
-		/// </seealso>
-        [Obsolete("use extractTerms instead")]
-		public override System.Collections.ICollection GetTerms()
-		{
-			System.Collections.ArrayList terms = new System.Collections.ArrayList();
-			terms.Add(term);
-			return terms;
-		}
-		public override void  ExtractTerms(System.Collections.Hashtable terms)
+
+		public override void  ExtractTerms(System.Collections.Generic.ISet<Term> terms)
 		{
-			SupportClass.CollectionsHelper.AddIfNotContains(terms, term);
+		    terms.Add(term);
 		}
 		
 		public override System.String ToString(System.String field)

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Spans/SpanWeight.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Spans/SpanWeight.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Spans/SpanWeight.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Spans/SpanWeight.cs Wed Nov  9 21:03:47 2011
@@ -16,7 +16,8 @@
  */
 
 using System;
-
+using System.Collections.Generic;
+using Lucene.Net.Index;
 using IndexReader = Lucene.Net.Index.IndexReader;
 using Lucene.Net.Search;
 using IDFExplanation = Lucene.Net.Search.Explanation.IDFExplanation;
@@ -33,8 +34,8 @@ namespace Lucene.Net.Search.Spans
 		protected internal float idf;
 		protected internal float queryNorm;
 		protected internal float queryWeight;
-		
-		protected internal System.Collections.Hashtable terms;
+
+        protected internal HashSet<Term> terms;
 		protected internal SpanQuery query;
 		private IDFExplanation idfExp;
 		
@@ -42,9 +43,11 @@ namespace Lucene.Net.Search.Spans
 		{
 			this.similarity = query.GetSimilarity(searcher);
 			this.query = query;
-			terms = new System.Collections.Hashtable();
+
+			terms = new HashSet<Term>();
 			query.ExtractTerms(terms);
-			idfExp = similarity.idfExplain(new System.Collections.ArrayList(terms.Values), searcher);
+
+			idfExp = similarity.idfExplain(terms, searcher);
 			idf = idfExp.GetIdf();
 		}
 		

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TermQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TermQuery.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TermQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TermQuery.cs Wed Nov  9 21:03:47 2011
@@ -130,9 +130,32 @@ namespace Lucene.Net.Search
 				System.String field = Enclosing_Instance.term.Field();
 				ComplexExplanation fieldExpl = new ComplexExplanation();
 				fieldExpl.SetDescription("fieldWeight(" + Enclosing_Instance.term + " in " + doc + "), product of:");
-				
-				Explanation tfExpl = Scorer(reader, true, false).Explain(doc);
-				fieldExpl.AddDetail(tfExpl);
+
+                Explanation tfExplanation = new Explanation();
+                int tf = 0;
+                TermDocs termDocs = reader.TermDocs(enclosingInstance.term);
+                if (termDocs != null)
+                {
+                    try
+                    {
+                        if (termDocs.SkipTo(doc) && termDocs.Doc() == doc)
+                        {
+                            tf = termDocs.Freq();
+                        }
+                    }
+                    finally
+                    {
+                        termDocs.Close();
+                    }
+                    tfExplanation.SetValue(similarity.Tf(tf));
+                    tfExplanation.SetDescription("tf(termFreq(" + enclosingInstance.term + ")=" + tf + ")");
+                }
+                else
+                {
+                    tfExplanation.SetValue(0.0f);
+                    tfExplanation.SetDescription("no matching term");
+                }
+                fieldExpl.AddDetail(tfExplanation);
 				fieldExpl.AddDetail(expl);
 				
 				Explanation fieldNormExpl = new Explanation();
@@ -141,9 +164,9 @@ namespace Lucene.Net.Search
 				fieldNormExpl.SetValue(fieldNorm);
 				fieldNormExpl.SetDescription("fieldNorm(field=" + field + ", doc=" + doc + ")");
 				fieldExpl.AddDetail(fieldNormExpl);
-				
-				fieldExpl.SetMatch(tfExpl.IsMatch());
-				fieldExpl.SetValue(tfExpl.GetValue() * expl.GetValue() * fieldNormExpl.GetValue());
+
+                fieldExpl.SetMatch(tfExplanation.IsMatch());
+                fieldExpl.SetValue(tfExplanation.GetValue() * expl.GetValue() * fieldNormExpl.GetValue());
 				
 				result.AddDetail(fieldExpl);
 				System.Boolean? tempAux = fieldExpl.GetMatch();
@@ -176,9 +199,9 @@ namespace Lucene.Net.Search
 			return new TermWeight(this, searcher);
 		}
 		
-		public override void  ExtractTerms(System.Collections.Hashtable terms)
+		public override void  ExtractTerms(System.Collections.Generic.ISet<Term> terms)
 		{
-			SupportClass.CollectionsHelper.AddIfNotContains(terms, GetTerm());
+		    terms.Add(GetTerm());
 		}
 		
 		/// <summary>Prints a user-readable version of this query. </summary>

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TermScorer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TermScorer.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TermScorer.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TermScorer.cs Wed Nov  9 21:03:47 2011
@@ -65,27 +65,11 @@ namespace Lucene.Net.Search
 				scoreCache[i] = GetSimilarity().Tf(i) * weightValue;
 		}
 		
-		/// <deprecated> use <see cref="Score(Collector)" /> instead. 
-		/// </deprecated>
-        [Obsolete("use Score(Collector) instead. ")]
-		public override void  Score(HitCollector hc)
-		{
-			Score(new HitCollectorWrapper(hc));
-		}
-		
 		public override void  Score(Collector c)
 		{
 			Score(c, System.Int32.MaxValue, NextDoc());
 		}
 		
-		/// <deprecated> use <see cref="Score(Collector, int, int)" /> instead. 
-		/// </deprecated>
-        [Obsolete("use Score(Collector, int, int) instead.")]
-		protected internal override bool Score(HitCollector c, int end)
-		{
-			return Score(new HitCollectorWrapper(c), end, doc);
-		}
-		
 		// firstDocID is ignored since nextDoc() sets 'doc'
 		public /*protected internal*/ override bool Score(Collector c, int end, int firstDocID)
 		{
@@ -114,14 +98,6 @@ namespace Lucene.Net.Search
 			return true;
 		}
 		
-		/// <deprecated> use <see cref="DocID()" /> instead. 
-		/// </deprecated>
-        [Obsolete("use DocID() instead. ")]
-		public override int Doc()
-		{
-			return doc;
-		}
-		
 		public override int DocID()
 		{
 			return doc;
@@ -132,21 +108,6 @@ namespace Lucene.Net.Search
 		/// <see cref="TermDocs.Read(int[],int[])" />.
 		/// 
 		/// </summary>
-		/// <returns> true iff there is another document matching the query.
-		/// </returns>
-		/// <deprecated> use <see cref="NextDoc()" /> instead.
-		/// </deprecated>
-        [Obsolete("use NextDoc() instead.")]
-		public override bool Next()
-		{
-			return NextDoc() != NO_MORE_DOCS;
-		}
-		
-		/// <summary> Advances to the next document matching the query. <br/>
-		/// The iterator over the matching documents is buffered using
-		/// <see cref="TermDocs.Read(int[],int[])" />.
-		/// 
-		/// </summary>
 		/// <returns> the document matching the query or -1 if there are no more documents.
 		/// </returns>
 		public override int NextDoc()
@@ -178,23 +139,6 @@ namespace Lucene.Net.Search
 			return norms == null?raw:raw * SIM_NORM_DECODER[norms[doc] & 0xFF]; // normalize for field
 		}
 		
-		/// <summary> Skips to the first match beyond the current whose document number is
-		/// greater than or equal to a given target. <br/>
-		/// The implementation uses <see cref="TermDocs.SkipTo(int)" />.
-		/// 
-		/// </summary>
-		/// <param name="target">The target document number.
-		/// </param>
-		/// <returns> true iff there is such a match.
-		/// </returns>
-		/// <deprecated> use <see cref="Advance(int)" /> instead.
-		/// </deprecated>
-        [Obsolete("use Advance(int) instead.")]
-		public override bool SkipTo(int target)
-		{
-			return Advance(target) != NO_MORE_DOCS;
-		}
-		
 		/// <summary> Advances to the first match beyond the current whose document number is
 		/// greater than or equal to a given target. <br/>
 		/// The implementation uses <see cref="TermDocs.SkipTo(int)" />.
@@ -231,40 +175,6 @@ namespace Lucene.Net.Search
 			return doc;
 		}
 		
-		/// <summary>Returns an explanation of the score for a document.
-		/// <br/>When this method is used, the <see cref="Next()" /> method
-		/// and the <see cref="Score(HitCollector)" /> method should not be used.
-		/// </summary>
-		/// <param name="doc">The document number for the explanation.
-		/// </param>
-		public override Explanation Explain(int doc)
-		{
-			TermQuery query = (TermQuery) weight.GetQuery();
-			Explanation tfExplanation = new Explanation();
-			int tf = 0;
-			while (pointer < pointerMax)
-			{
-				if (docs[pointer] == doc)
-					tf = freqs[pointer];
-				pointer++;
-			}
-			if (tf == 0)
-			{
-				if (termDocs.SkipTo(doc))
-				{
-					if (termDocs.Doc() == doc)
-					{
-						tf = termDocs.Freq();
-					}
-				}
-			}
-			termDocs.Close();
-			tfExplanation.SetValue(GetSimilarity().Tf(tf));
-			tfExplanation.SetDescription("tf(termFreq(" + query.GetTerm() + ")=" + tf + ")");
-			
-			return tfExplanation;
-		}
-		
 		/// <summary>Returns a string representation of this <c>TermScorer</c>. </summary>
 		public override System.String ToString()
 		{

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TopDocsCollector.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TopDocsCollector.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TopDocsCollector.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TopDocsCollector.cs Wed Nov  9 21:03:47 2011
@@ -16,20 +16,19 @@
  */
 
 using System;
-
-using PriorityQueue = Lucene.Net.Util.PriorityQueue;
+using Lucene.Net.Util;
 
 namespace Lucene.Net.Search
 {
 	
 	/// <summary> A base class for all collectors that return a <see cref="Lucene.Net.Search.TopDocs" /> output. This
 	/// collector allows easy extension by providing a single constructor which
-	/// accepts a <see cref="PriorityQueue" /> as well as protected members for that
+	/// accepts a <see cref="PriorityQueue{T}" /> as well as protected members for that
 	/// priority queue and a counter of the number of total hits.<br/>
 	/// Extending classes can override <see cref="TopDocs(int, int)" /> and
 	/// <see cref="GetTotalHits()" /> in order to provide their own implementation.
 	/// </summary>
-	public abstract class TopDocsCollector:Collector
+	public abstract class TopDocsCollector<T> : Collector where T : ScoreDoc
 	{
 		
 		// This is used in case topDocs() is called with illegal parameters, or there
@@ -41,12 +40,12 @@ namespace Lucene.Net.Search
 		/// HitQueue for example aggregates the top scoring documents, while other PQ
 		/// implementations may hold documents sorted by other criteria.
 		/// </summary>
-		protected internal PriorityQueue pq;
+		protected internal PriorityQueue<T> pq;
 		
 		/// <summary>The total number of documents that the collector encountered. </summary>
 		protected internal int totalHits;
 		
-		protected internal TopDocsCollector(PriorityQueue pq)
+		protected internal TopDocsCollector(PriorityQueue<T> pq)
 		{
 			this.pq = pq;
 		}
@@ -58,7 +57,7 @@ namespace Lucene.Net.Search
 		{
 			for (int i = howMany - 1; i >= 0; i--)
 			{
-				results[i] = (ScoreDoc) pq.Pop();
+				results[i] = pq.Pop();
 			}
 		}
 

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TopFieldCollector.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TopFieldCollector.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TopFieldCollector.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TopFieldCollector.cs Wed Nov  9 21:03:47 2011
@@ -16,9 +16,8 @@
  */
 
 using System;
-
+using Lucene.Net.Util;
 using IndexReader = Lucene.Net.Index.IndexReader;
-using PriorityQueue = Lucene.Net.Util.PriorityQueue;
 using Entry = Lucene.Net.Search.FieldValueHitQueue.Entry;
 
 namespace Lucene.Net.Search
@@ -33,21 +32,19 @@ namespace Lucene.Net.Search
 	/// <p/><b>NOTE:</b> This API is experimental and might change in
 	/// incompatible ways in the next release.<p/>
 	/// </summary>
-	public abstract class TopFieldCollector:TopDocsCollector
+	public abstract class TopFieldCollector : TopDocsCollector<Entry>
 	{
-		
 		// TODO: one optimization we could do is to pre-fill
 		// the queue with sentinel value that guaranteed to
 		// always compare lower than a real hit; this would
 		// save having to check queueFull on each insert
 		
-		/*
-		* Implements a TopFieldCollector over one SortField criteria, without
-		* tracking document scores and maxScore.
-		*/
-		private class OneComparatorNonScoringCollector:TopFieldCollector
+		//
+		// Implements a TopFieldCollector over one SortField criteria, without
+		// tracking document scores and maxScore.
+		//
+		private class OneComparatorNonScoringCollector : TopFieldCollector
 		{
-			
 			internal FieldComparator comparator;
 			internal int reverseMul;
 			
@@ -57,14 +54,14 @@ namespace Lucene.Net.Search
 				reverseMul = queue.GetReverseMul()[0];
 			}
 			
-			internal void  UpdateBottom(int doc)
+			internal void UpdateBottom(int doc)
 			{
 				// bottom.score is already set to Float.NaN in add().
-				bottom.docID = docBase + doc;
-				bottom = (Entry) pq.UpdateTop();
+				bottom.doc = docBase + doc;
+				bottom = pq.UpdateTop();
 			}
 			
-			public override void  Collect(int doc)
+			public override void Collect(int doc)
 			{
 				++totalHits;
 				if (queueFull)
@@ -96,23 +93,23 @@ namespace Lucene.Net.Search
 				}
 			}
 			
-			public override void  SetNextReader(IndexReader reader, int docBase)
+			public override void SetNextReader(IndexReader reader, int docBase)
 			{
 				this.docBase = docBase;
 				comparator.SetNextReader(reader, docBase);
 			}
 			
-			public override void  SetScorer(Scorer scorer)
+			public override void SetScorer(Scorer scorer)
 			{
 				comparator.SetScorer(scorer);
 			}
 		}
 		
-		/*
-		* Implements a TopFieldCollector over one SortField criteria, without
-		* tracking document scores and maxScore, and assumes out of orderness in doc
-		* Ids collection.
-		*/
+		//
+		// Implements a TopFieldCollector over one SortField criteria, without
+		// tracking document scores and maxScore, and assumes out of orderness in doc
+		// Ids collection.
+		//
 		private class OutOfOrderOneComparatorNonScoringCollector:OneComparatorNonScoringCollector
 		{
 			
@@ -120,14 +117,14 @@ namespace Lucene.Net.Search
 			{
 			}
 			
-			public override void  Collect(int doc)
+			public override void Collect(int doc)
 			{
 				++totalHits;
 				if (queueFull)
 				{
 					// Fastmatch: return if this hit is not competitive
 					int cmp = reverseMul * comparator.CompareBottom(doc);
-					if (cmp < 0 || (cmp == 0 && doc + docBase > bottom.docID))
+					if (cmp < 0 || (cmp == 0 && doc + docBase > bottom.doc))
 					{
 						return ;
 					}
@@ -161,7 +158,7 @@ namespace Lucene.Net.Search
 		* Implements a TopFieldCollector over one SortField criteria, while tracking
 		* document scores but no maxScore.
 		*/
-		private class OneComparatorScoringNoMaxScoreCollector:OneComparatorNonScoringCollector
+		private class OneComparatorScoringNoMaxScoreCollector : OneComparatorNonScoringCollector
 		{
 			
 			internal Scorer scorer;
@@ -170,14 +167,14 @@ namespace Lucene.Net.Search
 			{
 			}
 			
-			internal void  updateBottom(int doc, float score)
+			internal void UpdateBottom(int doc, float score)
 			{
-				bottom.docID = docBase + doc;
+				bottom.doc = docBase + doc;
 				bottom.score = score;
-				bottom = (Entry) pq.UpdateTop();
+				bottom = pq.UpdateTop();
 			}
 			
-			public override void  Collect(int doc)
+			public override void Collect(int doc)
 			{
 				++totalHits;
 				if (queueFull)
@@ -195,7 +192,7 @@ namespace Lucene.Net.Search
 					
 					// This hit is competitive - replace bottom element in queue & adjustTop
 					comparator.Copy(bottom.slot, doc);
-					updateBottom(doc, score);
+					UpdateBottom(doc, score);
 					comparator.SetBottom(bottom.slot);
 				}
 				else
@@ -227,7 +224,7 @@ namespace Lucene.Net.Search
 		* document scores but no maxScore, and assumes out of orderness in doc Ids
 		* collection.
 		*/
-		private class OutOfOrderOneComparatorScoringNoMaxScoreCollector:OneComparatorScoringNoMaxScoreCollector
+		private class OutOfOrderOneComparatorScoringNoMaxScoreCollector : OneComparatorScoringNoMaxScoreCollector
 		{
 			
 			public OutOfOrderOneComparatorScoringNoMaxScoreCollector(FieldValueHitQueue queue, int numHits, bool fillFields):base(queue, numHits, fillFields)
@@ -241,7 +238,7 @@ namespace Lucene.Net.Search
 				{
 					// Fastmatch: return if this hit is not competitive
 					int cmp = reverseMul * comparator.CompareBottom(doc);
-					if (cmp < 0 || (cmp == 0 && doc + docBase > bottom.docID))
+					if (cmp < 0 || (cmp == 0 && doc + docBase > bottom.doc))
 					{
 						return ;
 					}
@@ -251,7 +248,7 @@ namespace Lucene.Net.Search
 					
 					// This hit is competitive - replace bottom element in queue & adjustTop
 					comparator.Copy(bottom.slot, doc);
-					updateBottom(doc, score);
+					UpdateBottom(doc, score);
 					comparator.SetBottom(bottom.slot);
 				}
 				else
@@ -277,10 +274,10 @@ namespace Lucene.Net.Search
 			}
 		}
 		
-		/*
-		* Implements a TopFieldCollector over one SortField criteria, with tracking
-		* document scores and maxScore.
-		*/
+		//
+		// Implements a TopFieldCollector over one SortField criteria, with tracking
+		// document scores and maxScore.
+		//
 		private class OneComparatorScoringMaxScoreCollector:OneComparatorNonScoringCollector
 		{
 			
@@ -294,9 +291,9 @@ namespace Lucene.Net.Search
 			
 			internal void  UpdateBottom(int doc, float score)
 			{
-				bottom.docID = docBase + doc;
+				bottom.doc = docBase + doc;
 				bottom.score = score;
-				bottom = (Entry) pq.UpdateTop();
+				bottom = pq.UpdateTop();
 			}
 			
 			public override void  Collect(int doc)
@@ -343,12 +340,12 @@ namespace Lucene.Net.Search
 			}
 		}
 		
-		/*
-		* Implements a TopFieldCollector over one SortField criteria, with tracking
-		* document scores and maxScore, and assumes out of orderness in doc Ids
-		* collection.
-		*/
-		private class OutOfOrderOneComparatorScoringMaxScoreCollector:OneComparatorScoringMaxScoreCollector
+		//
+		// Implements a TopFieldCollector over one SortField criteria, with tracking
+		// document scores and maxScore, and assumes out of orderness in doc Ids
+		// collection.
+		//
+		private class OutOfOrderOneComparatorScoringMaxScoreCollector : OneComparatorScoringMaxScoreCollector
 		{
 			
 			public OutOfOrderOneComparatorScoringMaxScoreCollector(FieldValueHitQueue queue, int numHits, bool fillFields):base(queue, numHits, fillFields)
@@ -367,7 +364,7 @@ namespace Lucene.Net.Search
 				{
 					// Fastmatch: return if this hit is not competitive
 					int cmp = reverseMul * comparator.CompareBottom(doc);
-					if (cmp < 0 || (cmp == 0 && doc + docBase > bottom.docID))
+					if (cmp < 0 || (cmp == 0 && doc + docBase > bottom.doc))
 					{
 						return ;
 					}
@@ -403,7 +400,6 @@ namespace Lucene.Net.Search
 		*/
 		private class MultiComparatorNonScoringCollector:TopFieldCollector
 		{
-			
 			internal FieldComparator[] comparators;
 			internal int[] reverseMul;
 			
@@ -416,8 +412,8 @@ namespace Lucene.Net.Search
 			internal void  UpdateBottom(int doc)
 			{
 				// bottom.score is already set to Float.NaN in add().
-				bottom.docID = docBase + doc;
-				bottom = (Entry) pq.UpdateTop();
+				bottom.doc = docBase + doc;
+				bottom = pq.UpdateTop();
 			}
 			
 			public override void  Collect(int doc)
@@ -534,7 +530,7 @@ namespace Lucene.Net.Search
 						else if (i == comparators.Length - 1)
 						{
 							// This is the equals case.
-							if (doc + docBase > bottom.docID)
+							if (doc + docBase > bottom.doc)
 							{
 								// Definitely not competitive
 								return ;
@@ -586,7 +582,7 @@ namespace Lucene.Net.Search
 		* Implements a TopFieldCollector over multiple SortField criteria, with
 		* tracking document scores and maxScore.
 		*/
-		private class MultiComparatorScoringMaxScoreCollector:MultiComparatorNonScoringCollector
+		private class MultiComparatorScoringMaxScoreCollector : MultiComparatorNonScoringCollector
 		{
 			
 			internal Scorer scorer;
@@ -599,9 +595,9 @@ namespace Lucene.Net.Search
 			
 			internal void  UpdateBottom(int doc, float score)
 			{
-				bottom.docID = docBase + doc;
+				bottom.doc = docBase + doc;
 				bottom.score = score;
-				bottom = (Entry) pq.UpdateTop();
+				bottom = pq.UpdateTop();
 			}
 			
 			public override void  Collect(int doc)
@@ -716,7 +712,7 @@ namespace Lucene.Net.Search
 						else if (i == comparators.Length - 1)
 						{
 							// This is the equals case.
-							if (doc + docBase > bottom.docID)
+							if (doc + docBase > bottom.doc)
 							{
 								// Definitely not competitive
 								return ;
@@ -779,9 +775,9 @@ namespace Lucene.Net.Search
 			
 			internal void  UpdateBottom(int doc, float score)
 			{
-				bottom.docID = docBase + doc;
+				bottom.doc = docBase + doc;
 				bottom.score = score;
-				bottom = (Entry) pq.UpdateTop();
+				bottom = pq.UpdateTop();
 			}
 			
 			public override void  Collect(int doc)
@@ -891,7 +887,7 @@ namespace Lucene.Net.Search
 						else if (i == comparators.Length - 1)
 						{
 							// This is the equals case.
-							if (doc + docBase > bottom.docID)
+							if (doc + docBase > bottom.doc)
 							{
 								// Definitely not competitive
 								return ;
@@ -970,7 +966,8 @@ namespace Lucene.Net.Search
 		// internal versions. If someone will define a constructor with any other
 		// visibility, then anyone will be able to extend the class, which is not what
 		// we want.
-		private TopFieldCollector(PriorityQueue pq, int numHits, bool fillFields):base(pq)
+		private TopFieldCollector(PriorityQueue<Entry> pq, int numHits, bool fillFields)
+            : base(pq)
 		{
 			this.numHits = numHits;
 			this.fillFields = fillFields;
@@ -1089,7 +1086,7 @@ namespace Lucene.Net.Search
 		
 		internal void  Add(int slot, int doc, float score)
 		{
-			bottom = (Entry) pq.Add(new Entry(slot, docBase + doc, score));
+			bottom = pq.Add(new Entry(slot, docBase + doc, score));
 			queueFull = totalHits == numHits;
 		}
 		
@@ -1106,15 +1103,15 @@ namespace Lucene.Net.Search
 				FieldValueHitQueue queue = (FieldValueHitQueue) pq;
 				for (int i = howMany - 1; i >= 0; i--)
 				{
-					results[i] = queue.FillFields((Entry) queue.Pop());
+					results[i] = queue.FillFields(queue.Pop());
 				}
 			}
 			else
 			{
 				for (int i = howMany - 1; i >= 0; i--)
 				{
-					Entry entry = (Entry) pq.Pop();
-					results[i] = new FieldDoc(entry.docID, entry.score);
+					Entry entry = pq.Pop();
+					results[i] = new FieldDoc(entry.doc, entry.score);
 				}
 			}
 		}

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TopScoreDocCollector.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TopScoreDocCollector.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TopScoreDocCollector.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TopScoreDocCollector.cs Wed Nov  9 21:03:47 2011
@@ -34,7 +34,7 @@ namespace Lucene.Net.Search
     /// collector will not properly collect hits with such
     /// scores.
 	/// </summary>
-	public abstract class TopScoreDocCollector:TopDocsCollector
+	public abstract class TopScoreDocCollector : TopDocsCollector<ScoreDoc>
 	{
 		
 		// Assumes docs are scored in order.
@@ -62,7 +62,7 @@ namespace Lucene.Net.Search
 				}
 				pqTop.doc = doc + docBase;
 				pqTop.score = score;
-				pqTop = (ScoreDoc) pq.UpdateTop();
+				pqTop = pq.UpdateTop();
 			}
 			
 			public override bool AcceptsDocsOutOfOrder()
@@ -93,7 +93,7 @@ namespace Lucene.Net.Search
 				}
 				pqTop.doc = doc;
 				pqTop.score = score;
-				pqTop = (ScoreDoc) pq.UpdateTop();
+				pqTop = pq.UpdateTop();
 			}
 			
 			public override bool AcceptsDocsOutOfOrder()
@@ -133,7 +133,7 @@ namespace Lucene.Net.Search
 		{
 			// HitQueue implements getSentinelObject to return a ScoreDoc, so we know
 			// that at this point top() is already initialized.
-			pqTop = (ScoreDoc) pq.Top();
+			pqTop = pq.Top();
 		}
 		
 		public /*protected internal*/ override TopDocs NewTopDocs(ScoreDoc[] results, int start)
@@ -158,7 +158,7 @@ namespace Lucene.Net.Search
 				{
 					pq.Pop();
 				}
-				maxScore = ((ScoreDoc) pq.Pop()).score;
+				maxScore = pq.Pop().score;
 			}
 			
 			return new TopDocs(totalHits, results, maxScore);

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/WildcardQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/WildcardQuery.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/WildcardQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/WildcardQuery.cs Wed Nov  9 21:03:47 2011
@@ -39,35 +39,55 @@ namespace Lucene.Net.Search
 	/// <seealso cref="WildcardTermEnum">
 	/// </seealso>
 	[Serializable]
-	public class WildcardQuery:MultiTermQuery
+	public class WildcardQuery : MultiTermQuery
 	{
 		private bool termContainsWildcard;
+	    private bool termIsPrefix;
 		new protected internal Term term;
 		
-		public WildcardQuery(Term term):base(term)
-		{ //will be removed in 3.0
+		public WildcardQuery(Term term)
+		{ 
 			this.term = term;
-			this.termContainsWildcard = (term.Text().IndexOf('*') != - 1) || (term.Text().IndexOf('?') != - 1);
+		    string text = term.Text();
+		    this.termContainsWildcard = (term.Text().IndexOf('*') != -1)
+		                                || (term.Text().IndexOf('?') != -1);
+		    this.termIsPrefix = termContainsWildcard
+		                        && (text.IndexOf('?') == -1)
+		                        && (text.IndexOf('*') == text.Length - 1);
 		}
 		
 		public /*protected internal*/ override FilteredTermEnum GetEnum(IndexReader reader)
 		{
-			return new WildcardTermEnum(reader, GetTerm());
+            if (termContainsWildcard)
+            {
+                return new WildcardTermEnum(reader, GetTerm());
+            }
+            else
+            {
+                return new SingleTermEnum(reader, GetTerm());
+            }
 		}
 		
 		/// <summary> Returns the pattern term.</summary>
-        [Obsolete("Lucene.Net-2.9.1. This method overrides obsolete member Lucene.Net.Search.MultiTermQuery.GetTerm()")]
-		public override Term GetTerm()
+		public Term GetTerm()
 		{
 			return term;
 		}
 		
 		public override Query Rewrite(IndexReader reader)
 		{
-			if (!termContainsWildcard)
-				return new TermQuery(GetTerm());
-			else
-				return base.Rewrite(reader);
+            if (termIsPrefix)
+            {
+                MultiTermQuery rewritten =
+                    new PrefixQuery(term.CreateTerm(term.text.Substring(0, term.text.IndexOf('*'))));
+                rewritten.SetBoost(GetBoost());
+                rewritten.SetRewriteMethod(GetRewriteMethod());
+                return rewritten;
+            }
+            else
+            {
+                return base.Rewrite(reader);
+            }
 		}
 		
 		/// <summary>Prints a user-readable version of this query. </summary>

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/CheckSumIndexInput.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/CheckSumIndexInput.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/CheckSumIndexInput.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/CheckSumIndexInput.cs Wed Nov  9 21:03:47 2011
@@ -72,12 +72,5 @@ namespace Lucene.Net.Store
 		{
 			return main.Length();
 		}
-
-        /*
-		override public System.Object Clone()
-		{
-			return null;
-		}
-        */
 	}
 }
\ No newline at end of file

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/Directory.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/Directory.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/Directory.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/Directory.cs Wed Nov  9 21:03:47 2011
@@ -48,30 +48,10 @@ namespace Lucene.Net.Store
 		/// </summary>
 		[NonSerialized]
 		protected internal LockFactory lockFactory;
-		
-		/// <deprecated> For some Directory implementations (<see cref="FSDirectory" />
-		///, and its subclasses), this method
-		/// silently filters its results to include only index
-		/// files.  Please use <see cref="ListAll" /> instead, which
-		/// does no filtering. 
-		/// </deprecated>
-        [Obsolete("For some Directory implementations (FSDirectory}, and its subclasses), this method silently filters its results to include only index files.  Please use ListAll instead, which does no filtering. ")]
-		public abstract System.String[] List();
-		
-		/// <summary>Returns an array of strings, one for each file in the
-		/// directory.  Unlike <see cref="List" /> this method does no
-		/// filtering of the contents in a directory, and it will
-		/// never return null (throws IOException instead).
-		/// 
-		/// Currently this method simply fallsback to <see cref="List" />
-		/// for Directory impls outside of Lucene's core &amp;
-		/// contrib, but in 3.0 that method will be removed and
-		/// this method will become abstract. 
-		/// </summary>
-		public virtual System.String[] ListAll()
-		{
-			return List();
-		}
+
+	    /// <summary>Returns an array of strings, one for each file in the directory.</summary>
+	    /// <exception cref="System.IO.IOException"></exception>
+	    public abstract System.String[] ListAll();
 		
 		/// <summary>Returns true iff a file with the given name exists. </summary>
 		public abstract bool FileExists(System.String name);
@@ -85,15 +65,6 @@ namespace Lucene.Net.Store
 		/// <summary>Removes an existing file in the directory. </summary>
 		public abstract void  DeleteFile(System.String name);
 		
-		/// <summary>Renames an existing file in the directory.
-		/// If a file already exists with the new name, then it is replaced.
-		/// This replacement is not guaranteed to be atomic.
-		/// </summary>
-		/// <deprecated> 
-		/// </deprecated>
-        [Obsolete]
-		public abstract void  RenameFile(System.String from, System.String to);
-		
 		/// <summary>Returns the length of a file in the directory. </summary>
 		public abstract long FileLength(System.String name);
 		
@@ -164,6 +135,7 @@ namespace Lucene.Net.Store
 		/// </param>
 		public virtual void  SetLockFactory(LockFactory lockFactory)
 		{
+		    System.Diagnostics.Debug.Assert(this.lockFactory != null);
 			this.lockFactory = lockFactory;
 			lockFactory.SetLockPrefix(this.GetLockID());
 		}

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/FSDirectory.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/FSDirectory.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/FSDirectory.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/FSDirectory.cs Wed Nov  9 21:03:47 2011
@@ -98,333 +98,23 @@ namespace Lucene.Net.Store
 	/// <p/>The locking implementation is by default <see cref="NativeFSLockFactory" />
 	///, but can be changed by
 	/// passing in a custom <see cref="LockFactory" /> instance.
-	/// The deprecated <c>getDirectory</c> methods default to use
-	/// <see cref="SimpleFSLockFactory" /> for backwards compatibility.
-	/// The system properties 
-	/// <c>org.apache.lucene.store.FSDirectoryLockFactoryClass</c>
-	/// and <c>org.apache.lucene.FSDirectory.class</c>
-	/// are deprecated and only used by the deprecated
-	/// <c>getDirectory</c> methods. The system property
-	/// <c>org.apache.lucene.lockDir</c> is ignored completely,
-	/// If you really want to store locks
-	/// elsewhere, you can create your own <see cref="SimpleFSLockFactory" />
-	/// (or <see cref="NativeFSLockFactory" />,
-	/// etc.) passing in your preferred lock directory.
-	/// 
-	/// <p/><em>In 3.0 this class will become abstract.</em>
-	/// 
 	/// </summary>
-	/// <seealso cref="Directory">
-	/// </seealso>
-	// TODO: in 3.0 this will become an abstract base class
-	public class FSDirectory:Directory
+	public abstract class FSDirectory : Directory
 	{
-		
-		/// <summary>This cache of directories ensures that there is a unique Directory
-		/// instance per path, so that synchronization on the Directory can be used to
-		/// synchronize access between readers and writers.  We use
-		/// refcounts to ensure when the last use of an FSDirectory
-		/// instance for a given canonical path is closed, we remove the
-		/// instance from the cache.  See LUCENE-776
-		/// for some relevant discussion.
-		/// </summary>
-		/// <deprecated> Not used by any non-deprecated methods anymore
-		/// </deprecated>
-        [Obsolete("Not used by any non-deprecated methods anymore")]
-        private static readonly Dictionary<string, FSDirectory> DIRECTORIES = new Dictionary<string, FSDirectory>();
-		
-		private static bool disableLocks = false;
-		
-		// TODO: should this move up to the Directory base class?  Also: should we
-		// make a per-instance (in addition to the static "default") version?
-		
-		/// <summary> Set whether Lucene's use of lock files is disabled. By default, 
-		/// lock files are enabled. They should only be disabled if the index
-		/// is on a read-only medium like a CD-ROM.
-		/// </summary>
-        /// <deprecated> Use a <see cref="Open(System.IO.DirectoryInfo, LockFactory)" /> or a constructor
-		/// that takes a <see cref="LockFactory" /> and supply
-		/// <see cref="NoLockFactory.GetNoLockFactory" />. This setting does not work
-        /// with <see cref="Open(System.IO.DirectoryInfo)" /> only the deprecated <c>getDirectory</c>
-		/// respect this setting.   
-		/// </deprecated>
-        [Obsolete("Use a Open(System.IO.DirectoryInfo, LockFactory) or a constructor that takes a LockFactory and supply NoLockFactory.GetNoLockFactory. This setting does not work with Open(File) only the deprecated GetDirectory respect this setting.")]
-		public static void  SetDisableLocks(bool doDisableLocks)
-		{
-			FSDirectory.disableLocks = doDisableLocks;
-		}
-		
-		/// <summary> Returns whether Lucene's use of lock files is disabled.</summary>
-		/// <returns> true if locks are disabled, false if locks are enabled.
-		/// </returns>
-		/// <seealso cref="SetDisableLocks">
-		/// </seealso>
-		/// <deprecated> Use a constructor that takes a <see cref="LockFactory" /> and
-		/// supply <see cref="NoLockFactory.GetNoLockFactory" />.
-		/// </deprecated>
-        [Obsolete("Use a constructor that takes a LockFactory and supply NoLockFactory.GetNoLockFactory.")]
-		public static bool GetDisableLocks()
-		{
-			return FSDirectory.disableLocks;
-		}
-		
-        ///// <summary> Directory specified by <c>org.apache.lucene.lockDir</c>
-        ///// or <c>java.io.tmpdir</c> system property.
-        ///// </summary>
-        ///// <deprecated> As of 2.1, <c>LOCK_DIR</c> is unused
-        ///// because the write.lock is now stored by default in the
-        ///// index directory.  If you really want to store locks
-        ///// elsewhere, you can create your own <see cref="// SimpleFSLockFactory" />
-        ///// (or <see cref="NativeFSLockFactory" />,
-        ///// etc.) passing in your preferred lock directory.  Then,
-        ///// pass this <c>LockFactory</c> instance to one of
-        ///// the <c>open</c> methods that take a
-        ///// <c>lockFactory</c> (for example, <see cref="Open(System.IO.DirectoryInfo, LockFactory)" />).
-        ///// </deprecated>
-        //[Obsolete("As of 2.1, LOCK_DIR is unused because the write.lock is now stored by default in the index directory. ")]
-		//public static readonly System.String LOCK_DIR = SupportClass.AppSettings.Get("Lucene.Net.lockDir", System.IO.Path.GetTempPath());
-		
-		/// <summary>The default class which implements filesystem-based directories. </summary>
-		// deprecated
-        [Obsolete]
-        private static readonly System.Type IMPL = typeof(Lucene.Net.Store.SimpleFSDirectory);
-		
 		private static System.Security.Cryptography.HashAlgorithm DIGESTER;
-		
-		/// <summary>A buffer optionally used in renameTo method </summary>
-		private byte[] buffer = null;
-		
-		
-		/// <summary>Returns the directory instance for the named location.
-		/// 
-		/// </summary>
-        /// <deprecated> Use <see cref="Open(System.IO.DirectoryInfo)" />
-		/// 
-		/// </deprecated>
-		/// <param name="path">the path to the directory.
-		/// </param>
-		/// <returns> the FSDirectory for the named file.  
-		/// </returns>
-        [Obsolete("Use Open(System.IO.DirectoryInfo)")]
-		public static FSDirectory GetDirectory(System.String path)
-		{
-			return GetDirectory(new System.IO.DirectoryInfo(path), null);
-		}
-		
-		/// <summary>Returns the directory instance for the named location.
-		/// 
-		/// </summary>
-        /// <deprecated> Use <see cref="Open(System.IO.DirectoryInfo, LockFactory)" />
-		/// 
-		/// </deprecated>
-		/// <param name="path">the path to the directory.
-		/// </param>
-		/// <param name="lockFactory">instance of <see cref="LockFactory" /> providing the
-		/// locking implementation.
-		/// </param>
-		/// <returns> the FSDirectory for the named file.  
-		/// </returns>
-        [Obsolete("Use Open(File, LockFactory)")]
-		public static FSDirectory GetDirectory(System.String path, LockFactory lockFactory)
-		{
-			return GetDirectory(new System.IO.DirectoryInfo(path), lockFactory);
-		}
-		
-		/// <summary>Returns the directory instance for the named location.
-		/// 
-		/// </summary>
-        /// <deprecated> Use <see cref="Open(System.IO.DirectoryInfo)" />
-		/// 
-		/// </deprecated>
-		/// <param name="file">the path to the directory.
-		/// </param>
-		/// <returns> the FSDirectory for the named file.  
-		/// </returns>
-        [Obsolete("Use Open(File)")]
-		public static FSDirectory GetDirectory(System.IO.DirectoryInfo file)
-		{
-			return GetDirectory(file, null);
-		}
-
-        /// <summary>Returns the directory instance for the named location.
-        /// 
-        /// </summary>
-        /// <deprecated> Use <see cref="Open(System.IO.DirectoryInfo)" />
-        /// 
-        /// </deprecated>
-        /// <param name="file">the path to the directory.
-        /// </param>
-        /// <returns> the FSDirectory for the named file.  
-        /// </returns>
-        [System.Obsolete("Use the constructor that takes a DirectoryInfo, this will be removed in the 3.0 release")]
-        public static FSDirectory GetDirectory(System.IO.FileInfo file)
-        {
-            return GetDirectory(new System.IO.DirectoryInfo(file.FullName), null);
-        }
-		
-		/// <summary>Returns the directory instance for the named location.
-		/// 
-		/// </summary>
-        /// <deprecated> Use <see cref="Open(System.IO.DirectoryInfo, LockFactory)" />
-		/// 
-		/// </deprecated>
-		/// <param name="file">the path to the directory.
-		/// </param>
-		/// <param name="lockFactory">instance of <see cref="LockFactory" /> providing the
-		/// locking implementation.
-		/// </param>
-		/// <returns> the FSDirectory for the named file.  
-		/// </returns>
-		[System.Obsolete("Use the constructor that takes a DirectoryInfo, this will be removed in the 3.0 release")]
-		public static FSDirectory GetDirectory(System.IO.FileInfo file, LockFactory lockFactory)
-		{
-            return GetDirectory(new System.IO.DirectoryInfo(file.FullName), lockFactory);
-		}
 
-        /// <summary>Returns the directory instance for the named location.
-        /// 
-        /// </summary>
-        /// <deprecated> Use <see cref="Open(System.IO.DirectoryInfo, LockFactory)" />
-        /// 
-        /// </deprecated>
-        /// <param name="file">the path to the directory.
-        /// </param>
-        /// <param name="lockFactory">instance of <see cref="LockFactory" /> providing the
-        /// locking implementation.
-        /// </param>
-        /// <returns> the FSDirectory for the named file.  
-        /// </returns>
-        [Obsolete("Use Open(File, LockFactory)")]
-        public static FSDirectory GetDirectory(System.IO.DirectoryInfo file, LockFactory lockFactory)
+        static FSDirectory()
         {
-            FSDirectory dir;
-            lock (DIRECTORIES)
+            try
             {
-                if(!DIRECTORIES.TryGetValue(file.FullName, out dir))
-                {
-                    try
-                    {
-                        dir = (FSDirectory)System.Activator.CreateInstance(IMPL, true);
-                    }
-                    catch (System.Exception e)
-                    {
-                        throw new System.SystemException("cannot load FSDirectory class: " + e.ToString(), e);
-                    }
-                    dir.Init(file, lockFactory);
-                    DIRECTORIES.Add(file.FullName, dir);
-                }
-                else
-                {
-                    // Catch the case where a Directory is pulled from the cache, but has a
-                    // different LockFactory instance.
-                    if (lockFactory != null && lockFactory != dir.GetLockFactory())
-                    {
-                        throw new System.IO.IOException("Directory was previously created with a different LockFactory instance; please pass null as the lockFactory instance and use setLockFactory to change it");
-                    }
-                    dir.checked_Renamed = false;
-                }
+                DIGESTER = SupportClass.Cryptography.GetHashAlgorithm();
             }
-            lock (dir)
+            catch (System.Exception e)
             {
-                dir.refCount++;
+                throw new System.SystemException(e.ToString(), e);
             }
-            return dir;
         }
 		
-		
-		/// <summary>Returns the directory instance for the named location.
-		/// 
-		/// </summary>
-		/// <deprecated> Use IndexWriter's create flag, instead, to
-		/// create a new index.
-		/// 
-		/// </deprecated>
-		/// <param name="path">the path to the directory.
-		/// </param>
-		/// <param name="create">if true, create, or erase any existing contents.
-		/// </param>
-		/// <returns> the FSDirectory for the named file.  
-		/// </returns>
-        [Obsolete("Use IndexWriter's create flag, instead, to create a new index.")]
-		public static FSDirectory GetDirectory(System.String path, bool create)
-		{
-			return GetDirectory(new System.IO.DirectoryInfo(path), create);
-		}
-		
-		/// <summary>Returns the directory instance for the named location.
-		/// 
-		/// </summary>
-		/// <deprecated> Use IndexWriter's create flag, instead, to
-		/// create a new index.
-		/// 
-		/// </deprecated>
-		/// <param name="file">the path to the directory.
-		/// </param>
-		/// <param name="create">if true, create, or erase any existing contents.
-		/// </param>
-		/// <returns> the FSDirectory for the named file.  
-		/// </returns>
-		[System.Obsolete("Use the method that takes a DirectoryInfo, this will be removed in the 3.0 release")]
-		public static FSDirectory GetDirectory(System.IO.FileInfo file, bool create)
-		{
-			return GetDirectory(new System.IO.DirectoryInfo(file.FullName), create);
-		}
-
-        /// <summary>Returns the directory instance for the named location.
-        /// 
-        /// </summary>
-        /// <deprecated> Use IndexWriter's create flag, instead, to
-        /// create a new index.
-        /// 
-        /// </deprecated>
-        /// <param name="file">the path to the directory.
-        /// </param>
-        /// <param name="create">if true, create, or erase any existing contents.
-        /// </param>
-        /// <returns> the FSDirectory for the named file.  
-        /// </returns>
-        [Obsolete("Use IndexWriter's create flag, instead, to create a new index.")]
-        public static FSDirectory GetDirectory(System.IO.DirectoryInfo file, bool create)
-        {
-            FSDirectory dir = GetDirectory(file, null);
-
-            // This is now deprecated (creation should only be done
-            // by IndexWriter):
-            if (create)
-            {
-                dir.Create();
-            }
-
-            return dir;
-        }
-		
-		/// <deprecated> 
-		/// </deprecated>
-        [Obsolete]
-		private void  Create()
-		{
-			if (directory.Exists)
- 			{
- 				System.String[] files = SupportClass.FileSupport.GetLuceneIndexFiles(directory.FullName, IndexFileNameFilter.GetFilter()); // clear old files
- 				if (files == null)
- 					throw new System.IO.IOException("cannot read directory " + directory.FullName + ": list() returned null");
- 				for (int i = 0; i < files.Length; i++)
- 				{
-                    System.String fileOrDir = System.IO.Path.Combine(directory.FullName, files[i]);
-                    if (System.IO.File.Exists(fileOrDir))
- 					{
-                        System.IO.File.Delete(fileOrDir);
- 					}
-                    else if (System.IO.Directory.Exists(fileOrDir))
- 					{
-                        System.IO.Directory.Delete(fileOrDir);
- 					}
-                    // no need to throw anything - if a delete fails the exc will propogate to the caller
- 				}
- 			}
- 			lockFactory.ClearLock(IndexWriter.WRITE_LOCK_NAME);
-		}
-		
 		private bool checked_Renamed;
 		
 		internal void  CreateDir()
@@ -472,19 +162,6 @@ namespace Lucene.Net.Store
 		/// <summary>The underlying filesystem directory </summary>
 		protected internal System.IO.DirectoryInfo directory = null;
 		
-		/// <deprecated> 
-		/// </deprecated>
-        [Obsolete]
-		private int refCount = 0;
-		
-		/// <deprecated> 
-		/// </deprecated>
-        [Obsolete]
-		protected internal FSDirectory()
-		{
-		}
-		 // permit subclassing
-		
 		/// <summary>Create a new FSDirectory for the named location (ctor for subclasses).</summary>
 		/// <param name="path">the path of the directory
 		/// </param>
@@ -499,38 +176,37 @@ namespace Lucene.Net.Store
 			{
 				lockFactory = new NativeFSLockFactory();
 			}
-			Init(path, lockFactory);
-			refCount = 1;
-		}
-		
-		/// <summary>Creates an FSDirectory instance, trying to pick the
-		/// best implementation given the current environment.
-		/// The directory returned uses the <see cref="NativeFSLockFactory" />.
-        /// 
-        /// <p/>Currently this returns <see cref="SimpleFSDirectory" /> as
-        /// NIOFSDirectory is currently not supported.
-		/// 
-		/// <p/>Currently this returns <see cref="SimpleFSDirectory" /> as
-		/// NIOFSDirectory is currently not supported.
-		/// 
-		/// <p/><b>NOTE</b>: this method may suddenly change which
-		/// implementation is returned from release to release, in
-		/// the event that higher performance defaults become
-		/// possible; if the precise implementation is important to
-		/// your application, please instantiate it directly,
-		/// instead. On 64 bit systems, it may also good to
-		/// return <see cref="MMapDirectory" />, but this is disabled
-		/// because of officially missing unmap support in Java.
-		/// For optimal performance you should consider using
-		/// this implementation on 64 bit JVMs.
-		/// 
-		/// <p/>See <a href="#subclasses">above</a> 
-		/// </summary>
-		[System.Obsolete("Use the method that takes a DirectoryInfo, this will be removed in the 3.0 release")]
-		public static FSDirectory Open(System.IO.FileInfo path)
-		{
-			System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(path.FullName);
-			return Open(dir, null);
+            // Set up lockFactory with cascaded defaults: if an instance was passed in,
+            // use that; else if locks are disabled, use NoLockFactory; else if the
+            // system property Lucene.Net.Store.FSDirectoryLockFactoryClass is set,
+            // instantiate that; else, use SimpleFSLockFactory:
+
+            directory = path;
+
+            // due to differences in how Java & .NET refer to files, the checks are a bit different
+            if (!directory.Exists && System.IO.File.Exists(directory.FullName))
+            {
+                throw new NoSuchDirectoryException("file '" + directory.FullName + "' exists but is not a directory");
+            }
+            SetLockFactory(lockFactory);
+            
+            // for filesystem based LockFactory, delete the lockPrefix, if the locks are placed
+            // in index dir. If no index dir is given, set ourselves
+            if (lockFactory is FSLockFactory)
+            {
+                FSLockFactory lf = (FSLockFactory)lockFactory;
+                System.IO.DirectoryInfo dir = lf.GetLockDir();
+                // if the lock factory has no lockDir set, use the this directory as lockDir
+                if (dir == null)
+                {
+                    lf.SetLockDir(this.directory);
+                    lf.SetLockPrefix(null);
+                }
+                else if (dir.FullName.Equals(this.directory.FullName))
+                {
+                    lf.SetLockPrefix(null);
+                }
+            }
 		}
 		
 		/// <summary>Creates an FSDirectory instance, trying to pick the
@@ -581,111 +257,6 @@ namespace Lucene.Net.Store
 			}
         }
 		
-		/* will move to ctor, when reflection is removed in 3.0 */
-		private void  Init(System.IO.DirectoryInfo path, LockFactory lockFactory)
-		{
-			
-			// Set up lockFactory with cascaded defaults: if an instance was passed in,
-			// use that; else if locks are disabled, use NoLockFactory; else if the
-			// system property Lucene.Net.Store.FSDirectoryLockFactoryClass is set,
-			// instantiate that; else, use SimpleFSLockFactory:
-			
-			directory = path;
-			
-            // due to differences in how Java & .NET refer to files, the checks are a bit different
-            if (!directory.Exists && System.IO.File.Exists(directory.FullName))
-            {
-                throw new NoSuchDirectoryException("file '" + directory.FullName + "' exists but is not a directory");
-            }
-			
-			if (lockFactory == null)
-			{
-				
-				if (disableLocks)
-				{
-					// Locks are disabled:
-					lockFactory = NoLockFactory.GetNoLockFactory();
-				}
-				else
-				{
-					System.String lockClassName = SupportClass.AppSettings.Get("Lucene.Net.Store.FSDirectoryLockFactoryClass", "");
-					
-					if (lockClassName != null && !lockClassName.Equals(""))
-					{
-						System.Type c;
-						
-						try
-						{
-							c = System.Type.GetType(lockClassName);
-						}
-						catch (System.Exception e)
-						{
-							throw new System.IO.IOException("unable to find LockClass " + lockClassName);
-						}
-						
-						try
-						{
-							lockFactory = (LockFactory) System.Activator.CreateInstance(c, true);
-						}
-						catch (System.UnauthorizedAccessException e)
-						{
-							throw new System.IO.IOException("IllegalAccessException when instantiating LockClass " + lockClassName);
-						}
-						catch (System.InvalidCastException e)
-						{
-							throw new System.IO.IOException("unable to cast LockClass " + lockClassName + " instance to a LockFactory");
-						}
-						catch (System.Exception e)
-						{
-							throw new System.IO.IOException("InstantiationException when instantiating LockClass " + lockClassName);
-						}
-					}
-					else
-					{
-						// Our default lock is SimpleFSLockFactory;
-						// default lockDir is our index directory:
-						lockFactory = new SimpleFSLockFactory();
-					}
-				}
-			}
-			
-			SetLockFactory(lockFactory);
-			
-			// for filesystem based LockFactory, delete the lockPrefix, if the locks are placed
-			// in index dir. If no index dir is given, set ourselves
-			if (lockFactory is FSLockFactory)
-			{
-				FSLockFactory lf = (FSLockFactory) lockFactory;
-				System.IO.DirectoryInfo dir = lf.GetLockDir();
-				// if the lock factory has no lockDir set, use the this directory as lockDir
-				if (dir == null)
-				{
-					lf.SetLockDir(this.directory);
-					lf.SetLockPrefix(null);
-				}
-				else if (dir.FullName.Equals(this.directory.FullName))
-				{
-					lf.SetLockPrefix(null);
-				}
-			}
-		}
-		
-		/// <summary>Lists all files (not subdirectories) in the
-		/// directory.  This method never returns null (throws
-		/// <see cref="System.IO.IOException" /> instead).
-		/// 
-		/// </summary>
-		/// <throws>  NoSuchDirectoryException if the directory </throws>
-		/// <summary>   does not exist, or does exist but is not a
-		/// directory.
-		/// </summary>
-		/// <throws>  IOException if list() returns null  </throws>
-		[System.Obsolete("Use the method that takes a DirectoryInfo, this will be removed in the 3.0 release")]
-		public static System.String[] ListAll(System.IO.FileInfo dir)
-		{
-			return ListAll(new System.IO.DirectoryInfo(dir.FullName));
-		}
-		
         /// <summary>Lists all files (not subdirectories) in the
         /// directory.  This method never returns null (throws
         /// <see cref="System.IO.IOException" /> instead).
@@ -702,6 +273,11 @@ namespace Lucene.Net.Store
             {
                 throw new NoSuchDirectoryException("directory '" + dir.FullName + "' does not exist");
             }
+            else if (System.IO.File.Exists(dir.FullName))
+            {
+                throw new NoSuchDirectoryException("File '" + dir.FullName + "' does not exist");
+            }
+
             // Exclude subdirs, only the file names, not the paths
             System.IO.FileInfo[] files = dir.GetFiles();
             System.String[] result = new System.String[files.Length];
@@ -717,13 +293,6 @@ namespace Lucene.Net.Store
             return result;
         }
 		
-        [Obsolete("Lucene.Net-2.9.1. This method overrides obsolete member Lucene.Net.Store.Directory.List()")]
-		public override System.String[] List()
-		{
-			EnsureOpen();
-			return SupportClass.FileSupport.GetLuceneIndexFiles(directory.FullName, IndexFileNameFilter.GetFilter());
-		}
-		
 		/// <summary>Lists all files (not subdirectories) in the
 		/// directory.
 		/// </summary>
@@ -789,39 +358,6 @@ namespace Lucene.Net.Store
             }
 		}
 		
-		/// <summary>Renames an existing file in the directory. 
-		/// Warning: This is not atomic.
-		/// </summary>
-		/// <deprecated> 
-		/// </deprecated>
-        [Obsolete]
-		public override void  RenameFile(System.String from, System.String to)
-		{
-			lock (this)
-			{
-				EnsureOpen();
-                System.IO.FileInfo old = new System.IO.FileInfo(System.IO.Path.Combine(directory.FullName, from));
-                try
-                {
-                    old.MoveTo(System.IO.Path.Combine(directory.FullName, to));
-                }
-                catch (System.IO.IOException ioe)
-                {
-                    System.IO.IOException newExc = new System.IO.IOException("Cannot rename " + old + " to " + directory, ioe);
-                    throw newExc;
-                }
-			}
-		}
-		
-		/// <summary>Creates an IndexOutput for the file with the given name.
-		/// <em>In 3.0 this method will become abstract.</em> 
-		/// </summary>
-		public override IndexOutput CreateOutput(System.String name)
-		{
-			InitOutput(name);
-			return new FSIndexOutput(new System.IO.FileInfo(System.IO.Path.Combine(directory.FullName, name)));
-		}
-		
 		public override void  Sync(System.String name)
 		{
 			EnsureOpen();
@@ -860,6 +396,7 @@ namespace Lucene.Net.Store
 					{
 						// In 3.0 we will change this to throw
 						// InterruptedException instead
+                        // TODO: Change this to throwing a new ThreadInterruptedException when class is build
 						SupportClass.ThreadClass.Current().Interrupt();
                         throw new System.SystemException(ie.ToString(), ie);
 					}
@@ -877,15 +414,6 @@ namespace Lucene.Net.Store
 			return OpenInput(name, BufferedIndexInput.BUFFER_SIZE);
 		}
 		
-		/// <summary>Creates an IndexInput for the file with the given name.
-		/// <em>In 3.0 this method will become abstract.</em> 
-		/// </summary>
-		public override IndexInput OpenInput(System.String name, int bufferSize)
-		{
-			EnsureOpen();
-			return new FSIndexInput(new System.IO.FileInfo(System.IO.Path.Combine(directory.FullName, name)), bufferSize);
-		}
-		
 		/// <summary> So we can do some byte-to-hexchar conversion below</summary>
 		private static readonly char[] HEX_DIGITS = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
 		
@@ -925,14 +453,7 @@ namespace Lucene.Net.Store
 		{
 			lock (this)
 			{
-				if (isOpen && --refCount <= 0)
-				{
-					isOpen = false;
-					lock (DIRECTORIES)
-					{
-						DIRECTORIES.Remove(directory.FullName);
-					}
-				}
+			    isOpen = false;
 			}
 		}
 
@@ -944,14 +465,6 @@ namespace Lucene.Net.Store
             Close();
         }
 
-        [System.Obsolete("A DirectoryInfo is more appropriate, however this is here for backwards compatibility. This will be removed in the 3.0 release")]
-		public virtual System.IO.FileInfo GetFile()
-		{
-			EnsureOpen();
-			return new System.IO.FileInfo(directory.FullName);
-		}
-
-
         // Java Lucene implements GetFile() which returns a FileInfo.
         // For Lucene.Net, GetDirectory() is more appropriate
         public virtual System.IO.DirectoryInfo GetDirectory()
@@ -1021,91 +534,5 @@ namespace Lucene.Net.Store
 			// LUCENE-1566
 			return chunkSize;
 		}
-		
-		
-		/// <deprecated> Use SimpleFSDirectory.SimpleFSIndexInput instead 
-		/// </deprecated>
-        [Obsolete("Use SimpleFSDirectory.SimpleFSIndexInput instead ")]
-		public /*protected internal*/ class FSIndexInput:SimpleFSDirectory.SimpleFSIndexInput
-		{
-			
-			/// <deprecated> 
-			/// </deprecated>
-            [Obsolete]
-			new protected internal class Descriptor:SimpleFSDirectory.SimpleFSIndexInput.Descriptor
-			{
-				/// <deprecated> 
-				/// </deprecated>
-                [Obsolete]
-				public Descriptor(/*FSIndexInput enclosingInstance,*/ System.IO.FileInfo file, System.IO.FileAccess mode) : base(file, mode)
-				{
-				}
-			}
-			
-			/// <deprecated> 
-			/// </deprecated>
-            [Obsolete]
-			public FSIndexInput(System.IO.FileInfo path):base(path)
-			{
-			}
-			
-			/// <deprecated> 
-			/// </deprecated>
-            [Obsolete]
-			public FSIndexInput(System.IO.FileInfo path, int bufferSize):base(path, bufferSize)
-			{
-			}
-		}
-		
-		/// <deprecated> Use SimpleFSDirectory.SimpleFSIndexOutput instead 
-		/// </deprecated>
-        [Obsolete("Use SimpleFSDirectory.SimpleFSIndexOutput instead ")]
-		protected internal class FSIndexOutput:SimpleFSDirectory.SimpleFSIndexOutput
-		{
-			
-			/// <deprecated> 
-			/// </deprecated>
-            [Obsolete]
-			public FSIndexOutput(System.IO.FileInfo path):base(path)
-			{
-			}
-		}
-		static FSDirectory()
-		{
-			{
-				try
-				{
-					System.String name = SupportClass.AppSettings.Get("Lucene.Net.FSDirectory.class", typeof(SimpleFSDirectory).FullName);
-					if (typeof(FSDirectory).FullName.Equals(name))
-					{
-						// FSDirectory will be abstract, so we replace it by the correct class
-						IMPL = typeof(SimpleFSDirectory);
-					}
-					else
-					{
-						IMPL = System.Type.GetType(name);
-					}
-				}
-				catch (System.Security.SecurityException se)
-				{
-					IMPL = typeof(SimpleFSDirectory);
-				}
-				catch (System.Exception e)
-				{
-					throw new System.SystemException("cannot load FSDirectory class: " + e.ToString(), e);
-				}
-			}
-			{
-				try
-				{
-					DIGESTER = SupportClass.Cryptography.GetHashAlgorithm();
-				}
-				catch (System.Exception e)
-				{
-					throw new System.SystemException(e.ToString(), e);
-				}
-			}
-			DEFAULT_READ_CHUNK_SIZE = Constants.JRE_IS_64BIT?System.Int32.MaxValue:100 * 1024 * 1024;
-		}
 	}
 }
\ No newline at end of file

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/FileSwitchDirectory.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/FileSwitchDirectory.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/FileSwitchDirectory.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/FileSwitchDirectory.cs Wed Nov  9 21:03:47 2011
@@ -36,10 +36,13 @@ namespace Lucene.Net.Store
 	{
 		private Directory secondaryDir;
 		private Directory primaryDir;
-		private System.Collections.Hashtable primaryExtensions;
+		private System.Collections.Generic.HashSet<string> primaryExtensions;
 		private bool doClose;
 		
-		public FileSwitchDirectory(System.Collections.Hashtable primaryExtensions, Directory primaryDir, Directory secondaryDir, bool doClose)
+		public FileSwitchDirectory(System.Collections.Generic.HashSet<string> primaryExtensions,
+                                    Directory primaryDir, 
+                                    Directory secondaryDir, 
+                                    bool doClose)
 		{
 			this.primaryExtensions = primaryExtensions;
 			this.primaryDir = primaryDir;
@@ -86,17 +89,11 @@ namespace Lucene.Net.Store
 		
 		public override System.String[] ListAll()
 		{
-            System.Collections.Generic.List<string> files = new System.Collections.Generic.List<string>();
+            var files = new System.Collections.Generic.List<string>();
             files.AddRange(primaryDir.ListAll());
             files.AddRange(secondaryDir.ListAll());
             return files.ToArray();
 		}
-
-        [Obsolete("Lucene.Net-2.9.1. This method overrides obsolete member Lucene.Net.Store.Directory.List()")]
-		public override System.String[] List()
-		{
-			return ListAll();
-		}
 		
 		/// <summary>Utility method to return a file's extension. </summary>
 		public static System.String GetExtension(System.String name)
@@ -141,12 +138,6 @@ namespace Lucene.Net.Store
 		{
 			GetDirectory(name).DeleteFile(name);
 		}
-
-        [Obsolete("Lucene.Net-2.9.1. This method overrides obsolete member Lucene.Net.Store.Directory.RenameFile(string, string)")]
-		public override void  RenameFile(System.String from, System.String to)
-		{
-			GetDirectory(from).RenameFile(from, to);
-		}
 		
 		public override long FileLength(System.String name)
 		{

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/IndexInput.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/IndexInput.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/IndexInput.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/IndexInput.cs Wed Nov  9 21:03:47 2011
@@ -25,7 +25,7 @@ namespace Lucene.Net.Store
 	/// </summary>
 	/// <seealso cref="Directory">
 	/// </seealso>
-	public abstract class IndexInput : System.ICloneable
+	public abstract class IndexInput : System.ICloneable/*, IDisposable*/
 	{
 		private bool preUTF8Strings; // true if we are reading old (modified UTF8) string format
 		
@@ -273,5 +273,7 @@ namespace Lucene.Net.Store
 			
 			return map;
 		}
+
+	    /*public abstract void Dispose();*/
 	}
 }
\ No newline at end of file

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/IndexOutput.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/IndexOutput.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/IndexOutput.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/IndexOutput.cs Wed Nov  9 21:03:47 2011
@@ -29,7 +29,7 @@ namespace Lucene.Net.Store
 	/// </seealso>
 	/// <seealso cref="IndexInput">
 	/// </seealso>
-	public abstract class IndexOutput
+    public abstract class IndexOutput /*: IDisposable*/
 	{
 		/// <summary>Writes a single byte.</summary>
 		/// <seealso cref="IndexInput.ReadByte()">
@@ -262,10 +262,10 @@ namespace Lucene.Net.Store
 			else
 			{
 				WriteInt(map.Count);
-                foreach (string key in map.Keys)
+                foreach (var entry in map)
                 {
-                    WriteString(key);
-                    WriteString(map[key]);
+                    WriteString(entry.Key);
+                    WriteString(entry.Value);
                 }
 			}
 		}

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/Lock.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/Lock.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/Lock.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/Lock.cs Wed Nov  9 21:03:47 2011
@@ -28,13 +28,8 @@ namespace Lucene.Net.Store
 	/// }
 	/// }.run();
     /// </code>
-	/// 
-	/// 
 	/// </summary>
-	/// <version>  $Id: Lock.java 769409 2009-04-28 14:05:43Z mikemccand $
-	/// </version>
-	/// <seealso cref="Directory.MakeLock(String)">
-	/// </seealso>
+	/// <seealso cref="Directory.MakeLock(String)" />
 	public abstract class Lock
 	{
 		
@@ -114,6 +109,7 @@ namespace Lucene.Net.Store
 				{
 					// In 3.0 we will change this to throw
 					// InterruptedException instead
+                    // TODO: Revisit rewriting in ThreadInterruptedException
 					SupportClass.ThreadClass.Current().Interrupt();
 					throw new System.IO.IOException(e.ToString());
 				}

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/MMapDirectory.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/MMapDirectory.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/MMapDirectory.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/MMapDirectory.cs Wed Nov  9 21:03:47 2011
@@ -154,15 +154,6 @@ namespace Lucene.Net.Store
             InitBlock();
         }
 		
-		// back compatibility so FSDirectory can instantiate via reflection
-		/// <deprecated> 
-		/// </deprecated>
-        [Obsolete]
-		internal MMapDirectory()
-		{
-			InitBlock();
-		}
-		
 		internal static readonly System.Type[] NO_PARAM_TYPES = new System.Type[0];
 		internal static readonly System.Object[] NO_PARAMS = new System.Object[0];
 		

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/NIOFSDirectory.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/NIOFSDirectory.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/NIOFSDirectory.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/NIOFSDirectory.cs Wed Nov  9 21:03:47 2011
@@ -23,13 +23,10 @@ namespace Lucene.Net.Store
     /// </summary>
     public class NIOFSDirectory : Lucene.Net.Store.FSDirectory
     {
-        public NIOFSDirectory()
+        public NIOFSDirectory(System.IO.DirectoryInfo dir, LockFactory lockFactory)
+            : base(dir, lockFactory)
         {
             throw new System.NotImplementedException("Waiting for volunteers to implement this class");
-
-        }
-        public NIOFSDirectory(System.IO.DirectoryInfo dir,LockFactory lockFactory)
-        {
         }
 
         /// <summary>
@@ -42,6 +39,11 @@ namespace Lucene.Net.Store
                 throw new System.NotImplementedException("Waiting for volunteers to implement this class");
             }
         }
+
+        public override IndexOutput CreateOutput(string name)
+        {
+            throw new System.NotImplementedException("Waiting for volunteers to implement this class");
+        }
     }
 }
 

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/NativeFSLockFactory.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/NativeFSLockFactory.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/NativeFSLockFactory.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/NativeFSLockFactory.cs Wed Nov  9 21:03:47 2011
@@ -16,6 +16,7 @@
  */
 
 using System;
+using System.Collections.Generic;
 
 namespace Lucene.Net.Store
 {
@@ -50,7 +51,7 @@ namespace Lucene.Net.Store
 	/// <seealso cref="LockFactory">
 	/// </seealso>
 	
-	public class NativeFSLockFactory:FSLockFactory
+	public class NativeFSLockFactory : FSLockFactory
 	{
 		/// <summary> Create a NativeFSLockFactory instance, with null (unset)
 		/// lock directory. When you pass this factory to a <see cref="FSDirectory" />
@@ -72,17 +73,6 @@ namespace Lucene.Net.Store
 		{
 		}
 		
-		/// <summary> Create a NativeFSLockFactory instance, storing lock
-		/// files into the specified lockDir:
-		/// 
-		/// </summary>
-		/// <param name="lockDir">where lock files are created.
-		/// </param>
-		[System.Obsolete("Use the constructor that takes a DirectoryInfo, this will be removed in the 3.0 release")]
-		public NativeFSLockFactory(System.IO.FileInfo lockDir) : this(new System.IO.DirectoryInfo(lockDir.FullName))
-		{
-		}
-		
         /// <summary> Create a NativeFSLockFactory instance, storing lock
         /// files into the specified lockDir:
         /// 
@@ -168,12 +158,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();
-
-		[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)
-		{
-		}
+        private static HashSet<string> LOCK_HELD = new HashSet<string>();
 		
         public NativeFSLock(System.IO.DirectoryInfo lockDir, System.String lockFileName)
         {

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/NoLockFactory.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/NoLockFactory.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/NoLockFactory.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/NoLockFactory.cs Wed Nov  9 21:03:47 2011
@@ -21,7 +21,6 @@ namespace Lucene.Net.Store
 {
 	
 	/// <summary> Use this <see cref="LockFactory" /> to disable locking entirely.
-	/// This LockFactory is used when you call <see cref="FSDirectory.SetDisableLocks" />.
 	/// Only one instance of this lock is created.  You should call <see cref="GetNoLockFactory()" />
 	/// to get the instance.
 	/// 

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/RAMDirectory.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/RAMDirectory.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/RAMDirectory.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/RAMDirectory.cs Wed Nov  9 21:03:47 2011
@@ -25,15 +25,13 @@ namespace Lucene.Net.Store
     /// but can be changed with <see cref="Directory.SetLockFactory"/>.
 	/// 
 	/// </summary>
-	/// <version>  $Id: RAMDirectory.java 781333 2009-06-03 10:38:57Z mikemccand $
-	/// </version>
 	[Serializable]
 	public class RAMDirectory:Directory
 	{
 		
 		private const long serialVersionUID = 1L;
-		
-		internal protected System.Collections.Hashtable fileMap = new System.Collections.Hashtable();
+
+        internal protected SupportClass.HashMap<string, RAMFile> fileMap = new SupportClass.HashMap<string, RAMFile>();
 		internal protected long sizeInBytes = 0;
 		
 		// *****
@@ -72,36 +70,6 @@ namespace Lucene.Net.Store
 			Directory.Copy(dir, this, closeDir);
 		}
 
-        /// <summary> Creates a new <c>RAMDirectory</c> instance from the <see cref="FSDirectory"/>.
-		/// 
-		/// </summary>
-		/// <param name="dir">a <c>File</c> specifying the index directory
-		/// 
-		/// </param>
-		/// <seealso cref="RAMDirectory(Directory)">
-		/// </seealso>
-        /// <deprecated> Use <see cref="RAMDirectory(Directory)"/> instead
-		/// </deprecated>
-        [Obsolete("Use RAMDirectory(Directory) instead")]
-		public RAMDirectory(System.IO.FileInfo dir):this(FSDirectory.GetDirectory(dir), true)
-		{
-		}
-
-        /// <summary> Creates a new <c>RAMDirectory</c> instance from the <see cref="FSDirectory"/>.
-		/// 
-		/// </summary>
-		/// <param name="dir">a <c>String</c> specifying the full index directory path
-		/// 
-		/// </param>
-		/// <seealso cref="RAMDirectory(Directory)">
-		/// </seealso>
-        /// <deprecated> Use <see cref="RAMDirectory(Directory)"/> instead
-		/// </deprecated>
-        [Obsolete("Use RAMDirectory(Directory) instead")]
-		public RAMDirectory(System.String dir):this(FSDirectory.GetDirectory(dir), true)
-		{
-		}
-
          //https://issues.apache.org/jira/browse/LUCENENET-174
         [System.Runtime.Serialization.OnDeserialized]
         void OnDeserialized(System.Runtime.Serialization.StreamingContext context)
@@ -111,28 +79,19 @@ namespace Lucene.Net.Store
                 SetLockFactory(new SingleInstanceLockFactory());
             }
         }
-
-        [Obsolete("Lucene.Net-2.9.1. This method overrides obsolete member Lucene.Net.Store.Directory.List()")]
-		public override System.String[] List()
-		{
-			lock (this)
-			{
-				return ListAll();
-			}
-		}
 		
 		public override System.String[] ListAll()
 		{
 			lock (this)
 			{
 				EnsureOpen();
-				System.Collections.ICollection fileNames = fileMap.Keys;
+                // TODO: may have better performance if our HashMap implmented KeySet() instead of generating one via HashSet
+				System.Collections.Generic.ISet<string> fileNames = new System.Collections.Generic.HashSet<string>(fileMap.Keys);
 				System.String[] result = new System.String[fileNames.Count];
 				int i = 0;
-				System.Collections.IEnumerator it = fileNames.GetEnumerator();
-				while (it.MoveNext())
+				foreach(string filename in fileNames)
 				{
-					result[i++] = ((System.String) it.Current);
+                    result[i++] = filename;
 				}
 				return result;
 			}
@@ -145,7 +104,7 @@ namespace Lucene.Net.Store
 			RAMFile file;
 			lock (this)
 			{
-				file = (RAMFile) fileMap[name];
+				file = fileMap[name];
 			}
 			return file != null;
 		}
@@ -158,7 +117,7 @@ namespace Lucene.Net.Store
 			RAMFile file;
 			lock (this)
 			{
-				file = (RAMFile) fileMap[name];
+				file = fileMap[name];
 			}
 			if (file == null)
 				throw new System.IO.FileNotFoundException(name);
@@ -173,7 +132,7 @@ namespace Lucene.Net.Store
 			RAMFile file;
 			lock (this)
 			{
-				file = (RAMFile) fileMap[name];
+				file = fileMap[name];
 			}
 			if (file == null)
 				throw new System.IO.FileNotFoundException(name);
@@ -207,7 +166,7 @@ namespace Lucene.Net.Store
 			RAMFile file;
 			lock (this)
 			{
-				file = (RAMFile) fileMap[name];
+				file = fileMap[name];
 			}
 			if (file == null)
 				throw new System.IO.FileNotFoundException(name);
@@ -234,7 +193,7 @@ namespace Lucene.Net.Store
 			lock (this)
 			{
 				EnsureOpen();
-				RAMFile file = (RAMFile) fileMap[name];
+				RAMFile file = fileMap[name];
 				if (file != null)
 				{
 					fileMap.Remove(name);
@@ -246,30 +205,6 @@ namespace Lucene.Net.Store
 			}
 		}
 		
-		/// <summary>Renames an existing file in the directory.</summary>
-		/// <throws>  FileNotFoundException if from does not exist </throws>
-		/// <deprecated>
-		/// </deprecated>
-        [Obsolete]
-		public override void  RenameFile(System.String from, System.String to)
-		{
-			lock (this)
-			{
-				EnsureOpen();
-				RAMFile fromFile = (RAMFile) fileMap[from];
-				if (fromFile == null)
-					throw new System.IO.FileNotFoundException(from);
-				RAMFile toFile = (RAMFile) fileMap[to];
-				if (toFile != null)
-				{
-					sizeInBytes -= toFile.sizeInBytes; // updates to RAMFile.sizeInBytes synchronized on directory
-					toFile.directory = null;
-				}
-				fileMap.Remove(from);
-				fileMap[to] = fromFile;
-			}
-		}
-		
 		/// <summary>Creates a new, empty file in the directory with the given name. Returns a stream writing this file. </summary>
 		public override IndexOutput CreateOutput(System.String name)
 		{
@@ -277,7 +212,7 @@ namespace Lucene.Net.Store
 			RAMFile file = new RAMFile(this);
 			lock (this)
 			{
-				RAMFile existing = (RAMFile) fileMap[name];
+				RAMFile existing = fileMap[name];
 				if (existing != null)
 				{
 					sizeInBytes -= existing.sizeInBytes;
@@ -295,7 +230,7 @@ namespace Lucene.Net.Store
 			RAMFile file;
 			lock (this)
 			{
-				file = (RAMFile) fileMap[name];
+				file = fileMap[name];
 			}
 			if (file == null)
 				throw new System.IO.FileNotFoundException(name);
@@ -317,7 +252,7 @@ namespace Lucene.Net.Store
             Close();
         }
 
-        public System.Collections.Hashtable fileMap_ForNUnit
+        public SupportClass.HashMap<string, RAMFile> fileMap_ForNUnit
         {
             get { return fileMap; }
         }

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/RAMFile.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/RAMFile.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/RAMFile.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/RAMFile.cs Wed Nov  9 21:03:47 2011
@@ -26,7 +26,7 @@ namespace Lucene.Net.Store
 		
 		private const long serialVersionUID = 1L;
 		
-		protected System.Collections.ArrayList buffers = new System.Collections.ArrayList();
+		protected System.Collections.Generic.List<byte[]> buffers = new System.Collections.Generic.List<byte[]>();
 		internal long length;
 		internal RAMDirectory directory;
 		internal long sizeInBytes; 
@@ -102,7 +102,7 @@ namespace Lucene.Net.Store
 		{
 			lock (this)
 			{
-				return (byte[]) buffers[index];
+				return buffers[index];
 			}
 		}
 		

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/RAMInputStream.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/RAMInputStream.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/RAMInputStream.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/RAMInputStream.cs Wed Nov  9 21:03:47 2011
@@ -23,10 +23,7 @@ namespace Lucene.Net.Store
 	/// <summary> A memory-resident <see cref="IndexInput" /> implementation.
 	/// 
 	/// </summary>
-	/// <version>  $Id: RAMInputStream.java 632120 2008-02-28 21:13:59Z mikemccand $
-	/// </version>
-	
-	public class RAMInputStream:IndexInput, System.ICloneable
+	public class RAMInputStream : IndexInput, System.ICloneable
 	{
 		internal static readonly int BUFFER_SIZE;
 		
@@ -54,10 +51,17 @@ namespace Lucene.Net.Store
 			currentBufferIndex = - 1;
 			currentBuffer = null;
 		}
-		
+
+        // TODO: revisit Close() for 3.0
+        //public override void Dispose()
+        //{
+        //    // nothing to do here
+        //}
+
 		public override void  Close()
 		{
-			// nothing to do here
+			//Dispose();
+            // nothing to do here
 		}
 		
 		public override long Length()
@@ -110,7 +114,7 @@ namespace Lucene.Net.Store
 			}
 			else
 			{
-				currentBuffer = (byte[]) file.GetBuffer(currentBufferIndex);
+				currentBuffer = file.GetBuffer(currentBufferIndex);
 				bufferPosition = 0;
 				bufferStart = (long) BUFFER_SIZE * (long) currentBufferIndex;
 				long buflen = length - bufferStart;



Mime
View raw message