lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject [Lucene.Net] svn commit: r1098294 - in /incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core: Search/ Search/Payloads/ Util/
Date Sun, 01 May 2011 12:38:46 GMT
Author: digy
Date: Sun May  1 12:38:46 2011
New Revision: 1098294

URL: http://svn.apache.org/viewvc?rev=1098294&view=rev
Log:
[LUCENENET-412]

Modified:
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/DisjunctionMaxQuery.cs
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Explanation.cs
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/IndexSearcher.cs
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/MultiPhraseQuery.cs
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/MultiTermQuery.cs
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/NumericRangeQuery.cs
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Payloads/PayloadSpanUtil.cs
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/QueryTermVector.cs
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/SpanFilterResult.cs
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/SpanQueryFilter.cs
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Util/AttributeSource.cs
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Util/ReaderUtil.cs

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/DisjunctionMaxQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/DisjunctionMaxQuery.cs?rev=1098294&r1=1098293&r2=1098294&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/DisjunctionMaxQuery.cs
(original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/DisjunctionMaxQuery.cs
Sun May  1 12:38:46 2011
@@ -16,6 +16,7 @@
  */
 
 using System;
+using System.Collections.Generic;
 
 using IndexReader = Lucene.Net.Index.IndexReader;
 
@@ -115,17 +116,17 @@ namespace Lucene.Net.Search
 			protected internal Similarity similarity;
 			
 			/// <summary>The Weights for our subqueries, in 1-1 correspondence with disjuncts
</summary>
-			protected internal System.Collections.ArrayList weights = new System.Collections.ArrayList();
// The Weight's for our subqueries, in 1-1 correspondence with disjuncts
+			protected internal List<Weight> weights = new List<Weight>(); // The Weight's
for our subqueries, in 1-1 correspondence with disjuncts
 			
 			/* Construct the Weight for this Query searched by searcher.  Recursively construct subquery
weights. */
 			public DisjunctionMaxWeight(DisjunctionMaxQuery enclosingInstance, Searcher searcher)
 			{
 				InitBlock(enclosingInstance);
 				this.similarity = searcher.GetSimilarity();
-				for (System.Collections.IEnumerator iter = Enclosing_Instance.disjuncts.GetEnumerator();
iter.MoveNext(); )
-				{
-					weights.Add(((Query) iter.Current).CreateWeight(searcher));
-				}
+                foreach (Query query in Enclosing_Instance.disjuncts)
+                {
+                    weights.Add(query.CreateWeight(searcher));
+                }
 			}
 			
 			/* Return our associated DisjunctionMaxQuery */
@@ -144,9 +145,9 @@ namespace Lucene.Net.Search
 			public override float SumOfSquaredWeights()
 			{
 				float max = 0.0f, sum = 0.0f;
-				for (System.Collections.IEnumerator iter = weights.GetEnumerator(); iter.MoveNext();
)
-				{
-					float sub = ((Weight) iter.Current).SumOfSquaredWeights();
+                foreach(Weight w in weights)
+                {
+					float sub = w.SumOfSquaredWeights();
 					sum += sub;
 					max = System.Math.Max(max, sub);
 				}
@@ -158,9 +159,9 @@ namespace Lucene.Net.Search
 			public override void  Normalize(float norm)
 			{
 				norm *= Enclosing_Instance.GetBoost(); // Incorporate our boost
-				for (System.Collections.IEnumerator iter = weights.GetEnumerator(); iter.MoveNext();
)
-				{
-					((Weight) iter.Current).Normalize(norm);
+                foreach(Weight w in weights)
+                {
+					w.Normalize(norm);
 				}
 			}
 			
@@ -169,9 +170,8 @@ namespace Lucene.Net.Search
 			{
 				Scorer[] scorers = new Scorer[weights.Count];
 				int idx = 0;
-				for (System.Collections.IEnumerator iter = weights.GetEnumerator(); iter.MoveNext();
)
-				{
-					Weight w = (Weight) iter.Current;
+                foreach (Weight w in weights)
+                {
 					Scorer subScorer = w.Scorer(reader, true, false);
 					if (subScorer != null && subScorer.NextDoc() != DocIdSetIterator.NO_MORE_DOCS)
 					{
@@ -188,13 +188,13 @@ namespace Lucene.Net.Search
 			public override Explanation Explain(IndexReader reader, int doc)
 			{
 				if (Enclosing_Instance.disjuncts.Count == 1)
-					return ((Weight) weights[0]).Explain(reader, doc);
+					return weights[0].Explain(reader, doc);
 				ComplexExplanation result = new ComplexExplanation();
 				float max = 0.0f, sum = 0.0f;
 				result.SetDescription(Enclosing_Instance.tieBreakerMultiplier == 0.0f?"max of:":"max
plus " + Enclosing_Instance.tieBreakerMultiplier + " times others of:");
-				for (System.Collections.IEnumerator iter = weights.GetEnumerator(); iter.MoveNext();
)
-				{
-					Explanation e = ((Weight) iter.Current).Explain(reader, doc);
+                foreach (Weight w in weights)
+                {
+					Explanation e = w.Explain(reader, doc);
 					if (e.IsMatch())
 					{
 						System.Boolean tempAux = true;

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Explanation.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Explanation.cs?rev=1098294&r1=1098293&r2=1098294&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Explanation.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Explanation.cs Sun May
 1 12:38:46 2011
@@ -16,6 +16,7 @@
  */
 
 using System;
+using System.Collections.Generic;
 
 namespace Lucene.Net.Search
 {
@@ -26,7 +27,7 @@ namespace Lucene.Net.Search
 	{
 		private float value_Renamed; // the value of this node
 		private System.String description; // what it represents
-		private System.Collections.ArrayList details; // sub-explanations
+		private List<Explanation> details; // sub-explanations
 		
 		public Explanation()
 		{
@@ -88,14 +89,14 @@ namespace Lucene.Net.Search
 		{
 			if (details == null)
 				return null;
-			return (Explanation[]) details.ToArray(typeof(Explanation));
+			return details.ToArray();
 		}
 		
 		/// <summary>Adds a sub-node to this explanation node. </summary>
 		public virtual void  AddDetail(Explanation detail)
 		{
-			if (details == null)
-				details = new System.Collections.ArrayList();
+            if (details == null)
+                details = new List<Explanation>();
 			details.Add(detail);
 		}
 		

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/IndexSearcher.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/IndexSearcher.cs?rev=1098294&r1=1098293&r2=1098294&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/IndexSearcher.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/IndexSearcher.cs Sun May
 1 12:38:46 2011
@@ -16,6 +16,7 @@
  */
 
 using System;
+using System.Collections.Generic;
 
 using Document = Lucene.Net.Documents.Document;
 using FieldSelector = Lucene.Net.Documents.FieldSelector;
@@ -118,10 +119,10 @@ namespace Lucene.Net.Search
 		{
 			reader = r;
 			this.closeReader = closeReader;
-			
-			System.Collections.IList subReadersList = new System.Collections.ArrayList();
+
+            List<IndexReader> subReadersList = new List<IndexReader>();
 			GatherSubReaders(subReadersList, reader);
-            subReaders = (IndexReader[])new System.Collections.ArrayList(subReadersList).ToArray(typeof(IndexReader));
+            subReaders = subReadersList.ToArray();
 			docStarts = new int[subReaders.Length];
 			int maxDoc = 0;
 			for (int i = 0; i < subReaders.Length; i++)
@@ -130,8 +131,8 @@ namespace Lucene.Net.Search
 				maxDoc += subReaders[i].MaxDoc();
 			}
 		}
-		
-		protected internal virtual void  GatherSubReaders(System.Collections.IList allSubReaders,
IndexReader r)
+
+        protected internal virtual void GatherSubReaders(IList<IndexReader> allSubReaders,
IndexReader r)
 		{
 			ReaderUtil.GatherSubReaders(allSubReaders, r);
 		}

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/MultiPhraseQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/MultiPhraseQuery.cs?rev=1098294&r1=1098293&r2=1098294&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/MultiPhraseQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/MultiPhraseQuery.cs Sun
May  1 12:38:46 2011
@@ -42,7 +42,7 @@ namespace Lucene.Net.Search
 	{
 		private System.String field;
         private List<Term[]> termArrays = new List<Term[]>();
-		private System.Collections.ArrayList positions = new System.Collections.ArrayList();
+        private List<int> positions = new List<int>();
 		
 		private int slop = 0;
 		
@@ -80,7 +80,7 @@ namespace Lucene.Net.Search
 		{
 			int position = 0;
 			if (positions.Count > 0)
-				position = ((System.Int32) positions[positions.Count - 1]) + 1;
+				position = positions[positions.Count - 1] + 1;
 			
 			Add(terms, position);
 		}
@@ -108,15 +108,16 @@ namespace Lucene.Net.Search
 			}
 			
 			termArrays.Add(terms);
-			positions.Add((System.Int32) position);
+			positions.Add(position);
 		}
 
         /// <summary> Returns a List&lt;Term[]&gt; of the terms in the multiphrase.
 		/// Do not modify the List or its contents.
 		/// </summary>
-		public virtual System.Collections.IList GetTermArrays()
+		public virtual List<Term[]> GetTermArrays()
 		{
-			return (System.Collections.IList) System.Collections.ArrayList.ReadOnly(new System.Collections.ArrayList(termArrays));
+			return new List<Term[]>(termArrays);
+            //return Collections.unmodifiableList(termArrays); DIGY JAVA
 		}
 		
 		/// <summary> Returns the relative positions of terms in this phrase.</summary>
@@ -124,7 +125,7 @@ namespace Lucene.Net.Search
 		{
 			int[] result = new int[positions.Count];
 			for (int i = 0; i < positions.Count; i++)
-				result[i] = ((System.Int32) positions[i]);
+				result[i] = positions[i];
 			return result;
 		}
 		
@@ -408,7 +409,7 @@ namespace Lucene.Net.Search
             }
             for (int i = 0; i < this.positions.Count; i++)
             {
-                if (!((int)this.positions[i] == (int)other.positions[i]))
+                if (!(this.positions[i] == other.positions[i]))
                 {
                     return false;
                 }

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/MultiTermQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/MultiTermQuery.cs?rev=1098294&r1=1098293&r2=1098294&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/MultiTermQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/MultiTermQuery.cs Sun
May  1 12:38:46 2011
@@ -16,6 +16,7 @@
  */
 
 using System;
+using System.Collections.Generic;
 
 using System.Runtime.InteropServices;
 using IndexReader = Lucene.Net.Index.IndexReader;
@@ -285,7 +286,7 @@ namespace Lucene.Net.Search
 				// exhaust the enum before hitting either of the
 				// cutoffs, we use ConstantBooleanQueryRewrite; else,
 				// ConstantFilterRewrite:
-				System.Collections.ArrayList pendingTerms = new System.Collections.ArrayList();
+				IList<Term> pendingTerms = new List<Term>();
 				int docCountCutoff = (int) ((docCountPercent / 100.0) * reader.MaxDoc());
 				int termCountLimit = System.Math.Min(BooleanQuery.GetMaxClauseCount(), termCountCutoff);
 				int docVisitCount = 0;
@@ -318,11 +319,10 @@ namespace Lucene.Net.Search
 							// Enumeration is done, and we hit a small
 							// enough number of terms & docs -- just make a
 							// BooleanQuery, now
-							System.Collections.IEnumerator it = pendingTerms.GetEnumerator();
 							BooleanQuery bq = new BooleanQuery(true);
-							while (it.MoveNext())
+                            foreach(Term term in pendingTerms)
 							{
-								TermQuery tq = new TermQuery((Term) it.Current);
+								TermQuery tq = new TermQuery(term);
 								bq.Add(tq, BooleanClause.Occur.SHOULD);
 							}
 							// Strip scores

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/NumericRangeQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/NumericRangeQuery.cs?rev=1098294&r1=1098293&r2=1098294&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/NumericRangeQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/NumericRangeQuery.cs Sun
May  1 12:38:46 2011
@@ -16,6 +16,7 @@
  */
 
 using System;
+using System.Collections.Generic;
 
 using NumericTokenStream = Lucene.Net.Analysis.NumericTokenStream;
 using NumericField = Lucene.Net.Documents.NumericField;
@@ -440,8 +441,8 @@ namespace Lucene.Net.Search
 				//@Override
 				public override void  AddRange(System.String minPrefixCoded, System.String maxPrefixCoded)
 				{
-					Enclosing_Instance.rangeBounds.Add(minPrefixCoded);
-					Enclosing_Instance.rangeBounds.Add(maxPrefixCoded);
+					Enclosing_Instance.rangeBounds.AddLast(minPrefixCoded);
+					Enclosing_Instance.rangeBounds.AddLast(maxPrefixCoded);
 				}
 			}
 			private class AnonymousClassIntRangeBuilder:NumericUtils.IntRangeBuilder
@@ -466,8 +467,8 @@ namespace Lucene.Net.Search
 				//@Override
 				public override void  AddRange(System.String minPrefixCoded, System.String maxPrefixCoded)
 				{
-					Enclosing_Instance.rangeBounds.Add(minPrefixCoded);
-					Enclosing_Instance.rangeBounds.Add(maxPrefixCoded);
+					Enclosing_Instance.rangeBounds.AddLast(minPrefixCoded);
+					Enclosing_Instance.rangeBounds.AddLast(maxPrefixCoded);
 				}
 			}
 			private void  InitBlock(NumericRangeQuery enclosingInstance)
@@ -485,7 +486,7 @@ namespace Lucene.Net.Search
 			}
 			
 			private IndexReader reader;
-			private System.Collections.ArrayList rangeBounds = new System.Collections.ArrayList();
+            private LinkedList<string> rangeBounds = new LinkedList<string>();
 			private System.String currentUpperBound = null;
 			
 			internal NumericRangeTermEnum(NumericRangeQuery enclosingInstance, IndexReader reader)
@@ -639,14 +640,14 @@ namespace Lucene.Net.Search
 					actualEnum.Close();
 					actualEnum = null;
 				}
-				System.Object tempObject;
-				tempObject = rangeBounds[0];
-				rangeBounds.RemoveAt(0);
-				System.String lowerBound = (System.String) tempObject;
-				System.Object tempObject2;
-				tempObject2 = rangeBounds[0];
-				rangeBounds.RemoveAt(0);
-				this.currentUpperBound = ((System.String) tempObject2);
+				string tempObject;
+				tempObject = rangeBounds.First.Value;
+				rangeBounds.RemoveFirst();
+				string lowerBound = tempObject;
+				string tempObject2;
+				tempObject2 = rangeBounds.First.Value;
+				rangeBounds.RemoveFirst();
+				this.currentUpperBound = tempObject2;
 				// this call recursively uses next(), if no valid term in
 				// next enum found.
 				// if this behavior is changed/modified in the superclass,

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Payloads/PayloadSpanUtil.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Payloads/PayloadSpanUtil.cs?rev=1098294&r1=1098293&r2=1098294&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Payloads/PayloadSpanUtil.cs
(original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Payloads/PayloadSpanUtil.cs
Sun May  1 12:38:46 2011
@@ -133,7 +133,7 @@ namespace Lucene.Net.Search.Payloads
 			else if (query is MultiPhraseQuery)
 			{
 				MultiPhraseQuery mpq = (MultiPhraseQuery) query;
-				System.Collections.IList termArrays = mpq.GetTermArrays();
+				List<Term[]> termArrays = mpq.GetTermArrays();
 				int[] positions = mpq.GetPositions();
 				if (positions.Length > 0)
 				{
@@ -146,17 +146,17 @@ namespace Lucene.Net.Search.Payloads
 							maxPosition = positions[i];
 						}
 					}
-					
-					System.Collections.ArrayList[] disjunctLists = new System.Collections.ArrayList[maxPosition
+ 1];
+
+                    List<Query>[] disjunctLists = new List<Query>[maxPosition
+ 1];
 					int distinctPositions = 0;
 					
 					for (int i = 0; i < termArrays.Count; ++i)
 					{
-						Term[] termArray = (Term[]) termArrays[i];
+						Term[] termArray = termArrays[i];
 						System.Collections.IList disjuncts = disjunctLists[positions[i]];
 						if (disjuncts == null)
 						{
-							disjuncts = (disjunctLists[positions[i]] = new System.Collections.ArrayList(termArray.Length));
+							disjuncts = (disjunctLists[positions[i]] = new List<Query>(termArray.Length));
 							++distinctPositions;
 						}
 						for (int j = 0; j < termArray.Length; ++j)
@@ -170,10 +170,10 @@ namespace Lucene.Net.Search.Payloads
 					SpanQuery[] clauses = new SpanQuery[distinctPositions];
 					for (int i = 0; i < disjunctLists.Length; ++i)
 					{
-						System.Collections.ArrayList disjuncts = disjunctLists[i];
+                        List<Query> disjuncts = disjunctLists[i];
 						if (disjuncts != null)
 						{
-                            clauses[position++] = new SpanOrQuery((SpanQuery[]) (disjuncts.ToArray(typeof(SpanQuery[]))));
+                            clauses[position++] = new SpanOrQuery((SpanQuery[]) (disjuncts.ToArray()));
 						}
 						else
 						{

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/QueryTermVector.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/QueryTermVector.cs?rev=1098294&r1=1098293&r2=1098294&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/QueryTermVector.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/QueryTermVector.cs Sun
May  1 12:38:46 2011
@@ -56,7 +56,7 @@ namespace Lucene.Net.Search
 				TokenStream stream = analyzer.TokenStream("", new System.IO.StringReader(queryString));
 				if (stream != null)
 				{
-					System.Collections.ArrayList terms = new System.Collections.ArrayList();
+                    List<string> terms = new List<string>();
 					try
 					{
 						bool hasMoreTokens = false;
@@ -70,7 +70,7 @@ namespace Lucene.Net.Search
 							terms.Add(termAtt.Term());
 							hasMoreTokens = stream.IncrementToken();
 						}
-						ProcessTerms((System.String[]) terms.ToArray(typeof(System.String)));
+						ProcessTerms(terms.ToArray());
 					}
 					catch (System.IO.IOException e)
 					{

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/SpanFilterResult.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/SpanFilterResult.cs?rev=1098294&r1=1098293&r2=1098294&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/SpanFilterResult.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/SpanFilterResult.cs Sun
May  1 12:38:46 2011
@@ -16,6 +16,7 @@
  */
 
 using System;
+using System.Collections.Generic;
 
 namespace Lucene.Net.Search
 {
@@ -36,7 +37,7 @@ namespace Lucene.Net.Search
 		private System.Collections.BitArray bits;
 		
 		private DocIdSet docIdSet;
-		private System.Collections.IList positions; //Spans spans;
+        private List<PositionInfo> positions; //Spans spans;
 		
 		/// <summary> </summary>
 		/// <param name="bits">The bits for the Filter
@@ -46,7 +47,7 @@ namespace Lucene.Net.Search
 		/// <deprecated> Use {@link #SpanFilterResult(DocIdSet, List)} instead
 		/// </deprecated>
         [Obsolete("Use SpanFilterResult(DocIdSet, List) instead")]
-		public SpanFilterResult(System.Collections.BitArray bits, System.Collections.IList positions)
+        public SpanFilterResult(System.Collections.BitArray bits, List<PositionInfo>
positions)
 		{
 			this.bits = bits;
 			this.positions = positions;
@@ -57,7 +58,7 @@ namespace Lucene.Net.Search
 		/// </param>
 		/// <param name="positions">A List of {@link Lucene.Net.Search.SpanFilterResult.PositionInfo}
objects
 		/// </param>
-		public SpanFilterResult(DocIdSet docIdSet, System.Collections.IList positions)
+        public SpanFilterResult(DocIdSet docIdSet, List<PositionInfo> positions)
 		{
 			this.docIdSet = docIdSet;
 			this.positions = positions;
@@ -90,13 +91,13 @@ namespace Lucene.Net.Search
 		public class PositionInfo
 		{
 			private int doc;
-			private System.Collections.IList positions;
+            private List<StartEnd> positions;
 			
 			
 			public PositionInfo(int doc)
 			{
 				this.doc = doc;
-				positions = new System.Collections.ArrayList();
+                positions = new List<StartEnd>();
 			}
 			
 			public virtual void  AddPosition(int start, int end)
@@ -112,7 +113,7 @@ namespace Lucene.Net.Search
 			/// <summary> </summary>
 			/// <returns> A List of {@link Lucene.Net.Search.SpanFilterResult.StartEnd} objects
 			/// </returns>
-			public virtual System.Collections.IList GetPositions()
+            public virtual IList<StartEnd> GetPositions()
 			{
 				return positions;
 			}

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/SpanQueryFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/SpanQueryFilter.cs?rev=1098294&r1=1098293&r2=1098294&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/SpanQueryFilter.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/SpanQueryFilter.cs Sun
May  1 12:38:46 2011
@@ -16,6 +16,7 @@
  */
 
 using System;
+using System.Collections.Generic;
 
 using IndexReader = Lucene.Net.Index.IndexReader;
 using OpenBitSet = Lucene.Net.Util.OpenBitSet;
@@ -67,7 +68,7 @@ namespace Lucene.Net.Search
 			
 			OpenBitSet bits = new OpenBitSet(reader.MaxDoc());
 			Lucene.Net.Search.Spans.Spans spans = query.GetSpans(reader);
-			System.Collections.IList tmp = new System.Collections.ArrayList(20);
+            List<SpanFilterResult.PositionInfo> tmp = new List<SpanFilterResult.PositionInfo>(20);
 			int currentDoc = - 1;
 			SpanFilterResult.PositionInfo currentInfo = null;
 			while (spans.Next())

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Util/AttributeSource.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Util/AttributeSource.cs?rev=1098294&r1=1098293&r2=1098294&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Util/AttributeSource.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Util/AttributeSource.cs Sun May
 1 12:38:46 2011
@@ -190,15 +190,15 @@ namespace Lucene.Net.Util
 			System.Type clazz = att.GetType();
 			if (attributeImpls.Contains(clazz))
 				return ;
-			System.Collections.ArrayList foundInterfaces;
+            List<WeakReference> foundInterfaces;
 			lock (knownImplClasses)
 			{
-				foundInterfaces = (System.Collections.ArrayList) knownImplClasses[clazz];
+                foundInterfaces = (List<WeakReference>)knownImplClasses[clazz];
 				if (foundInterfaces == null)
 				{
                     // we have a strong reference to the class instance holding all interfaces
in the list (parameter "att"),
                     // so all WeakReferences are never evicted by GC
-					knownImplClasses.Add(clazz, foundInterfaces = new System.Collections.ArrayList());
+                    knownImplClasses.Add(clazz, foundInterfaces = new List<WeakReference>());
 					// find all interfaces that this attribute instance implements
 					// and that extend the Attribute interface
 					System.Type actClazz = clazz;
@@ -220,9 +220,8 @@ namespace Lucene.Net.Util
 			}
 			
 			// add all interfaces of this AttributeImpl to the maps
-			for (System.Collections.IEnumerator it = foundInterfaces.GetEnumerator(); it.MoveNext();
)
+            foreach(WeakReference curInterfaceRef in foundInterfaces)
 			{
-                WeakReference curInterfaceRef = (WeakReference)it.Current;
 				System.Type curInterface = (System.Type) curInterfaceRef.Target;
                 System.Diagnostics.Debug.Assert(curInterface != null,"We have a strong reference
on the class holding the interfaces, so they should never get evicted");
 				// Attribute is a superclass of this interface

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Util/ReaderUtil.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Util/ReaderUtil.cs?rev=1098294&r1=1098293&r2=1098294&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Util/ReaderUtil.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Util/ReaderUtil.cs Sun May  1
12:38:46 2011
@@ -16,6 +16,7 @@
  */
 
 using System;
+using System.Collections.Generic;
 
 using IndexReader = Lucene.Net.Index.IndexReader;
 
@@ -35,7 +36,7 @@ namespace Lucene.Net.Util
 		/// </param>
 		/// <param name="reader">
 		/// </param>
-		public static void  GatherSubReaders(System.Collections.IList allSubReaders, IndexReader
reader)
+        public static void GatherSubReaders(IList<IndexReader> allSubReaders, IndexReader
reader)
 		{
 			IndexReader[] subReaders = reader.GetSequentialSubReaders();
 			if (subReaders == null)
@@ -63,9 +64,9 @@ namespace Lucene.Net.Util
 		/// </returns>
 		public static IndexReader SubReader(int doc, IndexReader reader)
 		{
-			System.Collections.ArrayList subReadersList = new System.Collections.ArrayList();
+            List<IndexReader> subReadersList = new List<IndexReader>();
 			ReaderUtil.GatherSubReaders(subReadersList, reader);
-			IndexReader[] subReaders = (IndexReader[]) subReadersList.ToArray(typeof(IndexReader));
+			IndexReader[] subReaders = subReadersList.ToArray();
 			int[] docStarts = new int[subReaders.Length];
 			int maxDoc = 0;
 			for (int i = 0; i < subReaders.Length; i++)
@@ -87,9 +88,9 @@ namespace Lucene.Net.Util
 		/// </returns>
 		public static IndexReader SubReader(IndexReader reader, int subIndex)
 		{
-			System.Collections.ArrayList subReadersList = new System.Collections.ArrayList();
+			List<IndexReader> subReadersList = new List<IndexReader>();
 			ReaderUtil.GatherSubReaders(subReadersList, reader);
-			IndexReader[] subReaders = (IndexReader[]) subReadersList.ToArray(typeof(IndexReader));
+			IndexReader[] subReaders = subReadersList.ToArray();
 			return subReaders[subIndex];
 		}
 		



Mime
View raw message