You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by cc...@apache.org on 2011/11/09 22:03:52 UTC

[Lucene.Net] svn commit: r1199962 [13/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...

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/RAMOutputStream.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/RAMOutputStream.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/RAMOutputStream.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/RAMOutputStream.cs Wed Nov  9 21:03:47 2011
@@ -21,11 +21,8 @@ namespace Lucene.Net.Store
 {
 	
 	/// <summary> A memory-resident <see cref="IndexOutput" /> implementation.
-	/// 
+	/// <para>For lucene internal use.</para>
 	/// </summary>
-	/// <version>  $Id: RAMOutputStream.java 691694 2008-09-03 17:34:29Z mikemccand $
-	/// </version>
-	
 	public class RAMOutputStream:IndexOutput
 	{
 		internal const int BUFFER_SIZE = 1024;
@@ -70,7 +67,7 @@ namespace Lucene.Net.Store
 					// at the last buffer
 					length = (int) (end - pos);
 				}
-				out_Renamed.WriteBytes((byte[]) file.GetBuffer(buffer++), length);
+				out_Renamed.WriteBytes(file.GetBuffer(buffer++), length);
 				pos = nextPos;
 			}
 		}
@@ -149,7 +146,7 @@ namespace Lucene.Net.Store
 			}
 			else
 			{
-				currentBuffer = (byte[]) file.GetBuffer(currentBufferIndex);
+				currentBuffer = file.GetBuffer(currentBufferIndex);
 			}
 			bufferPosition = 0;
 			bufferStart = (long) BUFFER_SIZE * (long) currentBufferIndex;

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/SimpleFSDirectory.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/SimpleFSDirectory.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/SimpleFSDirectory.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/SimpleFSDirectory.cs Wed Nov  9 21:03:47 2011
@@ -29,20 +29,6 @@ namespace Lucene.Net.Store
 	/// </summary>
 	public class SimpleFSDirectory:FSDirectory
 	{
-		
-		/// <summary>Create a new SimpleFSDirectory for the named location.
-		/// 
-		/// </summary>
-		/// <param name="path">the path of the directory
-		/// </param>
-		/// <param name="lockFactory">the lock factory to use, or null for the default.
-		/// </param>
-		/// <throws>  IOException </throws>
-		[System.Obsolete("Use the constructor that takes a DirectoryInfo, this will be removed in the 3.0 release")]
-		public SimpleFSDirectory(System.IO.FileInfo path, LockFactory lockFactory):base(new System.IO.DirectoryInfo(path.FullName), lockFactory)
-		{
-		}
-		
         /// <summary>Create a new SimpleFSDirectory for the named location.
         /// 
         /// </summary>
@@ -66,14 +52,6 @@ namespace Lucene.Net.Store
 		{
 		}
 		
-		// back compatibility so FSDirectory can instantiate via reflection
-		/// <deprecated> 
-		/// </deprecated>
-        [Obsolete]
-		internal SimpleFSDirectory()
-		{
-		}
-		
         /// <summary>Create a new SimpleFSDirectory for the named location and the default lock factory.
         /// 
         /// </summary>
@@ -142,20 +120,6 @@ namespace Lucene.Net.Store
 			//  LUCENE-1566 - maximum read length on a 32bit JVM to prevent incorrect OOM 
 			protected internal int chunkSize;
 			
-			/// <deprecated> Please use ctor taking chunkSize 
-			/// </deprecated>
-            [Obsolete("Please use ctor taking chunkSize ")]
-			public SimpleFSIndexInput(System.IO.FileInfo path):this(path, BufferedIndexInput.BUFFER_SIZE, SimpleFSDirectory.DEFAULT_READ_CHUNK_SIZE)
-			{
-			}
-			
-			/// <deprecated> Please use ctor taking chunkSize 
-			/// </deprecated>
-            [Obsolete("Please use ctor taking chunkSize ")]
-			public SimpleFSIndexInput(System.IO.FileInfo path, int bufferSize):this(path, bufferSize, SimpleFSDirectory.DEFAULT_READ_CHUNK_SIZE)
-			{
-			}
-			
 			public SimpleFSIndexInput(System.IO.FileInfo path, int bufferSize, int chunkSize):base(bufferSize)
 			{
 				file = new Descriptor(path, System.IO.FileAccess.Read);

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/SimpleFSLockFactory.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/SimpleFSLockFactory.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/SimpleFSLockFactory.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/SimpleFSLockFactory.cs Wed Nov  9 21:03:47 2011
@@ -35,8 +35,8 @@ namespace Lucene.Net.Store
 	/// <p/>When this happens, a <see cref="LockObtainFailedException" />
 	/// is hit when trying to create a writer, in which case you
 	/// need to explicitly clear the lock file first.  You can
-	/// either manually remove the file, or use the <see cref="Lucene.Net.Index.IndexReader.Unlock(Directory)" />
-	///
+	/// either manually remove the file, or use the 
+	/// <see cref="Lucene.Net.Index.IndexWriter.Unlock(Directory)" />
 	/// API.  But, first be certain that no writer is in fact
 	/// writing to the index otherwise you can easily corrupt
 	/// your index.<p/>
@@ -62,15 +62,6 @@ namespace Lucene.Net.Store
 		public SimpleFSLockFactory():this((System.IO.DirectoryInfo) null)
 		{
 		}
-		
-		/// <summary> Instantiate using the provided directory (as a File instance).</summary>
-		/// <param name="lockDir">where lock files should be created.
-		/// </param>
-		[System.Obsolete("Use the constructor that takes a DirectoryInfo, this will be removed in the 3.0 release")]
-		public SimpleFSLockFactory(System.IO.FileInfo lockDir)
-		{
-			SetLockDir(new System.IO.DirectoryInfo(lockDir.FullName));
-		}
 
         /// <summary> Instantiate using the provided directory (as a File instance).</summary>
         /// <param name="lockDir">where lock files should be created.

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/SingleInstanceLockFactory.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/SingleInstanceLockFactory.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/SingleInstanceLockFactory.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/SingleInstanceLockFactory.cs Wed Nov  9 21:03:47 2011
@@ -34,7 +34,7 @@ namespace Lucene.Net.Store
 	public class SingleInstanceLockFactory:LockFactory
 	{
 
-        private System.Collections.Hashtable locks = new System.Collections.Hashtable();
+        private System.Collections.Generic.HashSet<string> locks = new System.Collections.Generic.HashSet<string>();
 		
 		public override Lock MakeLock(System.String lockName)
 		{
@@ -61,9 +61,9 @@ namespace Lucene.Net.Store
 	{
 		
 		internal System.String lockName;
-		private System.Collections.Hashtable locks;
-		
-		public SingleInstanceLock(System.Collections.Hashtable locks, System.String lockName)
+        private System.Collections.Generic.HashSet<string> locks;
+
+        public SingleInstanceLock(System.Collections.Generic.HashSet<string> locks, System.String lockName)
 		{
 			this.locks = locks;
 			this.lockName = lockName;
@@ -75,7 +75,7 @@ namespace Lucene.Net.Store
 			{
                 if (locks.Contains(lockName) == false)
                 {
-                    locks.Add(lockName, lockName);
+                    locks.Add(lockName);
                     return true;
                 }
 

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/SupportClass.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/SupportClass.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/SupportClass.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/SupportClass.cs Wed Nov  9 21:03:47 2011
@@ -17,6 +17,8 @@
 
 using System;
 using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
 
 /// <summary>
 /// This interface should be implemented by any class whose instances are intended 
@@ -1161,7 +1163,683 @@ public class SupportClass
             return false;
         }
     }
-    
+
+    #region HASHMAP
+
+    /// <summary>
+    /// A C# emulation of the <a href="http://download.oracle.com/javase/1,5.0/docs/api/java/util/HashMap.html">Java Hashmap</a>
+    /// <para>
+    /// A <see cref="Dictionary{TKey, TValue}" /> is a close equivalent to the Java
+    /// Hashmap.  One difference java implementation of the class is that
+    /// the Hashmap supports both null keys and values, where the C# Dictionary
+    /// only supports null values not keys.  Also, <c>V Get(TKey)</c>
+    /// method in Java returns null if the key doesn't exist, instead of throwing
+    /// an exception.  This implementation doesn't throw an exception when a key 
+    /// doesn't exist, it will return null.
+    /// </para>
+    /// <para>
+    /// <b>NOTE:</b> This class shouldn't be used with non-nullable value types.
+    /// Using them will cause unexpected behavior, because of comparisons to default(T)
+    /// which, Nullable&lt;T&gt; returns as null, and any other value types will not. A
+    /// Dictionary would work fine in that use case.
+    /// </para>
+    /// <remaks>
+    /// Consider also implementing IDictionary, IEnumerable, and ICollection
+    /// like <see cref="Dictionary{TKey, TValue}" /> does, so HashMap can be
+    /// used in substituted in place for the same interfaces it implements.
+    /// </remaks>
+    /// </summary>
+    /// <typeparam name="TKey">The type of keys in the dictionary</typeparam>
+    /// <typeparam name="TValue">The type of values in the dictionary</typeparam>
+    public class HashMap<TKey, TValue> : IDictionary<TKey, TValue>
+    {
+        private Dictionary<TKey, TValue> _dict;
+
+        // Indicates if a null key has been assigned, used for iteration
+        private bool _hasNullValue;
+        // stores the value for the null key
+        private TValue _nullValue;
+
+        public HashMap() : this(0)
+        { }
+
+        public HashMap(int initialCapacity)
+        {
+            _dict = new Dictionary<TKey, TValue>(initialCapacity);
+            _hasNullValue = false;
+        }
+
+        public HashMap(IEnumerable<KeyValuePair<TKey, TValue>> other)
+        {
+            foreach (var kvp in other)
+            {
+                Add(kvp.Key, kvp.Value);
+            }
+        }
+
+        public bool ContainsValue(TValue value)
+        {
+            if (_hasNullValue && _nullValue.Equals(value))
+                return true;
+
+            return _dict.ContainsValue(value);
+        }
+
+        #region Implementation of IEnumerable
+
+        public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
+        {
+            if (_hasNullValue)
+            {
+                yield return new KeyValuePair<TKey, TValue>(default(TKey), _nullValue);
+            }
+            foreach (var kvp in _dict)
+            {
+                yield return kvp;
+            }
+        }
+
+        IEnumerator IEnumerable.GetEnumerator()
+        {
+            return GetEnumerator();
+        }
+
+        #endregion
+
+        #region Implementation of ICollection<KeyValuePair<TKey,TValue>>
+
+        void ICollection<KeyValuePair<TKey,TValue>>.Add(KeyValuePair<TKey, TValue> item)
+        {
+            if (item.Key.Equals(default(TKey)))
+            {
+                _hasNullValue = true;
+                _nullValue = item.Value;
+            }
+            else
+            {
+                _dict.Add(item.Key, item.Value);
+            }
+        }
+
+        public void Clear()
+        {
+            _hasNullValue = false;
+            _nullValue = default(TValue);
+            _dict.Clear();
+        }
+
+        bool ICollection<KeyValuePair<TKey,TValue>>.Contains(KeyValuePair<TKey, TValue> item)
+        {
+            if (item.Key.Equals(default(TKey)))
+            {
+                return _hasNullValue && EqualityComparer<TValue>.Default.Equals(item.Value, _nullValue);
+            }
+
+            return ((ICollection<KeyValuePair<TKey, TValue>>) _dict).Contains(item);
+        }
+
+        void ICollection<KeyValuePair<TKey,TValue>>.CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)
+        {
+            throw new NotImplementedException("implement as needed");
+        }
+
+        public bool Remove(KeyValuePair<TKey, TValue> item)
+        {
+            if(item.Key.Equals(default(TKey)))
+            {
+                if (!_hasNullValue)
+                    return false;
+
+                _hasNullValue = false;
+                _nullValue = default(TValue);
+                return true;
+            }
+
+            return ((ICollection<KeyValuePair<TKey, TValue>>) _dict).Remove(item);
+        }
+
+        public int Count
+        {
+            get { return _dict.Count + (_hasNullValue ? 1 : 0); }
+        }
+
+        public bool IsReadOnly
+        {
+            get { return false; }
+        }
+
+        #endregion
+
+        #region Implementation of IDictionary<TKey,TValue>
+
+        public bool ContainsKey(TKey key)
+        {
+            if (key.Equals(default(TKey)) && _hasNullValue)
+            {
+                return true;
+            }
+
+            return _dict.ContainsKey(key);
+        }
+
+        public void Add(TKey key, TValue value)
+        {
+            if (key.Equals(default(TKey)))
+            {
+                _hasNullValue = true;
+                _nullValue = value;
+            }
+            else
+            {
+                if (_dict.ContainsKey(key))
+                {
+                    _dict[key] = value;
+                }
+                else
+                {
+                    _dict.Add(key, value);
+                }
+            }
+        }
+
+        public bool Remove(TKey key)
+        {
+            if (key.Equals(default(TKey)))
+            {
+                _hasNullValue = false;
+                _nullValue = default(TValue);
+                return true;
+            }
+            else
+            {
+                return _dict.Remove(key);
+            }
+        }
+
+        public bool TryGetValue(TKey key, out TValue value)
+        {
+            if (key.Equals(default(TKey)))
+            {
+                if (_hasNullValue)
+                {
+                    value = _nullValue;
+                    return true;
+                }
+
+                value = default(TValue);
+                return false;
+            }
+            else
+            {
+                return _dict.TryGetValue(key, out value);
+            }
+        }
+
+        public TValue this[TKey key]
+        {
+            get
+            {
+                if (key.Equals(default(TKey)))
+                {
+                    if (!_hasNullValue)
+                    {
+                        return default(TValue);
+                    }
+                    return _nullValue;
+                }
+                return _dict.ContainsKey(key) ? _dict[key] : default(TValue);
+            }
+            set
+            {
+                if (key.Equals(default(TKey)))
+                {
+                    _nullValue = value;
+                }
+                else
+                {
+                    _dict[key] = value;
+                }
+            }
+        }
+
+        public ICollection<TKey> Keys
+        {
+            get 
+            {
+                if (!_hasNullValue) return _dict.Keys;
+
+                // Using a List<T> to generate an ICollection<TKey>
+                // would incur a costly copy of the dict's KeyCollection
+                // use out own wrapper instead
+                return new NullKeyCollection(_dict);
+            }
+        }
+
+        public ICollection<TValue> Values
+        {
+            get
+            {
+                if (!_hasNullValue) return _dict.Values;
+
+                // Using a List<T> to generate an ICollection<TValue>
+                // would incur a costly copy of the dict's ValueCollection
+                // use out own wrapper instead
+                return new NullValueCollection(_dict, _nullValue);
+            }
+        }
+
+        #endregion
+
+        #region NullValueCollection
+
+        /// <summary>
+        /// Wraps a dictionary and adds the value
+        /// represented by the null key
+        /// </summary>
+        class NullValueCollection : ICollection<TValue>
+        {
+            private readonly TValue _nullValue;
+            private readonly Dictionary<TKey, TValue> _internalDict;
+
+            public NullValueCollection(Dictionary<TKey, TValue> dict, TValue nullValue)
+            {
+                _internalDict = dict;
+                _nullValue = nullValue;
+            }
+
+            #region Implementation of IEnumerable
+
+            public IEnumerator<TValue> GetEnumerator()
+            {
+                yield return _nullValue;
+                
+                foreach (var val in _internalDict.Values)
+                {
+                    yield return val;
+                }
+            }
+
+            IEnumerator IEnumerable.GetEnumerator()
+            {
+                return GetEnumerator();
+            }
+
+            #endregion
+
+            #region Implementation of ICollection<TValue>
+
+            public void CopyTo(TValue[] array, int arrayIndex)
+            {
+                throw new NotImplementedException("Implement as needed");
+            }
+
+            public int Count
+            {
+                get { return _internalDict.Count + 1; }
+            }
+
+            public bool IsReadOnly
+            {
+                get { return true; }
+            }
+
+            #region Explicit Interface Methods
+
+            void ICollection<TValue>.Add(TValue item)
+            {
+                throw new NotSupportedException();
+            }
+
+            void ICollection<TValue>.Clear()
+            {
+                throw new NotSupportedException();
+            }
+
+            bool ICollection<TValue>.Contains(TValue item)
+            {
+                throw new NotSupportedException();
+            }
+
+            bool ICollection<TValue>.Remove(TValue item)
+            {
+                throw new NotSupportedException("Collection is read only!");
+            }
+            #endregion
+
+            #endregion
+        }
+
+        #endregion
+
+        #region NullKeyCollection
+        /// <summary>
+        /// Wraps a dictionary's collection, adding in a
+        /// null key.
+        /// </summary>
+        class NullKeyCollection : ICollection<TKey>
+        {
+            private readonly Dictionary<TKey, TValue> _internalDict;
+
+            public NullKeyCollection(Dictionary<TKey, TValue> dict)
+            {
+                _internalDict = dict;
+            }
+
+            public IEnumerator<TKey> GetEnumerator()
+            {
+                yield return default(TKey);
+                foreach (var key in _internalDict.Keys)
+                {
+                    yield return key;
+                }
+            }
+
+            IEnumerator IEnumerable.GetEnumerator()
+            {
+                return GetEnumerator();
+            }
+
+            public void CopyTo(TKey[] array, int arrayIndex)
+            {
+                throw new NotImplementedException("Implement this as needed");
+            }
+
+            public int Count
+            {
+                get { return _internalDict.Count + 1; }
+            }
+
+            public bool IsReadOnly
+            {
+                get { return true; }
+            }
+
+            #region Explicit Interface Definitions
+            bool ICollection<TKey>.Contains(TKey item)
+            {
+                throw new NotSupportedException();
+            }
+
+            void ICollection<TKey>.Add(TKey item)
+            {
+                throw new NotSupportedException();
+            }
+
+            void ICollection<TKey>.Clear()
+            {
+                throw new NotSupportedException();
+            }
+
+            bool ICollection<TKey>.Remove(TKey item)
+            {
+                throw new NotSupportedException();
+            }
+            #endregion
+        }
+        #endregion
+    }
+
+    #endregion
+
+    #region WEAKHASHMAP
+    public class WeakHashMap<TKey, TValue> : IDictionary<TKey, TValue>
+    {
+        private HashMap<WeakKey<TKey>, TValue> _hm = new HashMap<WeakKey<TKey>, TValue>();
+        private WeakReference _gcCounter = new WeakReference(new object());
+
+        #region Nested Types
+        /// <summary>
+        /// A weak reference wrapper for the hashtable keys. Whenever a key\value pair 
+        /// is added to the hashtable, the key is wrapped using a WeakKey. WeakKey saves the
+        /// value of the original object hashcode for fast comparison.
+        /// </summary>
+        class WeakKey<T>
+        {
+            WeakReference reference;
+            int hashCode;
+
+            public WeakKey(T key)
+            {
+                if (key == null)
+                    throw new ArgumentNullException("key");
+
+                hashCode = key.GetHashCode();
+                reference = new WeakReference(key);
+            }
+
+            public override int GetHashCode()
+            {
+                return hashCode;
+            }
+
+            public override bool Equals(object obj)
+            {
+                if (!reference.IsAlive) return false;
+
+                if (GetHashCode() != obj.GetHashCode()) return false;
+
+                if (obj is WeakKey<T>)
+                {
+                    var other = (WeakKey<T>)obj;
+                    return other.IsAlive && ReferenceEquals(reference.Target, other.Target);
+                }
+
+                return reference.Target.Equals(obj);
+            }
+
+            public T Target
+            {
+                get { return (T)reference.Target; }
+            }
+
+            public bool IsAlive
+            {
+                get { return reference.IsAlive; }
+            }
+        }
+        #endregion
+
+        public WeakHashMap()
+        { }
+
+        private void Clean()
+        {
+            while (!_hm.Keys.Where(x => x != null).Any(x => !x.IsAlive))
+            {
+                _hm.Remove(_hm.Keys.Where(x => !x.IsAlive).First());
+            }
+        }
+
+        private void CleanIfNeeded()
+        {
+            if (!_gcCounter.IsAlive)
+            {
+                Clean();
+                _gcCounter = new WeakReference(new object());
+            }
+        }
+
+        #region Implementation of IEnumerable
+
+        public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
+        {
+            foreach (var kvp in _hm.Where(x => x.Key.IsAlive))
+            {
+                yield return new KeyValuePair<TKey, TValue>(kvp.Key.Target, kvp.Value);
+            }
+        }
+
+        IEnumerator IEnumerable.GetEnumerator()
+        {
+            return GetEnumerator();
+        }
+
+        #endregion
+
+        #region Implementation of ICollection<KeyValuePair<TKey,TValue>>
+
+        void ICollection<KeyValuePair<TKey,TValue>>.Add(KeyValuePair<TKey, TValue> item)
+        {
+            CleanIfNeeded();
+            ((ICollection<KeyValuePair<TKey, TValue>>) _hm).Add(item);
+        }
+
+        public void Clear()
+        {
+            _hm.Clear();
+        }
+
+        bool ICollection<KeyValuePair<TKey,TValue>>.Contains(KeyValuePair<TKey, TValue> item)
+        {
+            return ((ICollection<KeyValuePair<WeakKey<TKey>, TValue>>) _hm).Contains(
+                        new KeyValuePair<WeakKey<TKey>, TValue>(new WeakKey<TKey>(item.Key), item.Value));
+        }
+
+        void ICollection<KeyValuePair<TKey,TValue>>.CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)
+        {
+            throw new NotImplementedException();
+        }
+
+        bool ICollection<KeyValuePair<TKey,TValue>>.Remove(KeyValuePair<TKey, TValue> item)
+        {
+            return ((ICollection<KeyValuePair<WeakKey<TKey>, TValue>>)_hm).Remove(
+                        new KeyValuePair<WeakKey<TKey>, TValue>(new WeakKey<TKey>(item.Key), item.Value));
+        }
+
+        public int Count
+        {
+            get
+            {
+                CleanIfNeeded();
+                return _hm.Count;
+            }
+        }
+
+        public bool IsReadOnly
+        {
+            get { return false; }
+        }
+
+        #endregion
+
+        #region Implementation of IDictionary<TKey,TValue>
+
+        public bool ContainsKey(TKey key)
+        {
+            return _hm.ContainsKey(new WeakKey<TKey>(key));
+        }
+
+        public void Add(TKey key, TValue value)
+        {
+            CleanIfNeeded();
+            _hm.Add(new WeakKey<TKey>(key), value);
+        }
+
+        public bool Remove(TKey key)
+        {
+            return _hm.Remove(new WeakKey<TKey>(key));
+        }
+
+        public bool TryGetValue(TKey key, out TValue value)
+        {
+            return _hm.TryGetValue(new WeakKey<TKey>(key), out value);
+        }
+
+        public TValue this[TKey key]
+        {
+            get { return _hm[new WeakKey<TKey>(key)]; }
+            set
+            {
+                CleanIfNeeded();
+                _hm[new WeakKey<TKey>(key)] = value;
+            }
+        }
+
+        public ICollection<TKey> Keys
+        {
+            get
+            {
+                CleanIfNeeded();
+                return new KeyCollection(_hm);
+            }
+        }
+
+        public ICollection<TValue> Values
+        {
+            get
+            {
+                CleanIfNeeded();
+                return _hm.Values;
+            }
+        }
+
+        #endregion
+
+
+        #region KeyCollection
+        class KeyCollection : ICollection<TKey>
+        {
+            private readonly HashMap<WeakKey<TKey>, TValue> _internalDict;
+
+            public KeyCollection(HashMap<WeakKey<TKey>, TValue> dict)
+            {
+                _internalDict = dict;
+            }
+
+            public IEnumerator<TKey> GetEnumerator()
+            {
+                foreach (var key in _internalDict.Keys)
+                {
+                    yield return key.Target;
+                }
+            }
+
+            IEnumerator IEnumerable.GetEnumerator()
+            {
+                return GetEnumerator();
+            }
+
+            public void CopyTo(TKey[] array, int arrayIndex)
+            {
+                throw new NotImplementedException("Implement this as needed");
+            }
+
+            public int Count
+            {
+                get { return _internalDict.Count + 1; }
+            }
+
+            public bool IsReadOnly
+            {
+                get { return true; }
+            }
+
+            #region Explicit Interface Definitions
+            bool ICollection<TKey>.Contains(TKey item)
+            {
+                throw new NotSupportedException();
+            }
+
+            void ICollection<TKey>.Add(TKey item)
+            {
+                throw new NotSupportedException();
+            }
+
+            void ICollection<TKey>.Clear()
+            {
+                throw new NotSupportedException();
+            }
+
+            bool ICollection<TKey>.Remove(TKey item)
+            {
+                throw new NotSupportedException();
+            }
+            #endregion
+        }
+        #endregion
+    }
+    #endregion
+
     #region WEAKHASHTABLE
     /// <summary>
     /// A Hashtable which holds weak references to its keys so they

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/AttributeSource.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/AttributeSource.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/AttributeSource.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/AttributeSource.cs Wed Nov  9 21:03:47 2011
@@ -36,8 +36,8 @@ namespace Lucene.Net.Util
 		public abstract class AttributeFactory
 		{
 			/// <summary> returns an <see cref="AttributeImpl" /> for the supplied <see cref="Attribute" /> interface class.
-			/// <p/>Signature for Java 1.5: <c>public AttributeImpl createAttributeInstance(Class%lt;? extends Attribute&gt; attClass)</c>
 			/// </summary>
+			//TODO: .NET has no Type<T>, so this can't be a compiler time check like in java
 			public abstract AttributeImpl CreateAttributeInstance(System.Type attClass);
 			
 			/// <summary> This is the default factory that creates <see cref="AttributeImpl" />s using the

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/AverageGuessMemoryModel.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/AverageGuessMemoryModel.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/AverageGuessMemoryModel.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/AverageGuessMemoryModel.cs Wed Nov  9 21:03:47 2011
@@ -29,7 +29,7 @@ namespace Lucene.Net.Util
 		{
 			InitBlock();
 		}
-		internal class AnonymousClassIdentityHashMap : System.Collections.Hashtable /*IdentityHashMap*/  // {{Aroush-2.9.0}} Port issue? Will this do the trick to mimic java's IdentityHashMap?
+		internal class AnonymousClassIdentityHashMap : System.Collections.Generic.Dictionary<Type, int> /*IdentityHashMap*/  // TODO: {{Aroush-2.9.0}} Port issue? Will this do the trick to mimic java's IdentityHashMap?
 		{
 			public AnonymousClassIdentityHashMap(AverageGuessMemoryModel enclosingInstance)
 			{
@@ -57,7 +57,7 @@ namespace Lucene.Net.Util
 				}
 				
 			}
-            // {{Aroush-2.9.0}} Port issue? Will this do the trick to mimic java's IdentityHashMap?
+            // TODO: {{Aroush-2.9.0}} Port issue? Will this do the trick to mimic java's IdentityHashMap?
             /*
              * From Java docs:
              * This class implements the Map interface with a hash table, using 
@@ -77,12 +77,13 @@ namespace Lucene.Net.Util
             }
             // {{Aroush-2.9.0}} Port issue, need to mimic java's IdentityHashMap
 		}
+
 		private void  InitBlock()
 		{
 			sizes = new AnonymousClassIdentityHashMap(this);
 		}
 		// best guess primitive sizes
-		private System.Collections.IDictionary sizes;
+        private System.Collections.Generic.Dictionary<Type, int> sizes;
 		
 		/*
 		* (non-Javadoc)
@@ -109,7 +110,7 @@ namespace Lucene.Net.Util
 		*/
 		public override int GetPrimitiveSize(System.Type clazz)
 		{
-			return ((System.Int32) sizes[clazz]);
+			return sizes[clazz];
 		}
 		
 		/* (non-Javadoc)

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/BitVector.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/BitVector.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/BitVector.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/BitVector.cs Wed Nov  9 21:03:47 2011
@@ -33,9 +33,7 @@ namespace Lucene.Net.Util
 	/// <item>store and load, as bit set or d-gaps, depending on sparseness;</item> 
 	/// </list>
 	/// </summary>
-	/// <version>  $Id: BitVector.java 765649 2009-04-16 14:29:26Z mikemccand $
-	/// </version>
-	public sealed class BitVector : System.ICloneable
+	public sealed class BitVector : ICloneable
 	{
 		
 		private byte[] bits;

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/Cache/Cache.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/Cache/Cache.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/Cache/Cache.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/Cache/Cache.cs Wed Nov  9 21:03:47 2011
@@ -22,30 +22,30 @@ namespace Lucene.Net.Util.Cache
 	
 	
 	/// <summary> Base class for cache implementations.</summary>
-	public abstract class Cache
+	public abstract class Cache<TKey, TValue> : IDisposable
 	{
 		
 		/// <summary> Simple Cache wrapper that synchronizes all
 		/// calls that access the cache. 
 		/// </summary>
-		internal class SynchronizedCache_Renamed_Class:Cache
+		internal class SynchronizedCache_Renamed_Class : Cache<TKey, TValue>
 		{
 			internal System.Object mutex;
-			internal Cache cache;
-			
-			internal SynchronizedCache_Renamed_Class(Cache cache)
+			internal Cache<TKey,TValue> cache;
+
+            internal SynchronizedCache_Renamed_Class(Cache<TKey, TValue> cache)
 			{
 				this.cache = cache;
 				this.mutex = this;
 			}
-			
-			internal SynchronizedCache_Renamed_Class(Cache cache, System.Object mutex)
+
+            internal SynchronizedCache_Renamed_Class(Cache<TKey, TValue> cache, System.Object mutex)
 			{
 				this.cache = cache;
 				this.mutex = mutex;
 			}
 			
-			public override void  Put(System.Object key, System.Object value_Renamed)
+			public override void Put(TKey key, TValue value_Renamed)
 			{
 				lock (mutex)
 				{
@@ -53,7 +53,7 @@ namespace Lucene.Net.Util.Cache
 				}
 			}
 			
-			public override System.Object Get(System.Object key)
+			public override TValue Get(System.Object key)
 			{
 				lock (mutex)
 				{
@@ -77,7 +77,7 @@ namespace Lucene.Net.Util.Cache
 				}
 			}
 			
-			internal override Cache GetSynchronizedCache()
+			internal override Cache<TKey,TValue> GetSynchronizedCache()
 			{
 				return this;
 			}
@@ -87,32 +87,41 @@ namespace Lucene.Net.Util.Cache
 		/// In order to guarantee thread-safety, all access to the backed cache must
 		/// be accomplished through the returned cache.
 		/// </summary>
-		public static Cache SynchronizedCache(Cache cache)
+        public static Cache<TKey, TValue> SynchronizedCache(Cache<TKey, TValue> cache)
 		{
 			return cache.GetSynchronizedCache();
 		}
 		
-		/// <summary> Called by <see cref="SynchronizedCache(Cache)" />. This method
+		/// <summary> Called by <see cref="SynchronizedCache(Cache{TKey,TValue})" />. This method
 		/// returns a <see cref="SynchronizedCache" /> instance that wraps
 		/// this instance by default and can be overridden to return
 		/// e. g. subclasses of <see cref="SynchronizedCache" /> or this
 		/// in case this cache is already synchronized.
 		/// </summary>
-		internal virtual Cache GetSynchronizedCache()
+        internal virtual Cache<TKey, TValue> GetSynchronizedCache()
 		{
-			return new SynchronizedCache_Renamed_Class(this);
+            return new SynchronizedCache_Renamed_Class(this);
 		}
 		
 		/// <summary> Puts a (key, value)-pair into the cache. </summary>
-		public abstract void  Put(System.Object key, System.Object value_Renamed);
+		public abstract void  Put(TKey key, TValue value_Renamed);
 		
 		/// <summary> Returns the value for the given key. </summary>
-		public abstract System.Object Get(System.Object key);
+		public abstract TValue Get(System.Object key);
 		
 		/// <summary> Returns whether the given key is in this cache. </summary>
 		public abstract bool ContainsKey(System.Object key);
-		
-		/// <summary> Closes the cache.</summary>
-		public abstract void  Close();
+
+	    /// <summary> Closes the cache.</summary>
+	    public abstract void Close();
+
+	    #region Implementation of IDisposable
+
+	    public void Dispose()
+	    {
+	        throw new NotImplementedException();
+	    }
+
+	    #endregion
 	}
 }
\ No newline at end of file

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/Cache/SimpleLRUCache.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/Cache/SimpleLRUCache.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/Cache/SimpleLRUCache.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/Cache/SimpleLRUCache.cs Wed Nov  9 21:03:47 2011
@@ -20,7 +20,7 @@ using System.Collections.Generic;
 
 namespace Lucene.Net.Util.Cache
 {
-    public class SimpleLRUCache : SimpleMapCache
+    public class SimpleLRUCache<TKey, TValue> : SimpleMapCache<TKey, TValue>
     {
         /// <summary>
         /// The maximum number of items to cache.
@@ -30,27 +30,27 @@ namespace Lucene.Net.Util.Cache
         /// <summary>
         /// The list to efficiently maintain the LRU state.
         /// </summary>
-        private LinkedList<ListValueEntry> list;
+        private LinkedList<ListValueEntry<TKey, TValue>> list;
 
         /// <summary>
         /// The dictionary to hash into any location in the list.
         /// </summary>
-        private Dictionary<object, LinkedListNode<ListValueEntry>> lookup;
+        private Dictionary<TKey, LinkedListNode<ListValueEntry<TKey, TValue>>> lookup;
 
         /// <summary>
         /// The node instance to use/re-use when adding an item to the cache.
         /// </summary>
-        private LinkedListNode<ListValueEntry> openNode;
+        private LinkedListNode<ListValueEntry<TKey, TValue>> openNode;
 
         public SimpleLRUCache(int Capacity)
         {
             this.capacity = Capacity;
-            this.list = new LinkedList<ListValueEntry>();
-            this.lookup = new Dictionary<object, LinkedListNode<ListValueEntry>>(Capacity + 1);
-            this.openNode = new LinkedListNode<ListValueEntry>(new ListValueEntry(null, null));
+            this.list = new LinkedList<ListValueEntry<TKey, TValue>>();
+            this.lookup = new Dictionary<TKey, LinkedListNode<ListValueEntry<TKey, TValue>>>(Capacity + 1);
+            this.openNode = new LinkedListNode<ListValueEntry<TKey, TValue>>(new ListValueEntry<TKey, TValue>(default(TKey), default(TValue)));
         }
 
-        public override void Put(object Key, object Value)
+        public override void Put(TKey Key, TValue Value)
         {
             if (Get(Key) == null)
             {
@@ -71,17 +71,17 @@ namespace Lucene.Net.Util.Cache
                 else
                 {
                     // still filling the cache, create a new open node for the next time
-                    this.openNode = new LinkedListNode<ListValueEntry>(new ListValueEntry(null, null));
+                    this.openNode = new LinkedListNode<ListValueEntry<TKey, TValue>>(new ListValueEntry<TKey, TValue>(default(TKey), default(TValue)));
                 }
             }
         }
 
-        public override object Get(object Key)
+        public override TValue Get(object Key)
         {
-            LinkedListNode<ListValueEntry> node = null;
-            if(!this.lookup.TryGetValue(Key, out node))
+            LinkedListNode<ListValueEntry<TKey, TValue>> node = null;
+            if (!this.lookup.TryGetValue((TKey)Key, out node))
             {
-                return null;
+                return default(TValue);
             }
             this.list.Remove(node);
             this.list.AddFirst(node);
@@ -92,12 +92,13 @@ namespace Lucene.Net.Util.Cache
         /// Container to hold the key and value to aid in removal from 
         /// the <see cref="lookup"/> dictionary when an item is removed from cache.
         /// </summary>
-        class ListValueEntry
+        class ListValueEntry<K, V> where K : TKey 
+                                   where V : TValue
         {
-            internal object ItemValue;
-            internal object ItemKey;
+            internal V ItemValue;
+            internal K ItemKey;
 
-            internal ListValueEntry(object key, object value)
+            internal ListValueEntry(K key, V value)
             {
                 this.ItemKey = key;
                 this.ItemValue = value;

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/Cache/SimpleMapCache.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/Cache/SimpleMapCache.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/Cache/SimpleMapCache.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/Cache/SimpleMapCache.cs Wed Nov  9 21:03:47 2011
@@ -16,6 +16,7 @@
  */
 
 using System;
+using System.Collections.Generic;
 
 namespace Lucene.Net.Util.Cache
 {
@@ -24,25 +25,26 @@ namespace Lucene.Net.Util.Cache
 	/// This cache is not synchronized, use <see cref="Cache.SynchronizedCache(Cache)" />
 	/// if needed.
 	/// </summary>
-	public class SimpleMapCache:Cache
+	public class SimpleMapCache<TKey, TValue> : Cache<TKey, TValue>
 	{
-		internal System.Collections.IDictionary map;
-		
-		public SimpleMapCache():this(new System.Collections.Hashtable())
+		internal System.Collections.Generic.Dictionary<TKey, TValue> map;
+
+        public SimpleMapCache()
+            : this(new System.Collections.Generic.Dictionary<TKey, TValue>())
 		{
 		}
-		
-		public SimpleMapCache(System.Collections.IDictionary map)
+
+        public SimpleMapCache(System.Collections.Generic.Dictionary<TKey, TValue> map)
 		{
 			this.map = map;
 		}
 		
-		public override System.Object Get(System.Object key)
+		public override TValue Get(System.Object key)
 		{
-			return map[key];
+			return map[(TKey)key];
 		}
 		
-		public override void  Put(System.Object key, System.Object value_Renamed)
+		public override void  Put(TKey key, TValue value_Renamed)
 		{
 			map[key] = value_Renamed;
 		}
@@ -54,32 +56,32 @@ namespace Lucene.Net.Util.Cache
 		
 		public override bool ContainsKey(System.Object key)
 		{
-			return map.Contains(key);
+			return map.ContainsKey((TKey)key);
 		}
 		
 		/// <summary> Returns a Set containing all keys in this cache.</summary>
-		public virtual System.Collections.ICollection KeySet()
+		public virtual System.Collections.Generic.HashSet<TKey> KeySet()
 		{
-			return map.Keys;
+			return new HashSet<TKey>(map.Keys);
 		}
 		
-		internal override Cache GetSynchronizedCache()
+		internal override Cache<TKey, TValue> GetSynchronizedCache()
 		{
 			return new SynchronizedSimpleMapCache(this);
 		}
 		
-		private class SynchronizedSimpleMapCache:SimpleMapCache
+		private class SynchronizedSimpleMapCache : SimpleMapCache<TKey, TValue>
 		{
-			internal System.Object mutex;
-			internal SimpleMapCache cache;
-			
-			internal SynchronizedSimpleMapCache(SimpleMapCache cache)
+			private System.Object mutex;
+            private SimpleMapCache<TKey, TValue> cache;
+
+            internal SynchronizedSimpleMapCache(SimpleMapCache<TKey, TValue> cache)
 			{
 				this.cache = cache;
 				this.mutex = this;
 			}
 			
-			public override void  Put(System.Object key, System.Object value_Renamed)
+			public override void  Put(TKey key, TValue value_Renamed)
 			{
 				lock (mutex)
 				{
@@ -87,7 +89,7 @@ namespace Lucene.Net.Util.Cache
 				}
 			}
 			
-			public override System.Object Get(System.Object key)
+			public override TValue Get(System.Object key)
 			{
 				lock (mutex)
 				{
@@ -111,7 +113,7 @@ namespace Lucene.Net.Util.Cache
 				}
 			}
 			
-			public override System.Collections.ICollection KeySet()
+			public override HashSet<TKey> KeySet()
 			{
 				lock (mutex)
 				{
@@ -119,7 +121,7 @@ namespace Lucene.Net.Util.Cache
 				}
 			}
 			
-			internal override Cache GetSynchronizedCache()
+			internal override Cache<TKey, TValue> GetSynchronizedCache()
 			{
 				return this;
 			}

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/CloseableThreadLocal.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/CloseableThreadLocal.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/CloseableThreadLocal.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/CloseableThreadLocal.cs Wed Nov  9 21:03:47 2011
@@ -44,24 +44,25 @@ namespace Lucene.Net.Util
     /// </summary>
     /// 
 
-    public class CloseableThreadLocal
+    public class CloseableThreadLocal<T> : IDisposable where T : class
     {
+        // NOTE: Java has WeakReference<T>.  This isn't available for .Net until 4.5 (according to msdn docs)
         private ThreadLocal<WeakReference> t = new ThreadLocal<WeakReference>();
 
-        private Dictionary<Thread, object> hardRefs = new Dictionary<Thread, object>();
+        private Dictionary<Thread, T> hardRefs = new Dictionary<Thread, T>();
 
 
-        public virtual object InitialValue()
+        public virtual T InitialValue()
         {
             return null;
         }
 
-        public virtual object Get()
+        public virtual T Get()
         {
             WeakReference weakRef = t.Get();
             if (weakRef == null)
             {
-                object iv = InitialValue();
+                T iv = InitialValue();
                 if (iv != null)
                 {
                     Set(iv);
@@ -72,11 +73,11 @@ namespace Lucene.Net.Util
             }
             else
             {
-                return weakRef.Get();
+                return (T)weakRef.Get();
             }
         }
 
-        public virtual void Set(object @object)
+        public virtual void Set(T @object)
         {
             //+-- For Debuging
             if (SupportClass.CloseableThreadLocalProfiler.EnableCloseableThreadLocalProfiler == true)
@@ -96,7 +97,7 @@ namespace Lucene.Net.Util
                 hardRefs.Add(Thread.CurrentThread, @object);
 
                 // Purge dead threads
-                foreach (var thread in new List<Thread>(hardRefs.Keys))
+                foreach (var thread in hardRefs.Keys)
                 {
                     if (!thread.IsAlive)
                         hardRefs.Remove(thread);
@@ -107,6 +108,11 @@ namespace Lucene.Net.Util
 
         public virtual void Close()
         {
+            Dispose();
+        }
+
+        public void Dispose()
+        {
             // Clear the hard refs; then, the only remaining refs to
             // all values we were storing are weak (unless somewhere
             // else is still using them) and so GC may reclaim them:

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/Constants.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/Constants.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/Constants.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/Constants.cs Wed Nov  9 21:03:47 2011
@@ -22,14 +22,7 @@ using LucenePackage = Lucene.Net.LuceneP
 namespace Lucene.Net.Util
 {
 	
-	/// <summary> Some useful constants.
-	/// 
-	/// 
-	/// </summary>
-	/// <version>  $Id: Constants.java 828327 2009-10-22 06:47:40Z uschindler $
-	/// 
-	/// </version>
-	
+	/// <summary> Some useful constants.</summary>
 	public sealed class Constants
 	{
 		private Constants()

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/DocIdBitSet.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/DocIdBitSet.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/DocIdBitSet.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/DocIdBitSet.cs Wed Nov  9 21:03:47 2011
@@ -22,8 +22,6 @@ using DocIdSetIterator = Lucene.Net.Sear
 
 namespace Lucene.Net.Util
 {
-	
-	
 	/// <summary>Simple DocIdSet and DocIdSetIterator backed by a BitSet </summary>
 	public class DocIdBitSet:DocIdSet
 	{
@@ -62,29 +60,11 @@ namespace Lucene.Net.Util
 				this.docId = - 1;
 			}
 			
-			/// <deprecated> use <see cref="DocID()" /> instead. 
-			/// </deprecated>
-            [Obsolete("use DocID() instead.")]
-			public override int Doc()
-			{
-				System.Diagnostics.Debug.Assert(docId != - 1);
-				return docId;
-			}
-			
 			public override int DocID()
 			{
 				return docId;
 			}
 			
-			/// <deprecated> use <see cref="NextDoc()" /> instead. 
-			/// </deprecated>
-            [Obsolete("use NextDoc() instead.")]
-			public override bool Next()
-			{
-				// (docId + 1) on next line requires -1 initial value for docNr:
-				return NextDoc() != NO_MORE_DOCS;
-			}
-			
 			public override int NextDoc()
 			{
 				// (docId + 1) on next line requires -1 initial value for docNr:
@@ -94,14 +74,6 @@ namespace Lucene.Net.Util
 				return docId;
 			}
 			
-			/// <deprecated> use <see cref="Advance(int)" /> instead. 
-			/// </deprecated>
-            [Obsolete("use Advance(int) instead.")]
-			public override bool SkipTo(int skipDocNr)
-			{
-				return Advance(skipDocNr) != NO_MORE_DOCS;
-			}
-			
 			public override int Advance(int target)
 			{
 				int d = SupportClass.BitSetSupport.NextSetBit(bitSet, target);

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/FieldCacheSanityChecker.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/FieldCacheSanityChecker.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/FieldCacheSanityChecker.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/FieldCacheSanityChecker.cs Wed Nov  9 21:03:47 2011
@@ -79,11 +79,11 @@ namespace Lucene.Net.Util
 		}
 		
 		/// <summary> Quick and dirty convenience method that instantiates an instance with 
-		/// "good defaults" and uses it to test the CacheEntry[]
+		/// "good defaults" and uses it to test the CacheEntrys
 		/// </summary>
 		/// <seealso cref="Check">
 		/// </seealso>
-		public static Insanity[] CheckSanity(CacheEntry[] cacheEntries)
+		public static Insanity[] CheckSanity(params CacheEntry[] cacheEntries)
 		{
 			FieldCacheSanityChecker sanityChecker = new FieldCacheSanityChecker();
 			// doesn't check for interned
@@ -98,7 +98,7 @@ namespace Lucene.Net.Util
 		/// (:TODO: is this a bad idea? are we masking a real problem?)
 		/// <p/>
 		/// </summary>
-		public Insanity[] Check(CacheEntry[] cacheEntries)
+		public Insanity[] Check(params CacheEntry[] cacheEntries)
 		{
 			if (null == cacheEntries || 0 == cacheEntries.Length)
 				return new Insanity[0];
@@ -115,14 +115,13 @@ namespace Lucene.Net.Util
 			//
 			// maps the (valId) identityhashCode of cache values to 
 			// sets of CacheEntry instances
-			MapOfSets<int,CacheEntry> valIdToItems = new MapOfSets<int,CacheEntry>(new Dictionary<int,Dictionary<CacheEntry,CacheEntry>>(17));
+			MapOfSets<int,CacheEntry> valIdToItems = new MapOfSets<int,CacheEntry>(new Dictionary<int,HashSet<CacheEntry>>(17));
 			// maps ReaderField keys to Sets of ValueIds
-			MapOfSets<ReaderField,int> readerFieldToValIds = new MapOfSets<ReaderField,int>(new Dictionary<ReaderField,Dictionary<int,int>>(17));
+			MapOfSets<ReaderField,int> readerFieldToValIds = new MapOfSets<ReaderField,int>(new Dictionary<ReaderField,HashSet<int>>(17));
 			//
 			
 			// any keys that we know result in more then one valId
-            // TODO: This will be a HashSet<T> when we start using .NET Framework 3.5
-            Dictionary<ReaderField, ReaderField> valMismatchKeys = new Dictionary<ReaderField, ReaderField>();
+            HashSet<ReaderField> valMismatchKeys = new HashSet<ReaderField>();
 			
 			// iterate over all the cacheEntries to get the mappings we'll need
 			for (int i = 0; i < cacheEntries.Length; i++)
@@ -141,10 +140,7 @@ namespace Lucene.Net.Util
 				valIdToItems.Put(valId, item);
 				if (1 < readerFieldToValIds.Put(rf, valId))
 				{
-                    if (!valMismatchKeys.ContainsKey(rf))
-                    {
-                        valMismatchKeys.Add(rf, rf);
-                    }
+                    valMismatchKeys.Add(rf);
 				}
 			}
 			
@@ -163,7 +159,9 @@ namespace Lucene.Net.Util
 		/// </summary>
 		/// <seealso cref="InsanityType.VALUEMISMATCH">
 		/// </seealso>
-		private List<Insanity> CheckValueMismatch(MapOfSets<int,CacheEntry> valIdToItems, MapOfSets<ReaderField,int> readerFieldToValIds, Dictionary<ReaderField,ReaderField> valMismatchKeys)
+		private List<Insanity> CheckValueMismatch(MapOfSets<int,CacheEntry> valIdToItems, 
+                                                  MapOfSets<ReaderField,int> readerFieldToValIds, 
+                                                  HashSet<ReaderField> valMismatchKeys)
 		{
 			
 			List<Insanity> insanity = new List<Insanity>(valMismatchKeys.Count * 3);
@@ -172,14 +170,14 @@ namespace Lucene.Net.Util
 			{
 				// we have multiple values for some ReaderFields
 				
-                IDictionary<ReaderField,Dictionary<int,int>> rfMap = readerFieldToValIds.GetMap();
-                IDictionary<int,Dictionary<CacheEntry,CacheEntry>> valMap = valIdToItems.GetMap();
-                foreach (ReaderField rf in valMismatchKeys.Keys)
+                IDictionary<ReaderField,HashSet<int>> rfMap = readerFieldToValIds.GetMap();
+                IDictionary<int,HashSet<CacheEntry>> valMap = valIdToItems.GetMap();
+                foreach (ReaderField rf in valMismatchKeys)
                 {
                     List<CacheEntry> badEntries = new List<CacheEntry>(valMismatchKeys.Count * 2);
-                    foreach (int val in rfMap[rf].Keys)
+                    foreach (int val in rfMap[rf])
                     {
-                        foreach (CacheEntry entry in valMap[val].Keys)
+                        foreach (CacheEntry entry in valMap[val])
                         {
                             badEntries.Add(entry);
                         }
@@ -199,28 +197,28 @@ namespace Lucene.Net.Util
 		/// </summary>
 		/// <seealso cref="InsanityType.SUBREADER">
 		/// </seealso>
-		private List<Insanity> CheckSubreaders(MapOfSets<int,CacheEntry> valIdToItems, MapOfSets<ReaderField,int> readerFieldToValIds)
+		private List<Insanity> CheckSubreaders(MapOfSets<int,CacheEntry> valIdToItems, 
+                                               MapOfSets<ReaderField,int> readerFieldToValIds)
 		{
-			
             List<Insanity> insanity = new List<Insanity>(23);
 
-            Dictionary<ReaderField, Dictionary<ReaderField, ReaderField>> badChildren = new Dictionary<ReaderField, Dictionary<ReaderField, ReaderField>>(17);
+            Dictionary<ReaderField, HashSet<ReaderField>> badChildren = new Dictionary<ReaderField, HashSet<ReaderField>>(17);
 			MapOfSets<ReaderField, ReaderField> badKids = new MapOfSets<ReaderField, ReaderField>(badChildren); // wrapper
 
-            IDictionary<int, Dictionary<CacheEntry, CacheEntry>> viToItemSets = valIdToItems.GetMap();
-            IDictionary<ReaderField, Dictionary<int, int>> rfToValIdSets = readerFieldToValIds.GetMap();
+            IDictionary<int, HashSet<CacheEntry>> viToItemSets = valIdToItems.GetMap();
+            IDictionary<ReaderField, HashSet<int>> rfToValIdSets = readerFieldToValIds.GetMap();
 
-            Dictionary<ReaderField, ReaderField> seen = new Dictionary<ReaderField, ReaderField>(17);
+            HashSet<ReaderField> seen = new HashSet<ReaderField>();
 
             foreach (ReaderField rf in rfToValIdSets.Keys)
             {
-                if (seen.ContainsKey(rf))
+                if (seen.Contains(rf))
                     continue;
 
                 System.Collections.IList kids = GetAllDecendentReaderKeys(rf.readerKey);
-				for (int i = 0; i < kids.Count; i++)
+				foreach (Object kidKey in kids)
 				{
-					ReaderField kid = new ReaderField(kids[i], rf.fieldName);
+                    ReaderField kid = new ReaderField(kidKey, rf.fieldName);
 
 					if (badChildren.ContainsKey(kid))
 					{
@@ -235,38 +233,32 @@ namespace Lucene.Net.Util
 						// we have cache entries for the kid
 						badKids.Put(rf, kid);
 					}
-                    if (!seen.ContainsKey(kid))
-                    {
-                        seen.Add(kid, kid);
-                    }
+                    seen.Add(kid);
 				}
-                if (!seen.ContainsKey(rf))
-                {
-                    seen.Add(rf, rf);
-                }
+                seen.Add(rf);
 			}
 			
 			// every mapping in badKids represents an Insanity
 			foreach (ReaderField parent in badChildren.Keys)
 			{
-				Dictionary<ReaderField,ReaderField> kids = badChildren[parent];
+				HashSet<ReaderField> kids = badChildren[parent];
 				
 				List<CacheEntry> badEntries = new List<CacheEntry>(kids.Count * 2);
 				
 				// put parent entr(ies) in first
 				{
-					foreach (int val in rfToValIdSets[parent].Keys)
+					foreach (int val in rfToValIdSets[parent])
 					{
-						badEntries.AddRange(viToItemSets[val].Keys);
+						badEntries.AddRange(viToItemSets[val]);
 					}
 				}
 				
 				// now the entries for the descendants
-				foreach (ReaderField kid in kids.Keys)
+				foreach (ReaderField kid in kids)
 				{
-					foreach (int val in rfToValIdSets[kid].Keys)
+					foreach (int val in rfToValIdSets[kid])
 					{
-						badEntries.AddRange(viToItemSets[val].Keys);
+						badEntries.AddRange(viToItemSets[val]);
 					}
 				}
 				
@@ -282,7 +274,7 @@ namespace Lucene.Net.Util
 		/// </summary>
 		private System.Collections.IList GetAllDecendentReaderKeys(System.Object seed)
 		{
-			System.Collections.IList all = new System.Collections.ArrayList(17); // will grow as we iter
+			List<object> all = new List<object>(17); // will grow as we iter
 			all.Add(seed);
 			for (int i = 0; i < all.Count; i++)
 			{
@@ -297,7 +289,7 @@ namespace Lucene.Net.Util
 				}
 			}
 			// need to skip the first, because it was the seed
-			return (System.Collections.IList) ((System.Collections.ArrayList) all).GetRange(1, all.Count - 1);
+			return all.GetRange(1, all.Count - 1);
 		}
 		
 		/// <summary> Simple pair object for using "readerKey + fieldName" a Map key</summary>
@@ -337,7 +329,7 @@ namespace Lucene.Net.Util
 			private InsanityType type;
 			private System.String msg;
 			private CacheEntry[] entries;
-			public Insanity(InsanityType type, System.String msg, CacheEntry[] entries)
+			public Insanity(InsanityType type, System.String msg, params CacheEntry[] entries)
 			{
 				if (null == type)
 				{

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/MapOfSets.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/MapOfSets.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/MapOfSets.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/MapOfSets.cs Wed Nov  9 21:03:47 2011
@@ -16,27 +16,26 @@
  */
 
 using System;
+using System.Collections.Generic;
 
 namespace Lucene.Net.Util
 {
 	
 	/// <summary> Helper class for keeping Listss of Objects associated with keys. <b>WARNING: THIS CLASS IS NOT THREAD SAFE</b></summary>
-    public class MapOfSets<T, V>
+    public class MapOfSets<TKey, TValue>
     {
-		
-		// TODO: This will be a HashSet<T> when we start using .NET Framework 3.5
-		private System.Collections.Generic.IDictionary<T, System.Collections.Generic.Dictionary<V, V>> theMap;
+		private IDictionary<TKey, HashSet<TValue>> theMap;
 		
 		/// <param name="m">the backing store for this object
 		/// </param>
-		public MapOfSets(System.Collections.Generic.IDictionary<T, System.Collections.Generic.Dictionary<V, V>> m)
+        public MapOfSets(IDictionary<TKey, HashSet<TValue>> m)
 		{
 			theMap = m;
 		}
 		
 		/// <returns> direct access to the map backing this object.
 		/// </returns>
-		public virtual System.Collections.Generic.IDictionary<T, System.Collections.Generic.Dictionary<V, V>> GetMap()
+        public virtual IDictionary<TKey, HashSet<TValue>> GetMap()
 		{
 			return theMap;
 		}
@@ -46,19 +45,15 @@ namespace Lucene.Net.Util
 		/// </summary>
 		/// <returns> the size of the Set associated with key once val is added to it.
 		/// </returns>
-		public virtual int Put(T key, V val)
+		public virtual int Put(TKey key, TValue val)
 		{
-            // TODO: This will be a HashSet<T> when we start using .NET Framework 3.5
-            System.Collections.Generic.Dictionary<V, V> theSet;
+            HashSet<TValue> theSet;
             if (!theMap.TryGetValue(key, out theSet))
             {
-                theSet = new System.Collections.Generic.Dictionary<V, V>(23);
+                theSet = new HashSet<TValue>();
                 theMap[key] = theSet;
             }
-            if (!theSet.ContainsKey(val))
-            {
-                theSet.Add(val, val);
-            }
+            theSet.Add(val);
 			return theSet.Count;
 		}
 		/// <summary> Adds multiple vals to the Set associated with key in the Map.  
@@ -67,22 +62,15 @@ namespace Lucene.Net.Util
 		/// </summary>
 		/// <returns> the size of the Set associated with key once val is added to it.
 		/// </returns>
-		public virtual int PutAll(T key, System.Collections.Generic.Dictionary<V, V> vals)
+		public virtual int PutAll(TKey key, IEnumerable<TValue> vals)
 		{
-            // TODO: This will be a HashSet<T> when we start using .NET Framework 3.5
-            System.Collections.Generic.Dictionary<V, V> theSet;
+            HashSet<TValue> theSet;
             if (!theMap.TryGetValue(key, out theSet))
             {
-                theSet = new System.Collections.Generic.Dictionary<V, V>(23);
+                theSet = new HashSet<TValue>();
                 theMap[key] = theSet;
             }
-            foreach(V item in vals.Keys)
-            {
-                if (!theSet.ContainsKey(item))
-                {
-                    theSet.Add(item, item);
-                }
-            }
+		    theSet.UnionWith(vals);
 			return theSet.Count;
 		}
 	}

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/OpenBitSet.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/OpenBitSet.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/OpenBitSet.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/OpenBitSet.cs Wed Nov  9 21:03:47 2011
@@ -900,7 +900,7 @@ namespace Lucene.Net.Util
 		
 		
 		/// <summary>returns true if both sets have the same bits set </summary>
-		public  override bool Equals(System.Object o)
+		public override bool Equals(System.Object o)
 		{
 			if (this == o)
 				return true;

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/OpenBitSetIterator.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/OpenBitSetIterator.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/OpenBitSetIterator.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/OpenBitSetIterator.cs Wed Nov  9 21:03:47 2011
@@ -37,8 +37,49 @@ namespace Lucene.Net.Util
 		// packed inside a 32 bit integer (8 4 bit numbers).  That
 		// should be faster than accessing an array for each index, and
 		// the total array size is kept smaller (256*sizeof(int))=1K
-		protected internal static readonly uint[] bitlist = new uint[]{0x0, 0x1, 0x2, 0x21, 0x3, 0x31, 0x32, 0x321, 0x4, 0x41, 0x42, 0x421, 0x43, 0x431, 0x432, 0x4321, 0x5, 0x51, 0x52, 0x521, 0x53, 0x531, 0x532, 0x5321, 0x54, 0x541, 0x542, 0x5421, 0x543, 0x5431, 0x5432, 0x54321, 0x6, 0x61, 0x62, 0x621, 0x63, 0x631, 0x632, 0x6321, 0x64, 0x641, 0x642, 0x6421, 0x643, 0x6431, 0x6432, 0x64321, 0x65, 0x651, 0x652, 0x6521, 0x653, 0x6531, 0x6532, 0x65321, 0x654, 0x6541, 0x6542, 0x65421, 0x6543, 0x65431, 0x65432, 0x654321, 0x7, 0x71, 0x72, 0x721, 0x73, 0x731, 0x732, 0x7321, 0x74, 0x741, 0x742, 0x7421, 0x743, 0x7431, 0x7432, 0x74321, 0x75, 0x751, 0x752, 0x7521, 0x753, 0x7531, 0x7532, 0x75321, 0x754, 0x7541, 0x7542, 0x75421, 0x7543, 0x75431, 0x75432, 0x754321, 0x76, 0x761, 0x762, 0x7621, 0x763, 0x7631, 0x7632, 0x76321, 0x764, 0x7641, 0x7642, 0x76421, 0x7643, 0x76431, 0x76432, 0x764321, 0x765, 0x7651, 0x7652, 0x76521, 0x7653, 0x76531, 0x76532, 0x765321, 0x7654, 0x76541, 0x76542, 0x765421, 0x7
 6543, 0x765431, 0x765432, 0x7654321, 0x8, 0x81, 0x82, 0x821, 0x83, 0x831, 0x832, 0x8321, 0x84, 0x841, 0x842, 0x8421, 0x843, 0x8431, 0x8432, 0x84321, 0x85, 0x851, 0x852, 0x8521, 0x853, 0x8531, 0x8532, 0x85321, 0x854, 0x8541, 0x8542, 0x85421, 0x8543, 0x85431, 0x85432, 0x854321, 0x86, 0x861, 0x862, 0x8621, 0x863, 0x8631, 0x8632, 0x86321, 0x864, 0x8641, 0x8642, 0x86421, 0x8643, 0x86431, 0x86432, 0x864321, 0x865, 0x8651, 0x8652, 0x86521, 0x8653, 0x86531, 0x86532, 0x865321, 0x8654, 0x86541, 0x86542, 0x865421, 0x86543, 0x865431, 0x865432, 0x8654321, 0x87, 0x871, 0x872, 0x8721, 0x873, 0x8731, 0x8732, 0x87321, 0x874, 0x8741, 0x8742, 0x87421, 0x8743, 0x87431, 0x87432, 0x874321, 0x875, 0x8751, 0x8752, 0x87521, 0x8753, 0x87531, 0x87532, 0x875321, 0x8754, 0x87541, 0x87542, 0x875421, 0x87543, 0x875431, 0x875432, 0x8754321, 0x876, 0x8761, 0x8762, 0x87621, 0x8763, 0x87631, 0x87632, 0x876321, 0x8764, 0x87641, 0x87642, 0x876421, 0x87643, 0x876431, 0x876432, 0x8764321, 0x8765, 0x87651, 0x87652
 , 0x876521, 0x87653, 0x876531, 0x876532, 0x8765321, 0x87654, 
-			0x876541, 0x876542, 0x8765421, 0x876543, 0x8765431, 0x8765432, 0x87654321};
+	    protected internal static readonly uint[] bitlist = new uint[]
+	                                                            {
+	                                                                0x0, 0x1, 0x2, 0x21, 0x3, 0x31, 0x32, 0x321, 0x4, 0x41,
+	                                                                0x42, 0x421, 0x43, 0x431, 0x432, 0x4321, 0x5, 0x51,
+	                                                                0x52, 0x521, 0x53, 0x531, 0x532, 0x5321, 0x54, 0x541,
+	                                                                0x542, 0x5421, 0x543, 0x5431, 0x5432, 0x54321, 0x6,
+	                                                                0x61, 0x62, 0x621, 0x63, 0x631, 0x632, 0x6321, 0x64,
+	                                                                0x641, 0x642, 0x6421, 0x643, 0x6431, 0x6432, 0x64321,
+	                                                                0x65, 0x651, 0x652, 0x6521, 0x653, 0x6531, 0x6532,
+	                                                                0x65321, 0x654, 0x6541, 0x6542, 0x65421, 0x6543,
+	                                                                0x65431, 0x65432, 0x654321, 0x7, 0x71, 0x72, 0x721,
+	                                                                0x73, 0x731, 0x732, 0x7321, 0x74, 0x741, 0x742, 0x7421,
+	                                                                0x743, 0x7431, 0x7432, 0x74321, 0x75, 0x751, 0x752,
+	                                                                0x7521, 0x753, 0x7531, 0x7532, 0x75321, 0x754, 0x7541,
+	                                                                0x7542, 0x75421, 0x7543, 0x75431, 0x75432, 0x754321,
+	                                                                0x76, 0x761, 0x762, 0x7621, 0x763, 0x7631, 0x7632,
+	                                                                0x76321, 0x764, 0x7641, 0x7642, 0x76421, 0x7643,
+	                                                                0x76431, 0x76432, 0x764321, 0x765, 0x7651, 0x7652,
+	                                                                0x76521, 0x7653, 0x76531, 0x76532, 0x765321, 0x7654,
+	                                                                0x76541, 0x76542, 0x765421, 0x76543, 0x765431, 0x765432
+	                                                                , 0x7654321, 0x8, 0x81, 0x82, 0x821, 0x83, 0x831, 0x832
+	                                                                , 0x8321, 0x84, 0x841, 0x842, 0x8421, 0x843, 0x8431,
+	                                                                0x8432, 0x84321, 0x85, 0x851, 0x852, 0x8521, 0x853,
+	                                                                0x8531, 0x8532, 0x85321, 0x854, 0x8541, 0x8542, 0x85421
+	                                                                , 0x8543, 0x85431, 0x85432, 0x854321, 0x86, 0x861,
+	                                                                0x862, 0x8621, 0x863, 0x8631, 0x8632, 0x86321, 0x864,
+	                                                                0x8641, 0x8642, 0x86421, 0x8643, 0x86431, 0x86432,
+	                                                                0x864321, 0x865, 0x8651, 0x8652, 0x86521, 0x8653,
+	                                                                0x86531, 0x86532, 0x865321, 0x8654, 0x86541, 0x86542,
+	                                                                0x865421, 0x86543, 0x865431, 0x865432, 0x8654321, 0x87,
+	                                                                0x871, 0x872, 0x8721, 0x873, 0x8731, 0x8732, 0x87321,
+	                                                                0x874, 0x8741, 0x8742, 0x87421, 0x8743, 0x87431,
+	                                                                0x87432, 0x874321, 0x875, 0x8751, 0x8752, 0x87521,
+	                                                                0x8753, 0x87531, 0x87532, 0x875321, 0x8754, 0x87541,
+	                                                                0x87542, 0x875421, 0x87543, 0x875431, 0x875432,
+	                                                                0x8754321, 0x876, 0x8761, 0x8762, 0x87621, 0x8763,
+	                                                                0x87631, 0x87632, 0x876321, 0x8764, 0x87641, 0x87642,
+	                                                                0x876421, 0x87643, 0x876431, 0x876432, 0x8764321,
+	                                                                0x8765, 0x87651, 0x87652, 0x876521, 0x87653, 0x876531,
+	                                                                0x876532, 0x8765321, 0x87654,
+	                                                                0x876541, 0x876542, 0x8765421, 0x876543, 0x8765431,
+	                                                                0x8765432, 0x87654321
+	                                                            };
 		/// <summary>** the python code that generated bitlist
 		/// def bits2int(val):
 		/// arr=0
@@ -116,14 +157,6 @@ namespace Lucene.Net.Util
 		/// ****
 		/// </summary>*/
 		
-		/// <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 (indexArray == 0)
@@ -156,14 +189,6 @@ namespace Lucene.Net.Util
 			return curDocId = (i << 6) + bitIndex;
 		}
 		
-		/// <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)
 		{
 			indexArray = 0;
@@ -201,14 +226,6 @@ namespace Lucene.Net.Util
 			return curDocId = (i << 6) + bitIndex;
 		}
 		
-		/// <deprecated> use <see cref="DocID()" /> instead. 
-		/// </deprecated>
-        [Obsolete("use DocID() instead.")]
-		public override int Doc()
-		{
-			return curDocId;
-		}
-		
 		public override int DocID()
 		{
 			return curDocId;

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/Parameter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/Parameter.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/Parameter.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/Parameter.cs Wed Nov  9 21:03:47 2011
@@ -55,7 +55,8 @@ namespace Lucene.Net.Util
 		{
 			return name;
 		}
-		
+
+		// TODO: Why is this commented out?  Java has this code uncommented.
 		/// <summary> Resolves the deserialized instance to the local reference for accurate
 		/// equals() and == comparisons.
 		/// 

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/PriorityQueue.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/PriorityQueue.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/PriorityQueue.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/PriorityQueue.cs Wed Nov  9 21:03:47 2011
@@ -28,16 +28,16 @@ namespace Lucene.Net.Util
 	/// length <c>maxSize+1</c>, in <see cref="Initialize" />.
 	/// 
 	/// </summary>
-	public abstract class PriorityQueue
+	public abstract class PriorityQueue<T> where T : class
 	{
 		private int size;
 		private int maxSize;
-		protected internal System.Object[] heap;
+		protected internal T[] heap;
 		
 		/// <summary>Determines the ordering of objects in this priority queue.  Subclasses
 		/// must define this one method. 
 		/// </summary>
-		public abstract bool LessThan(System.Object a, System.Object b);
+		public abstract bool LessThan(T a, T b);
 		
 		/// <summary> This method can be overridden by extending classes to return a sentinel
 		/// object which will be used by <see cref="Initialize(int)" /> to fill the queue, so
@@ -45,7 +45,7 @@ namespace Lucene.Net.Util
 		/// change the top without attempting to insert any new object.<br/>
 		/// 
 		/// Those sentinel values should always compare worse than any non-sentinel
-		/// value (i.e., <see cref="LessThan(Object, Object)" /> should always favor the
+		/// value (i.e., <see cref="LessThan" /> should always favor the
 		/// non-sentinel values).<br/>
 		/// 
 		/// By default, this method returns false, which means the queue will not be
@@ -57,9 +57,9 @@ namespace Lucene.Net.Util
 		/// 
         /// <code>
 		/// // extends getSentinelObject() to return a non-null value.
-		/// PriorityQueue pq = new MyQueue(numHits);
+        /// PriorityQueue&lt;MyObject&gt; pq = new MyQueue&lt;MyObject&gt;(numHits);
 		/// // save the 'top' element, which is guaranteed to not be null.
-		/// MyObject pqTop = (MyObject) pq.top();
+		/// MyObject pqTop = pq.top();
 		/// &lt;...&gt;
 		/// // now in order to add a new element, which is 'better' than top (after 
 		/// // you've verified it is better), it is as simple as:
@@ -78,7 +78,7 @@ namespace Lucene.Net.Util
 		/// <returns> the sentinel object to use to pre-populate the queue, or null if
 		/// sentinel objects are not supported.
 		/// </returns>
-		protected internal virtual System.Object GetSentinelObject()
+		protected internal virtual T GetSentinelObject()
 		{
 			return null;
 		}
@@ -112,11 +112,11 @@ namespace Lucene.Net.Util
                     heapSize = maxSize + 1;
                 }
             }
-			heap = new System.Object[heapSize];
+			heap = new T[heapSize];
 			this.maxSize = maxSize;
 			
 			// If sentinel objects are supported, populate the queue with them
-			System.Object sentinel = GetSentinelObject();
+			T sentinel = GetSentinelObject();
 			if (sentinel != null)
 			{
 				heap[1] = sentinel;
@@ -128,56 +128,23 @@ namespace Lucene.Net.Util
 			}
 		}
 		
-		/// <summary> Adds an Object to a PriorityQueue in log(size) time. If one tries to add
-		/// more objects than maxSize from initialize a RuntimeException
-		/// (ArrayIndexOutOfBound) is thrown.
-		/// 
-		/// </summary>
-		/// <deprecated> use <see cref="Add(Object)" /> which returns the new top object,
-		/// saving an additional call to <see cref="Top()" />.
-		/// </deprecated>
-        [Obsolete("use Add(Object) which returns the new top object, saving an additional call to Top().")]
-		public void  Put(System.Object element)
-		{
-			size++;
-			heap[size] = element;
-			UpHeap();
-		}
-		
-		/// <summary> Adds an Object to a PriorityQueue in log(size) time. If one tries to add
+		/// <summary> 
+		/// Adds an Object to a PriorityQueue in log(size) time. If one tries to add
 		/// more objects than maxSize from initialize an
 		/// <see cref="System.IndexOutOfRangeException" /> is thrown.
-		/// 
 		/// </summary>
 		/// <returns> the new 'top' element in the queue.
 		/// </returns>
-		public System.Object Add(System.Object element)
+		public T Add(T element)
 		{
 			size++;
 			heap[size] = element;
 			UpHeap();
 			return heap[1];
 		}
-		
-		/// <summary> Adds element to the PriorityQueue in log(size) time if either the
-		/// PriorityQueue is not full, or not lessThan(element, top()).
-		/// 
-		/// </summary>
-		/// <param name="element">
-		/// </param>
-		/// <returns> true if element is added, false otherwise.
-		/// </returns>
-		/// <deprecated> use <see cref="InsertWithOverflow(Object)" /> instead, which
-		/// encourages objects reuse.
-		/// </deprecated>
-        [Obsolete("use InsertWithOverflow(Object) instead, which encourages objects reuse.")]
-		public virtual bool Insert(System.Object element)
-		{
-			return InsertWithOverflow(element) != element;
-		}
-		
-		/// <summary> insertWithOverflow() is the same as insert() except its
-		/// return value: it returns the object (if any) that was
+
+        /// <summary> Adds an Object to a PriorityQueue in log(size) time.
+        /// It returns the object (if any) that was
 		/// dropped off the heap because it was full. This can be
 		/// the given parameter (in case it is smaller than the
 		/// full heap's minimum, and couldn't be added), or another
@@ -185,18 +152,18 @@ namespace Lucene.Net.Util
 		/// heap and now has been replaced by a larger one, or null
 		/// if the queue wasn't yet full with maxSize elements.
 		/// </summary>
-		public virtual System.Object InsertWithOverflow(System.Object element)
+		public virtual T InsertWithOverflow(T element)
 		{
 			if (size < maxSize)
 			{
-				Put(element);
-				return null;
+				Add(element);
+				return null; // TODO: java returns null, this shouldn't be an issue? - cc
 			}
 			else if (size > 0 && !LessThan(element, heap[1]))
 			{
-				System.Object ret = heap[1];
+				T ret = heap[1];
 				heap[1] = element;
-				AdjustTop();
+				UpdateTop();
 				return ret;
 			}
 			else
@@ -206,7 +173,7 @@ namespace Lucene.Net.Util
 		}
 		
 		/// <summary>Returns the least element of the PriorityQueue in constant time. </summary>
-		public System.Object Top()
+		public T Top()
 		{
 			// We don't need to check size here: if maxSize is 0,
 			// then heap is length 2 array with both entries null.
@@ -214,14 +181,15 @@ namespace Lucene.Net.Util
 			return heap[1];
 		}
 		
-		/// <summary>Removes and returns the least element of the PriorityQueue in log(size)
-		/// time. 
+		/// <summary>
+		/// Removes and returns the least element of the 
+		/// PriorityQueue in log(size) time. 
 		/// </summary>
-		public System.Object Pop()
+		public T Pop()
 		{
 			if (size > 0)
 			{
-				System.Object result = heap[1]; // save first value
+				T result = heap[1]; // save first value
 				heap[1] = heap[size]; // move last to first
 				heap[size] = null; // permit GC of objects
 				size--;
@@ -232,52 +200,21 @@ namespace Lucene.Net.Util
 				return null;
 		}
 		
-		/// <summary> Should be called when the Object at top changes values. Still log(n) worst
-		/// case, but it's at least twice as fast to
-		/// 
-        /// <code>
-		/// pq.top().change();
-		/// pq.adjustTop();
-        /// </code>
-		/// 
-		/// instead of
-		/// 
-        /// <code>
-		/// o = pq.pop();
-		/// o.change();
-		/// pq.push(o);
-        /// </code>
-		/// 
-		/// </summary>
-		/// <deprecated> use <see cref="UpdateTop()" /> which returns the new top element and
-		/// saves an additional call to <see cref="Top()" />.
-		/// </deprecated>
-        [Obsolete("use UpdateTop() which returns the new top element and saves an additional call to Top()")]
-		public void  AdjustTop()
-		{
-			DownHeap();
-		}
-		
-		/// <summary> Should be called when the Object at top changes values. Still log(n) worst
-		/// case, but it's at least twice as fast to
-		/// 
+		/// <summary> Should be called when the Object at top changes values. 
+		/// Still log(n) worst case, but it's at least twice as fast to
         /// <code>
 		/// pq.top().change();
 		/// pq.updateTop();
         /// </code>
-		/// 
 		/// instead of
-		/// 
         /// <code>
 		/// o = pq.pop();
 		/// o.change();
 		/// pq.push(o);
         /// </code>
-		/// 
 		/// </summary>
-		/// <returns> the new 'top' element.
-		/// </returns>
-		public System.Object UpdateTop()
+		/// <returns> the new 'top' element.</returns>
+		public T UpdateTop()
 		{
 			DownHeap();
 			return heap[1];
@@ -302,7 +239,7 @@ namespace Lucene.Net.Util
 		private void  UpHeap()
 		{
 			int i = size;
-			System.Object node = heap[i]; // save bottom node
+			T node = heap[i]; // save bottom node
 			int j = SupportClass.Number.URShift(i, 1);
 			while (j > 0 && LessThan(node, heap[j]))
 			{
@@ -316,7 +253,7 @@ namespace Lucene.Net.Util
 		private void  DownHeap()
 		{
 			int i = 1;
-			System.Object node = heap[i]; // save top node
+			T node = heap[i]; // save top node
 			int j = i << 1; // find smaller child
 			int k = j + 1;
 			if (k <= size && LessThan(heap[k], heap[j]))

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/ReaderUtil.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/ReaderUtil.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/ReaderUtil.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/ReaderUtil.cs Wed Nov  9 21:03:47 2011
@@ -21,21 +21,15 @@ using IndexReader = Lucene.Net.Index.Ind
 
 namespace Lucene.Net.Util
 {
-	
-	/// <summary> Common util methods for dealing with <see cref="IndexReader" />s.
-	/// 
+	/// <summary>
+	/// Common util methods for dealing with <see cref="IndexReader" />s.
 	/// </summary>
 	public class ReaderUtil
 	{
-		
-		/// <summary> Gathers sub-readers from reader into a List.
-		/// 
-		/// </summary>
-		/// <param name="allSubReaders">
-		/// </param>
-		/// <param name="reader">
-		/// </param>
-		public static void  GatherSubReaders(System.Collections.IList allSubReaders, IndexReader reader)
+		/// <summary>Gathers sub-readers from reader into a List.</summary>
+		/// <param name="allSubReaders"></param>
+		/// <param name="reader"></param>
+		public static void GatherSubReaders(System.Collections.Generic.List<IndexReader> allSubReaders, IndexReader reader)
 		{
 			IndexReader[] subReaders = reader.GetSequentialSubReaders();
 			if (subReaders == null)
@@ -63,9 +57,9 @@ namespace Lucene.Net.Util
 		/// </returns>
 		public static IndexReader SubReader(int doc, IndexReader reader)
 		{
-			System.Collections.ArrayList subReadersList = new System.Collections.ArrayList();
+            var subReadersList = new System.Collections.Generic.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 +81,9 @@ namespace Lucene.Net.Util
 		/// </returns>
 		public static IndexReader SubReader(IndexReader reader, int subIndex)
 		{
-			System.Collections.ArrayList subReadersList = new System.Collections.ArrayList();
+            var subReadersList = new System.Collections.Generic.List<IndexReader>();
 			ReaderUtil.GatherSubReaders(subReadersList, reader);
-			IndexReader[] subReaders = (IndexReader[]) subReadersList.ToArray(typeof(IndexReader));
+			IndexReader[] subReaders = subReadersList.ToArray();
 			return subReaders[subIndex];
 		}
 		

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/SimpleStringInterner.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/SimpleStringInterner.cs?rev=1199962&r1=1199961&r2=1199962&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/SimpleStringInterner.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/SimpleStringInterner.cs Wed Nov  9 21:03:47 2011
@@ -68,7 +68,7 @@ namespace Lucene.Net.Util
 			
 			for (Entry e = first; e != null; e = e.next)
 			{
-				if (e.hash == h && ((System.Object) e.str == (System.Object) s || String.CompareOrdinal(e.str, s) == 0))
+                if (e.hash == h && (ReferenceEquals(e.str, s) || String.CompareOrdinal(e.str, s) == 0))
 				{
 					// if (e.str == s || (e.hash == h && e.str.compareTo(s)==0)) {
 					return e.str;