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 2013/04/03 19:40:14 UTC

[31/51] [partial] Mass convert mixed tabs to spaces

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Spatial/Util/FixedBitSet.cs
----------------------------------------------------------------------
diff --git a/src/contrib/Spatial/Util/FixedBitSet.cs b/src/contrib/Spatial/Util/FixedBitSet.cs
index 8d58d7e..bfc5c45 100644
--- a/src/contrib/Spatial/Util/FixedBitSet.cs
+++ b/src/contrib/Spatial/Util/FixedBitSet.cs
@@ -1,4 +1,4 @@
-/*
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -22,7 +22,7 @@ using Lucene.Net.Util;
 
 namespace Lucene.Net.Spatial.Util
 {
-	/* BitSet of fixed length (numBits), backed by accessible
+    /* BitSet of fixed length (numBits), backed by accessible
  *  ({@link #getBits}) long[], accessed with an int index,
  *  implementing Bits and DocIdSet.  Unlike {@link
  *  OpenBitSet} this bit set does not auto-expand, cannot
@@ -31,424 +31,424 @@ namespace Lucene.Net.Spatial.Util
  *
  * @lucene.internal
  **/
-	public class FixedBitSet : DocIdSet, IBits
-	{
-		private readonly BitArray bits;
-
-		/// <summary>
-		/// returns the number of 64 bit words it would take to hold numBits
-		/// </summary>
-		/// <param name="numBits"></param>
-		/// <returns></returns>
-		public static int bits2words(int numBits)
-		{
-			var numLong = (int)((uint)numBits >> 6);
-			if ((numBits & 63) != 0)
-			{
-				numLong++;
-			}
-			return numLong;
-		}
-
-		public FixedBitSet(int numBits)
-		{
-			bits = new BitArray(numBits);
-		}
-
-		/// <summary>
-		/// Makes full copy.
-		/// </summary>
-		/// <param name="other"></param>
-		public FixedBitSet(FixedBitSet other)
-		{
-			bits = new BitArray(other.bits);
-		}
-
-		public IBits Bits()
-		{
-			return this;
-		}
-
-		public int Length()
-		{
-			return bits.Length;
-		}
-
-		public override bool IsCacheable
-		{
-			get { return true; }
-		}
-
-		/// <summary>
-		/// Returns number of set bits.  NOTE: this visits every
-		/// long in the backing bits array, and the result is not
-		/// internally cached!
-		/// </summary>
-		/// <returns></returns>
-		public int Cardinality()
-		{
-			int ret = 0;
-			for (var i = 0; i < bits.Length; i++)
-			{
-				if (bits[i]) ret++;
-			}
-			return ret;
-		}
-
-		public bool Get(int index)
-		{
-			return bits[index];
-		}
-
-		public void Set(int index)
-		{
-			bits.Set(index, true);
-		}
-
-		public bool GetAndSet(int index)
-		{
-			var ret = bits[index];
-			bits.Set(index, true);
-			return ret;
-		}
-
-		public void Clear(int index)
-		{
-			bits.Set(index, false);
-		}
-
-		public bool GetAndClear(int index)
-		{
-			var ret = bits[index];
-			bits.Set(index, false);
-			return ret;
-		}
-
-		/// <summary>
-		/// Returns the index of the first set bit starting at the index specified.
-		/// -1 is returned if there are no more set bits.
-		/// </summary>
-		/// <param name="index"></param>
-		/// <returns></returns>
-		public int NextSetBit(int index)
-		{
-			if (index >= bits.Length || index < 0)
-				throw new ArgumentException("Invalid index", "index");
-
-			for (var i = index; i < bits.Length; i++)
-			{
-				if (bits[i]) return i;
-			}
-
-			return -1;
-		}
-
-		/* Returns the index of the last set bit before or on the index specified.
-		 *  -1 is returned if there are no more set bits.
-		 */
-		public int PrevSetBit(int index)
-		{
-			if (index >= bits.Length || index < 0)
-				throw new ArgumentException("Invalid index", "index");
-
-			for (var i = index; i >= 0; i--)
-			{
-				if (bits[i]) return i;
-			}
-
-			return -1;
-		}
-
-		/* Does in-place OR of the bits provided by the
-		 *  iterator. */
-		//public void Or(DocIdSetIterator iter)
-		//{
-		//    if (iter is OpenBitSetIterator && iter.DocID() == -1)
-		//    {
-		//        var obs = (OpenBitSetIterator)iter;
-		//        Or(obs.arr, obs.words);
-		//        // advance after last doc that would be accepted if standard
-		//        // iteration is used (to exhaust it):
-		//        obs.Advance(bits.Length);
-		//    }
-		//    else
-		//    {
-		//        int doc;
-		//        while ((doc = iter.NextDoc()) < bits.Length)
-		//        {
-		//            Set(doc);
-		//        }
-		//    }
-		//}
-
-		/* this = this OR other */
-		public void Or(FixedBitSet other)
-		{
-			Or(other.bits, other.bits.Length);
-		}
-
-		private void Or(BitArray otherArr, int otherLen)
-		{
-			var thisArr = this.bits;
-			int pos = Math.Min(thisArr.Length, otherLen);
-			while (--pos >= 0)
-			{
-				thisArr[pos] |= otherArr[pos];
-			}
-		}
-
-		/* Does in-place AND of the bits provided by the
-		 *  iterator. */
-		//public void And(DocIdSetIterator iter)
-		//{
-		//    if (iter is OpenBitSetIterator && iter.DocID() == -1)
-		//    {
-		//        var obs = (OpenBitSetIterator)iter;
-		//        And(obs.arr, obs.words);
-		//        // advance after last doc that would be accepted if standard
-		//        // iteration is used (to exhaust it):
-		//        obs.Advance(bits.Length);
-		//    }
-		//    else
-		//    {
-		//        if (bits.Length == 0) return;
-		//        int disiDoc, bitSetDoc = NextSetBit(0);
-		//        while (bitSetDoc != -1 && (disiDoc = iter.Advance(bitSetDoc)) < bits.Length)
-		//        {
-		//            Clear(bitSetDoc, disiDoc);
-		//            disiDoc++;
-		//            bitSetDoc = (disiDoc < bits.Length) ? NextSetBit(disiDoc) : -1;
-		//        }
-		//        if (bitSetDoc != -1)
-		//        {
-		//            Clear(bitSetDoc, bits.Length);
-		//        }
-		//    }
-		//}
-
-		/* this = this AND other */
-		public void And(FixedBitSet other)
-		{
-			And(other.bits, other.bits.Length);
-		}
-
-		private void And(BitArray otherArr, int otherLen)
-		{
-			var thisArr = this.bits;
-			int pos = Math.Min(thisArr.Length, otherLen);
-			while (--pos >= 0)
-			{
-				thisArr[pos] &= otherArr[pos];
-			}
-			if (thisArr.Length > otherLen)
-			{
-				for (var i = otherLen; i < thisArr.Length; i++)
-				{
-					thisArr[i] = false;
-				}
-			}
-		}
-
-		/* Does in-place AND NOT of the bits provided by the
-		 *  iterator. */
-		//public void AndNot(DocIdSetIterator iter)
-		//{
-		//    var obs = iter as OpenBitSetIterator;
-		//    if (obs != null && iter.DocID() == -1)
-		//    {
-		//        AndNot(obs.arr, obs.words);
-		//        // advance after last doc that would be accepted if standard
-		//        // iteration is used (to exhaust it):
-		//        obs.Advance(bits.Length);
-		//    }
-		//    else
-		//    {
-		//        int doc;
-		//        while ((doc = iter.NextDoc()) < bits.Length)
-		//        {
-		//            Clear(doc);
-		//        }
-		//    }
-		//}
-
-		/* this = this AND NOT other */
-		public void AndNot(FixedBitSet other)
-		{
-			AndNot(other.bits, other.bits.Length);
-		}
-
-		private void AndNot(BitArray otherArr, int otherLen)
-		{
-			var thisArr = this.bits;
-			int pos = Math.Min(thisArr.Length, otherLen);
-			while (--pos >= 0)
-			{
-				thisArr[pos] &= !otherArr[pos];
-			}
-		}
-
-		// NOTE: no .isEmpty() here because that's trappy (ie,
-		// typically isEmpty is low cost, but this one wouldn't
-		// be)
-
-		/* Flips a range of bits
-		 *
-		 * @param startIndex lower index
-		 * @param endIndex one-past the last bit to flip
-		 */
-		//      public void Flip(int startIndex, int endIndex) {
-		//  Debug.Assert(startIndex >= 0 && startIndex < numBits);
-		//  Debug.Assert(endIndex >= 0 && endIndex <= numBits);
-		//  if (endIndex <= startIndex) {
-		//    return;
-		//  }
-
-		//  int startWord = startIndex >> 6;
-		//  int endWord = (endIndex-1) >> 6;
-
-		//  /* Grrr, java shifting wraps around so -1L>>>64 == -1
-		//   * for that reason, make sure not to use endmask if the bits to flip will
-		//   * be zero in the last word (redefine endWord to be the last changed...)
-		//  long startmask = -1L << (startIndex & 0x3f);     // example: 11111...111000
-		//  long endmask = -1L >>> (64-(endIndex & 0x3f));   // example: 00111...111111
-		//  ***/
-
-		//  long startmask = -1L << startIndex;
-		//  long endmask =  -1L >>> -endIndex;  // 64-(endIndex&0x3f) is the same as -endIndex due to wrap
-
-		//  if (startWord == endWord) {
-		//    bits[startWord] ^= (startmask & endmask);
-		//    return;
-		//  }
-
-		//  bits[startWord] ^= startmask;
-
-		//  for (var i=startWord+1; i<endWord; i++) {
-		//    bits[i] = ~bits[i];
-		//  }
-
-		//  bits[endWord] ^= endmask;
-		//}
-
-		/* Sets a range of bits
-		 *
-		 * @param startIndex lower index
-		 * @param endIndex one-past the last bit to set
-		 */
-		public void Set(int startIndex, int endIndex)
-		{
-			// Naive implementation
-			for (int i = startIndex; i < endIndex; i++)
-			{
-				Set(i);
-			}
-		}
-
-		//      public void Set(int startIndex, int endIndex) {
-		//  Debug.Assert(startIndex >= 0 && startIndex < numBits);
-		//  Debug.Assert(endIndex >= 0 && endIndex <= numBits);
-		//  if (endIndex <= startIndex) {
-		//    return;
-		//  }
-
-		//  int startWord = startIndex >> 6;
-		//  int endWord = (endIndex-1) >> 6;
-
-		//  long startmask = -1L << startIndex;
-		//  long endmask = -1L >>> -endIndex;  // 64-(endIndex&0x3f) is the same as -endIndex due to wrap
-
-		//  if (startWord == endWord) {
-		//    bits[startWord] |= (startmask & endmask);
-		//    return;
-		//  }
-
-		//  bits[startWord] |= startmask;
-		//  Arrays.Fill(bits, startWord+1, endWord, -1L);
-		//  bits[endWord] |= endmask;
-		//}
-
-		/* Clears a range of bits.
-		 *
-		 * @param startIndex lower index
-		 * @param endIndex one-past the last bit to clear
-		 */
-		public void Clear(int startIndex, int endIndex)
-		{
-			for (int i = startIndex; i < endIndex; i++)
-			{
-				Clear(i);
-			}
-		}
-
-		//@Override
-		public FixedBitSet Clone()
-		{
-			return new FixedBitSet(this);
-		}
-
-		/* returns true if both sets have the same bits set */
-		public override bool Equals(Object o)
-		{
-			if (this == o)
-			{
-				return true;
-			}
-
-			var other = o as FixedBitSet;
-			if (other == null)
-			{
-				return false;
-			}
-
-			return bits.Equals(other.bits);
-		}
-
-		public override int GetHashCode()
-		{
-			return bits.GetHashCode();
-		}
-
-		public override DocIdSetIterator Iterator()
-		{
-			return new FixedBitSetIterator(this);
-		}
-
-		/// <summary>
-		/// A FixedBitSet Iterator implementation
-		/// </summary>
-		public class FixedBitSetIterator : DocIdSetIterator
-		{
-			private int curDocId = -1;
-			private readonly IEnumerator enumerator;
-
-			public FixedBitSetIterator(FixedBitSet bitset)
-			{
-				enumerator = bitset.bits.GetEnumerator();
-			}
-
-			public override int DocID()
-			{
-				return curDocId;
-			}
-
-			public override int NextDoc()
-			{
-				while (enumerator.MoveNext())
-				{
-					++curDocId;
-					if ((bool)enumerator.Current) return curDocId;
-				}
-				return curDocId = NO_MORE_DOCS;
-			}
-
-			public override int Advance(int target)
-			{
-				int doc;
-				while ((doc = NextDoc()) < target)
-				{
-				}
-				return doc;
-			}
-		}
-	}
+    public class FixedBitSet : DocIdSet, IBits
+    {
+        private readonly BitArray bits;
+
+        /// <summary>
+        /// returns the number of 64 bit words it would take to hold numBits
+        /// </summary>
+        /// <param name="numBits"></param>
+        /// <returns></returns>
+        public static int bits2words(int numBits)
+        {
+            var numLong = (int)((uint)numBits >> 6);
+            if ((numBits & 63) != 0)
+            {
+                numLong++;
+            }
+            return numLong;
+        }
+
+        public FixedBitSet(int numBits)
+        {
+            bits = new BitArray(numBits);
+        }
+
+        /// <summary>
+        /// Makes full copy.
+        /// </summary>
+        /// <param name="other"></param>
+        public FixedBitSet(FixedBitSet other)
+        {
+            bits = new BitArray(other.bits);
+        }
+
+        public IBits Bits()
+        {
+            return this;
+        }
+
+        public int Length()
+        {
+            return bits.Length;
+        }
+
+        public override bool IsCacheable
+        {
+            get { return true; }
+        }
+
+        /// <summary>
+        /// Returns number of set bits.  NOTE: this visits every
+        /// long in the backing bits array, and the result is not
+        /// internally cached!
+        /// </summary>
+        /// <returns></returns>
+        public int Cardinality()
+        {
+            int ret = 0;
+            for (var i = 0; i < bits.Length; i++)
+            {
+                if (bits[i]) ret++;
+            }
+            return ret;
+        }
+
+        public bool Get(int index)
+        {
+            return bits[index];
+        }
+
+        public void Set(int index)
+        {
+            bits.Set(index, true);
+        }
+
+        public bool GetAndSet(int index)
+        {
+            var ret = bits[index];
+            bits.Set(index, true);
+            return ret;
+        }
+
+        public void Clear(int index)
+        {
+            bits.Set(index, false);
+        }
+
+        public bool GetAndClear(int index)
+        {
+            var ret = bits[index];
+            bits.Set(index, false);
+            return ret;
+        }
+
+        /// <summary>
+        /// Returns the index of the first set bit starting at the index specified.
+        /// -1 is returned if there are no more set bits.
+        /// </summary>
+        /// <param name="index"></param>
+        /// <returns></returns>
+        public int NextSetBit(int index)
+        {
+            if (index >= bits.Length || index < 0)
+                throw new ArgumentException("Invalid index", "index");
+
+            for (var i = index; i < bits.Length; i++)
+            {
+                if (bits[i]) return i;
+            }
+
+            return -1;
+        }
+
+        /* Returns the index of the last set bit before or on the index specified.
+         *  -1 is returned if there are no more set bits.
+         */
+        public int PrevSetBit(int index)
+        {
+            if (index >= bits.Length || index < 0)
+                throw new ArgumentException("Invalid index", "index");
+
+            for (var i = index; i >= 0; i--)
+            {
+                if (bits[i]) return i;
+            }
+
+            return -1;
+        }
+
+        /* Does in-place OR of the bits provided by the
+         *  iterator. */
+        //public void Or(DocIdSetIterator iter)
+        //{
+        //    if (iter is OpenBitSetIterator && iter.DocID() == -1)
+        //    {
+        //        var obs = (OpenBitSetIterator)iter;
+        //        Or(obs.arr, obs.words);
+        //        // advance after last doc that would be accepted if standard
+        //        // iteration is used (to exhaust it):
+        //        obs.Advance(bits.Length);
+        //    }
+        //    else
+        //    {
+        //        int doc;
+        //        while ((doc = iter.NextDoc()) < bits.Length)
+        //        {
+        //            Set(doc);
+        //        }
+        //    }
+        //}
+
+        /* this = this OR other */
+        public void Or(FixedBitSet other)
+        {
+            Or(other.bits, other.bits.Length);
+        }
+
+        private void Or(BitArray otherArr, int otherLen)
+        {
+            var thisArr = this.bits;
+            int pos = Math.Min(thisArr.Length, otherLen);
+            while (--pos >= 0)
+            {
+                thisArr[pos] |= otherArr[pos];
+            }
+        }
+
+        /* Does in-place AND of the bits provided by the
+         *  iterator. */
+        //public void And(DocIdSetIterator iter)
+        //{
+        //    if (iter is OpenBitSetIterator && iter.DocID() == -1)
+        //    {
+        //        var obs = (OpenBitSetIterator)iter;
+        //        And(obs.arr, obs.words);
+        //        // advance after last doc that would be accepted if standard
+        //        // iteration is used (to exhaust it):
+        //        obs.Advance(bits.Length);
+        //    }
+        //    else
+        //    {
+        //        if (bits.Length == 0) return;
+        //        int disiDoc, bitSetDoc = NextSetBit(0);
+        //        while (bitSetDoc != -1 && (disiDoc = iter.Advance(bitSetDoc)) < bits.Length)
+        //        {
+        //            Clear(bitSetDoc, disiDoc);
+        //            disiDoc++;
+        //            bitSetDoc = (disiDoc < bits.Length) ? NextSetBit(disiDoc) : -1;
+        //        }
+        //        if (bitSetDoc != -1)
+        //        {
+        //            Clear(bitSetDoc, bits.Length);
+        //        }
+        //    }
+        //}
+
+        /* this = this AND other */
+        public void And(FixedBitSet other)
+        {
+            And(other.bits, other.bits.Length);
+        }
+
+        private void And(BitArray otherArr, int otherLen)
+        {
+            var thisArr = this.bits;
+            int pos = Math.Min(thisArr.Length, otherLen);
+            while (--pos >= 0)
+            {
+                thisArr[pos] &= otherArr[pos];
+            }
+            if (thisArr.Length > otherLen)
+            {
+                for (var i = otherLen; i < thisArr.Length; i++)
+                {
+                    thisArr[i] = false;
+                }
+            }
+        }
+
+        /* Does in-place AND NOT of the bits provided by the
+         *  iterator. */
+        //public void AndNot(DocIdSetIterator iter)
+        //{
+        //    var obs = iter as OpenBitSetIterator;
+        //    if (obs != null && iter.DocID() == -1)
+        //    {
+        //        AndNot(obs.arr, obs.words);
+        //        // advance after last doc that would be accepted if standard
+        //        // iteration is used (to exhaust it):
+        //        obs.Advance(bits.Length);
+        //    }
+        //    else
+        //    {
+        //        int doc;
+        //        while ((doc = iter.NextDoc()) < bits.Length)
+        //        {
+        //            Clear(doc);
+        //        }
+        //    }
+        //}
+
+        /* this = this AND NOT other */
+        public void AndNot(FixedBitSet other)
+        {
+            AndNot(other.bits, other.bits.Length);
+        }
+
+        private void AndNot(BitArray otherArr, int otherLen)
+        {
+            var thisArr = this.bits;
+            int pos = Math.Min(thisArr.Length, otherLen);
+            while (--pos >= 0)
+            {
+                thisArr[pos] &= !otherArr[pos];
+            }
+        }
+
+        // NOTE: no .isEmpty() here because that's trappy (ie,
+        // typically isEmpty is low cost, but this one wouldn't
+        // be)
+
+        /* Flips a range of bits
+         *
+         * @param startIndex lower index
+         * @param endIndex one-past the last bit to flip
+         */
+        //      public void Flip(int startIndex, int endIndex) {
+        //  Debug.Assert(startIndex >= 0 && startIndex < numBits);
+        //  Debug.Assert(endIndex >= 0 && endIndex <= numBits);
+        //  if (endIndex <= startIndex) {
+        //    return;
+        //  }
+
+        //  int startWord = startIndex >> 6;
+        //  int endWord = (endIndex-1) >> 6;
+
+        //  /* Grrr, java shifting wraps around so -1L>>>64 == -1
+        //   * for that reason, make sure not to use endmask if the bits to flip will
+        //   * be zero in the last word (redefine endWord to be the last changed...)
+        //  long startmask = -1L << (startIndex & 0x3f);     // example: 11111...111000
+        //  long endmask = -1L >>> (64-(endIndex & 0x3f));   // example: 00111...111111
+        //  ***/
+
+        //  long startmask = -1L << startIndex;
+        //  long endmask =  -1L >>> -endIndex;  // 64-(endIndex&0x3f) is the same as -endIndex due to wrap
+
+        //  if (startWord == endWord) {
+        //    bits[startWord] ^= (startmask & endmask);
+        //    return;
+        //  }
+
+        //  bits[startWord] ^= startmask;
+
+        //  for (var i=startWord+1; i<endWord; i++) {
+        //    bits[i] = ~bits[i];
+        //  }
+
+        //  bits[endWord] ^= endmask;
+        //}
+
+        /* Sets a range of bits
+         *
+         * @param startIndex lower index
+         * @param endIndex one-past the last bit to set
+         */
+        public void Set(int startIndex, int endIndex)
+        {
+            // Naive implementation
+            for (int i = startIndex; i < endIndex; i++)
+            {
+                Set(i);
+            }
+        }
+
+        //      public void Set(int startIndex, int endIndex) {
+        //  Debug.Assert(startIndex >= 0 && startIndex < numBits);
+        //  Debug.Assert(endIndex >= 0 && endIndex <= numBits);
+        //  if (endIndex <= startIndex) {
+        //    return;
+        //  }
+
+        //  int startWord = startIndex >> 6;
+        //  int endWord = (endIndex-1) >> 6;
+
+        //  long startmask = -1L << startIndex;
+        //  long endmask = -1L >>> -endIndex;  // 64-(endIndex&0x3f) is the same as -endIndex due to wrap
+
+        //  if (startWord == endWord) {
+        //    bits[startWord] |= (startmask & endmask);
+        //    return;
+        //  }
+
+        //  bits[startWord] |= startmask;
+        //  Arrays.Fill(bits, startWord+1, endWord, -1L);
+        //  bits[endWord] |= endmask;
+        //}
+
+        /* Clears a range of bits.
+         *
+         * @param startIndex lower index
+         * @param endIndex one-past the last bit to clear
+         */
+        public void Clear(int startIndex, int endIndex)
+        {
+            for (int i = startIndex; i < endIndex; i++)
+            {
+                Clear(i);
+            }
+        }
+
+        //@Override
+        public FixedBitSet Clone()
+        {
+            return new FixedBitSet(this);
+        }
+
+        /* returns true if both sets have the same bits set */
+        public override bool Equals(Object o)
+        {
+            if (this == o)
+            {
+                return true;
+            }
+
+            var other = o as FixedBitSet;
+            if (other == null)
+            {
+                return false;
+            }
+
+            return bits.Equals(other.bits);
+        }
+
+        public override int GetHashCode()
+        {
+            return bits.GetHashCode();
+        }
+
+        public override DocIdSetIterator Iterator()
+        {
+            return new FixedBitSetIterator(this);
+        }
+
+        /// <summary>
+        /// A FixedBitSet Iterator implementation
+        /// </summary>
+        public class FixedBitSetIterator : DocIdSetIterator
+        {
+            private int curDocId = -1;
+            private readonly IEnumerator enumerator;
+
+            public FixedBitSetIterator(FixedBitSet bitset)
+            {
+                enumerator = bitset.bits.GetEnumerator();
+            }
+
+            public override int DocID()
+            {
+                return curDocId;
+            }
+
+            public override int NextDoc()
+            {
+                while (enumerator.MoveNext())
+                {
+                    ++curDocId;
+                    if ((bool)enumerator.Current) return curDocId;
+                }
+                return curDocId = NO_MORE_DOCS;
+            }
+
+            public override int Advance(int target)
+            {
+                int doc;
+                while ((doc = NextDoc()) < target)
+                {
+                }
+                return doc;
+            }
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Spatial/Util/FunctionQuery.cs
----------------------------------------------------------------------
diff --git a/src/contrib/Spatial/Util/FunctionQuery.cs b/src/contrib/Spatial/Util/FunctionQuery.cs
index a382cbb..64eda65 100644
--- a/src/contrib/Spatial/Util/FunctionQuery.cs
+++ b/src/contrib/Spatial/Util/FunctionQuery.cs
@@ -1,4 +1,4 @@
-/*
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -23,193 +23,193 @@ using Lucene.Net.Search.Function;
 
 namespace Lucene.Net.Spatial.Util
 {
-	/// <summary>
-	/// Port of Solr's FunctionQuery (v1.4)
-	/// 
-	/// Returns a score for each document based on a ValueSource,
-	/// often some function of the value of a field.
-	/// 
-	/// <b>Note: This API is experimental and may change in non backward-compatible ways in the future</b>
-	/// </summary>
-	public class FunctionQuery : Query
-	{
-		protected readonly ValueSource func;
-
-		public FunctionQuery(ValueSource func)
-		{
-			this.func = func;
-		}
-
-		/// <summary>
-		/// 
-		/// </summary>
-		/// <returns>The associated ValueSource</returns>
-		public ValueSource GetValueSource()
-		{
-			return func;
-		}
-
-		public override Query Rewrite(Index.IndexReader reader)
-		{
-			return this;
-		}
-
-		public override void ExtractTerms(System.Collections.Generic.ISet<Term> terms)
-		{
-			//base.ExtractTerms(terms);
-		}
-
-		protected class FunctionWeight : Weight
-		{
-			protected Searcher searcher;
-			protected float queryNorm;
-			protected float queryWeight;
-			protected readonly FunctionQuery enclosingInstance;
-
-			public FunctionWeight(Searcher searcher, FunctionQuery q)
-			{
-				enclosingInstance = q;
-				this.searcher = searcher;
-				//q.func.CreateWeight(searcher);
-			}
-
-			internal float GetQueryNorm()
-			{
-				return queryNorm;
-			}
-
-			public override Query Query
-			{
-				get { return enclosingInstance; }
-			}
-
-			public override float Value
-			{
-				get { return queryWeight; }
-			}
-
-			public override float GetSumOfSquaredWeights()
-			{
-				queryWeight = enclosingInstance.Boost;
-				return queryWeight * queryWeight;
-			}
-
-			public override void Normalize(float norm)
-			{
-				this.queryNorm = norm;
-				queryWeight *= this.queryNorm;
-			}
-
-			public override Scorer Scorer(IndexReader reader, bool scoreDocsInOrder, bool topScorer)
-			{
-				return new AllScorer(enclosingInstance.GetSimilarity(searcher), reader, this);
-			}
-
-			public override Explanation Explain(IndexReader reader, int doc)
-			{
-				return ((AllScorer)Scorer(reader, true, true)).Explain(doc);
-			}
-		}
-
-		protected class AllScorer : Scorer
-		{
-			readonly IndexReader reader;
-			readonly FunctionWeight weight;
-			readonly int maxDoc;
-			readonly float qWeight;
-			int doc = -1;
-			readonly DocValues vals;
-			readonly bool hasDeletions;
-
-			public AllScorer(Similarity similarity, IndexReader reader, FunctionWeight w)
-				: base(similarity)
-			{
-				this.weight = w;
-				this.qWeight = w.Value;
-				this.reader = reader;
-				this.maxDoc = reader.MaxDoc;
-				this.hasDeletions = reader.HasDeletions;
-				vals = ((FunctionQuery)w.Query).func.GetValues(reader);
-			}
-
-			public override int DocID()
-			{
-				return doc;
-			}
-
-			// instead of matching all docs, we could also embed a query.
-			// the score could either ignore the subscore, or boost it.
-			// Containment:  floatline(foo:myTerm, "myFloatField", 1.0, 0.0f)
-			// Boost:        foo:myTerm^floatline("myFloatField",1.0,0.0f)
-			public override int NextDoc()
-			{
-				for (; ; )
-				{
-					++doc;
-					if (doc >= maxDoc)
-					{
-						return doc = NO_MORE_DOCS;
-					}
-					if (hasDeletions && reader.IsDeleted(doc)) continue;
-					return doc;
-				}
-			}
-
-			public override int Advance(int target)
-			{
-				// this will work even if target==NO_MORE_DOCS
-				doc = target - 1;
-				return NextDoc();
-			}
-
-			public override float Score()
-			{
-				float score = qWeight * vals.FloatVal(doc);
-
-				// Current Lucene priority queues can't handle NaN and -Infinity, so
-				// map to -Float.MAX_VALUE. This conditional handles both -infinity
-				// and NaN since comparisons with NaN are always false.
-				return score > float.NegativeInfinity ? score : -float.MaxValue;
-			}
-
-			public /*override*/ Explanation Explain(int doc)
-			{
-				float sc = qWeight * vals.FloatVal(doc);
-
-				Explanation result = new ComplexExplanation
-				  (true, sc, "FunctionQuery(" + ((FunctionQuery)weight.Query).func + "), product of:");
-
-				result.AddDetail(vals.Explain(doc));
-				result.AddDetail(new Explanation(weight.Query.Boost, "boost"));
-				result.AddDetail(new Explanation(weight.GetQueryNorm(), "queryNorm"));
-				return result;
-			}
-		}
-
-		public override Weight CreateWeight(Searcher searcher)
-		{
-			return new FunctionQuery.FunctionWeight(searcher, this);
-		}
-
-		public override string ToString(string field)
-		{
-			float boost = Boost;
-			return (boost != 1.0 ? "(" : "") + func.ToString()
-					+ (boost == 1.0 ? "" : ")^" + boost);
-		}
-
-		public override bool Equals(object o)
-		{
-			var other = o as FunctionQuery;
-
-			if (other == null) return false;
-
-			return this.Boost == other.Boost && this.func.Equals(other.func);
-		}
-
-		public override int GetHashCode()
-		{
-			return (int) (func.GetHashCode() * 31 + BitConverter.DoubleToInt64Bits(Boost));
-		}
-	}
+    /// <summary>
+    /// Port of Solr's FunctionQuery (v1.4)
+    /// 
+    /// Returns a score for each document based on a ValueSource,
+    /// often some function of the value of a field.
+    /// 
+    /// <b>Note: This API is experimental and may change in non backward-compatible ways in the future</b>
+    /// </summary>
+    public class FunctionQuery : Query
+    {
+        protected readonly ValueSource func;
+
+        public FunctionQuery(ValueSource func)
+        {
+            this.func = func;
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns>The associated ValueSource</returns>
+        public ValueSource GetValueSource()
+        {
+            return func;
+        }
+
+        public override Query Rewrite(Index.IndexReader reader)
+        {
+            return this;
+        }
+
+        public override void ExtractTerms(System.Collections.Generic.ISet<Term> terms)
+        {
+            //base.ExtractTerms(terms);
+        }
+
+        protected class FunctionWeight : Weight
+        {
+            protected Searcher searcher;
+            protected float queryNorm;
+            protected float queryWeight;
+            protected readonly FunctionQuery enclosingInstance;
+
+            public FunctionWeight(Searcher searcher, FunctionQuery q)
+            {
+                enclosingInstance = q;
+                this.searcher = searcher;
+                //q.func.CreateWeight(searcher);
+            }
+
+            internal float GetQueryNorm()
+            {
+                return queryNorm;
+            }
+
+            public override Query Query
+            {
+                get { return enclosingInstance; }
+            }
+
+            public override float Value
+            {
+                get { return queryWeight; }
+            }
+
+            public override float GetSumOfSquaredWeights()
+            {
+                queryWeight = enclosingInstance.Boost;
+                return queryWeight * queryWeight;
+            }
+
+            public override void Normalize(float norm)
+            {
+                this.queryNorm = norm;
+                queryWeight *= this.queryNorm;
+            }
+
+            public override Scorer Scorer(IndexReader reader, bool scoreDocsInOrder, bool topScorer)
+            {
+                return new AllScorer(enclosingInstance.GetSimilarity(searcher), reader, this);
+            }
+
+            public override Explanation Explain(IndexReader reader, int doc)
+            {
+                return ((AllScorer)Scorer(reader, true, true)).Explain(doc);
+            }
+        }
+
+        protected class AllScorer : Scorer
+        {
+            readonly IndexReader reader;
+            readonly FunctionWeight weight;
+            readonly int maxDoc;
+            readonly float qWeight;
+            int doc = -1;
+            readonly DocValues vals;
+            readonly bool hasDeletions;
+
+            public AllScorer(Similarity similarity, IndexReader reader, FunctionWeight w)
+                : base(similarity)
+            {
+                this.weight = w;
+                this.qWeight = w.Value;
+                this.reader = reader;
+                this.maxDoc = reader.MaxDoc;
+                this.hasDeletions = reader.HasDeletions;
+                vals = ((FunctionQuery)w.Query).func.GetValues(reader);
+            }
+
+            public override int DocID()
+            {
+                return doc;
+            }
+
+            // instead of matching all docs, we could also embed a query.
+            // the score could either ignore the subscore, or boost it.
+            // Containment:  floatline(foo:myTerm, "myFloatField", 1.0, 0.0f)
+            // Boost:        foo:myTerm^floatline("myFloatField",1.0,0.0f)
+            public override int NextDoc()
+            {
+                for (; ; )
+                {
+                    ++doc;
+                    if (doc >= maxDoc)
+                    {
+                        return doc = NO_MORE_DOCS;
+                    }
+                    if (hasDeletions && reader.IsDeleted(doc)) continue;
+                    return doc;
+                }
+            }
+
+            public override int Advance(int target)
+            {
+                // this will work even if target==NO_MORE_DOCS
+                doc = target - 1;
+                return NextDoc();
+            }
+
+            public override float Score()
+            {
+                float score = qWeight * vals.FloatVal(doc);
+
+                // Current Lucene priority queues can't handle NaN and -Infinity, so
+                // map to -Float.MAX_VALUE. This conditional handles both -infinity
+                // and NaN since comparisons with NaN are always false.
+                return score > float.NegativeInfinity ? score : -float.MaxValue;
+            }
+
+            public /*override*/ Explanation Explain(int doc)
+            {
+                float sc = qWeight * vals.FloatVal(doc);
+
+                Explanation result = new ComplexExplanation
+                  (true, sc, "FunctionQuery(" + ((FunctionQuery)weight.Query).func + "), product of:");
+
+                result.AddDetail(vals.Explain(doc));
+                result.AddDetail(new Explanation(weight.Query.Boost, "boost"));
+                result.AddDetail(new Explanation(weight.GetQueryNorm(), "queryNorm"));
+                return result;
+            }
+        }
+
+        public override Weight CreateWeight(Searcher searcher)
+        {
+            return new FunctionQuery.FunctionWeight(searcher, this);
+        }
+
+        public override string ToString(string field)
+        {
+            float boost = Boost;
+            return (boost != 1.0 ? "(" : "") + func.ToString()
+                    + (boost == 1.0 ? "" : ")^" + boost);
+        }
+
+        public override bool Equals(object o)
+        {
+            var other = o as FunctionQuery;
+
+            if (other == null) return false;
+
+            return this.Boost == other.Boost && this.func.Equals(other.func);
+        }
+
+        public override int GetHashCode()
+        {
+            return (int) (func.GetHashCode() * 31 + BitConverter.DoubleToInt64Bits(Boost));
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Spatial/Util/ReciprocalFloatFunction.cs
----------------------------------------------------------------------
diff --git a/src/contrib/Spatial/Util/ReciprocalFloatFunction.cs b/src/contrib/Spatial/Util/ReciprocalFloatFunction.cs
index faa71df..5789df4 100644
--- a/src/contrib/Spatial/Util/ReciprocalFloatFunction.cs
+++ b/src/contrib/Spatial/Util/ReciprocalFloatFunction.cs
@@ -1,4 +1,4 @@
-/*
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Spatial/Util/ShapeFieldCache.cs
----------------------------------------------------------------------
diff --git a/src/contrib/Spatial/Util/ShapeFieldCache.cs b/src/contrib/Spatial/Util/ShapeFieldCache.cs
index 89fa951..59db379 100644
--- a/src/contrib/Spatial/Util/ShapeFieldCache.cs
+++ b/src/contrib/Spatial/Util/ShapeFieldCache.cs
@@ -1,4 +1,4 @@
-/*
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -25,31 +25,31 @@ namespace Lucene.Net.Spatial.Util
     /// associated with a given docId
     /// </summary>
     /// <typeparam name="T"></typeparam>
-	public class ShapeFieldCache<T> where T : Shape
-	{
-		private readonly IList<T>[] cache;
-		public int defaultLength;
+    public class ShapeFieldCache<T> where T : Shape
+    {
+        private readonly IList<T>[] cache;
+        public int defaultLength;
 
-		public ShapeFieldCache(int length, int defaultLength)
-		{
-			cache = new IList<T>[length];
-			this.defaultLength = defaultLength;
-		}
+        public ShapeFieldCache(int length, int defaultLength)
+        {
+            cache = new IList<T>[length];
+            this.defaultLength = defaultLength;
+        }
 
-		public void Add(int docid, T s)
-		{
-			IList<T> list = cache[docid];
-			if (list == null)
-			{
-				list = cache[docid] = new List<T>(defaultLength);
-			}
-			list.Add(s);
-		}
+        public void Add(int docid, T s)
+        {
+            IList<T> list = cache[docid];
+            if (list == null)
+            {
+                list = cache[docid] = new List<T>(defaultLength);
+            }
+            list.Add(s);
+        }
 
-		public IList<T> GetShapes(int docid)
-		{
-			return cache[docid];
-		}
+        public IList<T> GetShapes(int docid)
+        {
+            return cache[docid];
+        }
 
-	}
+    }
 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Spatial/Util/ShapeFieldCacheDistanceValueSource.cs
----------------------------------------------------------------------
diff --git a/src/contrib/Spatial/Util/ShapeFieldCacheDistanceValueSource.cs b/src/contrib/Spatial/Util/ShapeFieldCacheDistanceValueSource.cs
index 940b59b..d806767 100644
--- a/src/contrib/Spatial/Util/ShapeFieldCacheDistanceValueSource.cs
+++ b/src/contrib/Spatial/Util/ShapeFieldCacheDistanceValueSource.cs
@@ -1,4 +1,4 @@
-/*
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -24,44 +24,44 @@ using Spatial4n.Core.Shapes;
 
 namespace Lucene.Net.Spatial.Util
 {
-	/// <summary>
-	/// An implementation of the Lucene ValueSource model to support spatial relevance ranking.
-	/// </summary>
-	public class ShapeFieldCacheDistanceValueSource : ValueSource
-	{
-		private readonly ShapeFieldCacheProvider<Point> provider;
-		private readonly SpatialContext ctx;
-		private readonly Point from;
+    /// <summary>
+    /// An implementation of the Lucene ValueSource model to support spatial relevance ranking.
+    /// </summary>
+    public class ShapeFieldCacheDistanceValueSource : ValueSource
+    {
+        private readonly ShapeFieldCacheProvider<Point> provider;
+        private readonly SpatialContext ctx;
+        private readonly Point from;
 
-		public ShapeFieldCacheDistanceValueSource(SpatialContext ctx, ShapeFieldCacheProvider<Point> provider, Point from)
-		{
+        public ShapeFieldCacheDistanceValueSource(SpatialContext ctx, ShapeFieldCacheProvider<Point> provider, Point from)
+        {
             this.ctx = ctx;
-			this.from = from;
-			this.provider = provider;
-		}
+            this.from = from;
+            this.provider = provider;
+        }
 
-		public class CachedDistanceDocValues : DocValues
-		{
-			private readonly ShapeFieldCacheDistanceValueSource enclosingInstance;
-			private readonly ShapeFieldCache<Point> cache;
-		    private readonly Point from;
-		    private readonly DistanceCalculator calculator;
-		    private readonly double nullValue;
+        public class CachedDistanceDocValues : DocValues
+        {
+            private readonly ShapeFieldCacheDistanceValueSource enclosingInstance;
+            private readonly ShapeFieldCache<Point> cache;
+            private readonly Point from;
+            private readonly DistanceCalculator calculator;
+            private readonly double nullValue;
 
-			public CachedDistanceDocValues(IndexReader reader, ShapeFieldCacheDistanceValueSource enclosingInstance)
-			{
+            public CachedDistanceDocValues(IndexReader reader, ShapeFieldCacheDistanceValueSource enclosingInstance)
+            {
                 cache = enclosingInstance.provider.GetCache(reader);
-				this.enclosingInstance = enclosingInstance;
-				
+                this.enclosingInstance = enclosingInstance;
+                
                 from = enclosingInstance.from;
-			    calculator = enclosingInstance.ctx.GetDistCalc();
-			    nullValue = (enclosingInstance.ctx.IsGeo() ? 180 : double.MaxValue);
-			}
+                calculator = enclosingInstance.ctx.GetDistCalc();
+                nullValue = (enclosingInstance.ctx.IsGeo() ? 180 : double.MaxValue);
+            }
 
-			public override float FloatVal(int doc)
-			{
-				return (float)DoubleVal(doc);
-			}
+            public override float FloatVal(int doc)
+            {
+                return (float)DoubleVal(doc);
+            }
 
             public override double DoubleVal(int doc)
             {
@@ -78,39 +78,39 @@ namespace Lucene.Net.Spatial.Util
                 return nullValue;
             }
 
-		    public override string ToString(int doc)
-			{
-				return enclosingInstance.Description() + "=" + FloatVal(doc);
-			}
-		}
+            public override string ToString(int doc)
+            {
+                return enclosingInstance.Description() + "=" + FloatVal(doc);
+            }
+        }
 
-		public override DocValues GetValues(IndexReader reader)
-		{
-			return new CachedDistanceDocValues(reader, this);
-		}
+        public override DocValues GetValues(IndexReader reader)
+        {
+            return new CachedDistanceDocValues(reader, this);
+        }
 
-		public override string Description()
-		{
+        public override string Description()
+        {
             return GetType().Name + "(" + provider + ", " + from + ")";
-		}
+        }
 
-		public override bool Equals(object o)
-		{
-			if (this == o) return true;
+        public override bool Equals(object o)
+        {
+            if (this == o) return true;
 
-			var that = o as ShapeFieldCacheDistanceValueSource;
+            var that = o as ShapeFieldCacheDistanceValueSource;
 
-			if (that == null) return false;
+            if (that == null) return false;
             if (!ctx.Equals(that.ctx)) return false;
             if (!from.Equals(that.from)) return false;
             if (!provider.Equals(that.provider)) return false;
 
-			return true;
-		}
+            return true;
+        }
 
-		public override int GetHashCode()
-		{
-		    return from.GetHashCode();
-		}
-	}
+        public override int GetHashCode()
+        {
+            return from.GetHashCode();
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Spatial/Util/ShapeFieldCacheProvider.cs
----------------------------------------------------------------------
diff --git a/src/contrib/Spatial/Util/ShapeFieldCacheProvider.cs b/src/contrib/Spatial/Util/ShapeFieldCacheProvider.cs
index 13f623a..782ebc9 100644
--- a/src/contrib/Spatial/Util/ShapeFieldCacheProvider.cs
+++ b/src/contrib/Spatial/Util/ShapeFieldCacheProvider.cs
@@ -1,4 +1,4 @@
-/*
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -33,73 +33,73 @@ namespace Lucene.Net.Spatial.Util
     /// them to the Cache.
     /// </summary>
     /// <typeparam name="T"></typeparam>
-	public abstract class ShapeFieldCacheProvider<T> where T : Shape
-	{
-		//private Logger log = Logger.getLogger(getClass().getName());
+    public abstract class ShapeFieldCacheProvider<T> where T : Shape
+    {
+        //private Logger log = Logger.getLogger(getClass().getName());
 
-		// it may be a List<T> or T
+        // it may be a List<T> or T
 #if !NET35
-		private readonly ConditionalWeakTable<IndexReader, ShapeFieldCache<T>> sidx =
-			new ConditionalWeakTable<IndexReader, ShapeFieldCache<T>>(); // WeakHashMap
+        private readonly ConditionalWeakTable<IndexReader, ShapeFieldCache<T>> sidx =
+            new ConditionalWeakTable<IndexReader, ShapeFieldCache<T>>(); // WeakHashMap
 #else
-	    private readonly WeakDictionary<IndexReader, ShapeFieldCache<T>> sidx =
-	        new WeakDictionary<IndexReader, ShapeFieldCache<T>>();
+        private readonly WeakDictionary<IndexReader, ShapeFieldCache<T>> sidx =
+            new WeakDictionary<IndexReader, ShapeFieldCache<T>>();
 #endif
 
 
-		protected readonly int defaultSize;
-		protected readonly String shapeField;
+        protected readonly int defaultSize;
+        protected readonly String shapeField;
 
-		protected ShapeFieldCacheProvider(String shapeField, int defaultSize)
-		{
-			this.shapeField = shapeField;
-			this.defaultSize = defaultSize;
-		}
+        protected ShapeFieldCacheProvider(String shapeField, int defaultSize)
+        {
+            this.shapeField = shapeField;
+            this.defaultSize = defaultSize;
+        }
 
-		protected abstract T ReadShape(/*BytesRef*/ Term term);
+        protected abstract T ReadShape(/*BytesRef*/ Term term);
 
-		private readonly object locker = new object();
+        private readonly object locker = new object();
 
-		public ShapeFieldCache<T> GetCache(IndexReader reader)
-		{
-			lock (locker)
-			{
-				ShapeFieldCache<T> idx;
-				if (sidx.TryGetValue(reader, out idx) && idx != null)
-				{
-					return idx;
-				}
+        public ShapeFieldCache<T> GetCache(IndexReader reader)
+        {
+            lock (locker)
+            {
+                ShapeFieldCache<T> idx;
+                if (sidx.TryGetValue(reader, out idx) && idx != null)
+                {
+                    return idx;
+                }
 
-				//long startTime = System.CurrentTimeMillis();
-				//log.fine("Building Cache [" + reader.MaxDoc() + "]");
+                //long startTime = System.CurrentTimeMillis();
+                //log.fine("Building Cache [" + reader.MaxDoc() + "]");
 
-				idx = new ShapeFieldCache<T>(reader.MaxDoc, defaultSize);
-				var count = 0;
-				var tec = new TermsEnumCompatibility(reader, shapeField);
+                idx = new ShapeFieldCache<T>(reader.MaxDoc, defaultSize);
+                var count = 0;
+                var tec = new TermsEnumCompatibility(reader, shapeField);
 
-				var term = tec.Next();
-				while (term != null)
-				{
-					var shape = ReadShape(term);
-					if (shape != null)
-					{
-						var docs = reader.TermDocs(new Term(shapeField, tec.Term().Text));
-						while (docs.Next())
-						{
-							idx.Add(docs.Doc, shape);
-							count++;
-						}
-					}
-					term = tec.Next();
-				}
+                var term = tec.Next();
+                while (term != null)
+                {
+                    var shape = ReadShape(term);
+                    if (shape != null)
+                    {
+                        var docs = reader.TermDocs(new Term(shapeField, tec.Term().Text));
+                        while (docs.Next())
+                        {
+                            idx.Add(docs.Doc, shape);
+                            count++;
+                        }
+                    }
+                    term = tec.Next();
+                }
 
-				sidx.Add(reader, idx);
-				tec.Close();
+                sidx.Add(reader, idx);
+                tec.Close();
 
-				//long elapsed = System.CurrentTimeMillis() - startTime;
-				//log.fine("Cached: [" + count + " in " + elapsed + "ms] " + idx);
-				return idx;
-			}
-		}
-	}
+                //long elapsed = System.CurrentTimeMillis() - startTime;
+                //log.fine("Cached: [" + count + " in " + elapsed + "ms] " + idx);
+                return idx;
+            }
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Spatial/Util/TermsEnumCompatibility.cs
----------------------------------------------------------------------
diff --git a/src/contrib/Spatial/Util/TermsEnumCompatibility.cs b/src/contrib/Spatial/Util/TermsEnumCompatibility.cs
index 13fa483..7b6809e 100644
--- a/src/contrib/Spatial/Util/TermsEnumCompatibility.cs
+++ b/src/contrib/Spatial/Util/TermsEnumCompatibility.cs
@@ -26,115 +26,115 @@ using Lucene.Net.Util;
 
 namespace Lucene.Net.Spatial.Util
 {
-	/// <summary>
-	/// Wraps Lucene 3 TermEnum to make it look like a Lucene 4 TermsEnum
-	/// SOLR-2155
-	/// @author dsmiley
-	/// </summary>
-	public class TermsEnumCompatibility
-	{
-		private readonly IndexReader reader;
-		private readonly String fieldName;
-		private TermEnum termEnum;
-		private bool initialState = true;
+    /// <summary>
+    /// Wraps Lucene 3 TermEnum to make it look like a Lucene 4 TermsEnum
+    /// SOLR-2155
+    /// @author dsmiley
+    /// </summary>
+    public class TermsEnumCompatibility
+    {
+        private readonly IndexReader reader;
+        private readonly String fieldName;
+        private TermEnum termEnum;
+        private bool initialState = true;
 
-		public TermsEnumCompatibility(IndexReader reader, String fieldName)
-		{
-			this.reader = reader;
-			this.fieldName = string.Intern(fieldName);
-			this.termEnum = reader.Terms(new Term(this.fieldName));
-		}
+        public TermsEnumCompatibility(IndexReader reader, String fieldName)
+        {
+            this.reader = reader;
+            this.fieldName = string.Intern(fieldName);
+            this.termEnum = reader.Terms(new Term(this.fieldName));
+        }
 
-		public TermEnum GetTermEnum()
-		{
-			return termEnum;
-		}
+        public TermEnum GetTermEnum()
+        {
+            return termEnum;
+        }
 
-		public Term Term()
-		{
-			Term t = termEnum.Term;
-			return t != null && t.Field == fieldName ? t : null;
-		}
+        public Term Term()
+        {
+            Term t = termEnum.Term;
+            return t != null && t.Field == fieldName ? t : null;
+        }
 
-		public Term Next()
-		{
-			//in Lucene 3, a call to reader.terms(term) is already pre-positioned, you don't call next first
-			if (initialState)
-			{
-				initialState = false;
-				return Term();
-			}
-			else
-			{
-				return termEnum.Next() ? Term() : null;
-			}
-		}
+        public Term Next()
+        {
+            //in Lucene 3, a call to reader.terms(term) is already pre-positioned, you don't call next first
+            if (initialState)
+            {
+                initialState = false;
+                return Term();
+            }
+            else
+            {
+                return termEnum.Next() ? Term() : null;
+            }
+        }
 
-		public void Close()
-		{
-			termEnum.Close();
-		}
+        public void Close()
+        {
+            termEnum.Close();
+        }
 
-		public enum SeekStatus
-		{
-			END,
-			FOUND,
-			NOT_FOUND
-		}
+        public enum SeekStatus
+        {
+            END,
+            FOUND,
+            NOT_FOUND
+        }
 
-		public SeekStatus Seek(String value)
-		{
-			termEnum = reader.Terms(new Term(this.fieldName, value));
-			Term t = Term();
-			if (t == null)
-				return SeekStatus.END;
-			return (t.Text.Equals(value)) ? SeekStatus.FOUND : SeekStatus.NOT_FOUND;
-		}
+        public SeekStatus Seek(String value)
+        {
+            termEnum = reader.Terms(new Term(this.fieldName, value));
+            Term t = Term();
+            if (t == null)
+                return SeekStatus.END;
+            return (t.Text.Equals(value)) ? SeekStatus.FOUND : SeekStatus.NOT_FOUND;
+        }
 
-		/// <summary>
-		/// Seeks to the specified term, if it exists, or to the
-		/// next (ceiling) term.  Returns SeekStatus to
-		/// indicate whether exact term was found, a different
-		/// term was found, or EOF was hit.  The target term may
-		/// be before or after the current term.  If this returns
-		/// SeekStatus.END, the enum is unpositioned.
-		/// </summary>
-		/// <param name="value"></param>
-		/// <returns></returns>
-		public SeekStatus SeekCeil(String value)
-		{
-			return Seek(value);
-		}
+        /// <summary>
+        /// Seeks to the specified term, if it exists, or to the
+        /// next (ceiling) term.  Returns SeekStatus to
+        /// indicate whether exact term was found, a different
+        /// term was found, or EOF was hit.  The target term may
+        /// be before or after the current term.  If this returns
+        /// SeekStatus.END, the enum is unpositioned.
+        /// </summary>
+        /// <param name="value"></param>
+        /// <returns></returns>
+        public SeekStatus SeekCeil(String value)
+        {
+            return Seek(value);
+        }
 
-		/// <summary>
-		/// Returns the number of documents that have at least one
-		/// term for this field, or -1 if this measure isn't
-		/// stored by the codec.  Note that, just like other term
-		/// measures, this measure does not take deleted documents
-		/// into account.
-		/// </summary>
-		/// <returns></returns>
-		public int GetDocCount()
-		{
-			return -1; // TODO find a way to efficiently determine this
-		}
+        /// <summary>
+        /// Returns the number of documents that have at least one
+        /// term for this field, or -1 if this measure isn't
+        /// stored by the codec.  Note that, just like other term
+        /// measures, this measure does not take deleted documents
+        /// into account.
+        /// </summary>
+        /// <returns></returns>
+        public int GetDocCount()
+        {
+            return -1; // TODO find a way to efficiently determine this
+        }
 
-		public void Docs(OpenBitSet bits)
-		{
-			var termDocs = reader.TermDocs(new Term(fieldName, Term().Text));
-			while (termDocs.Next())
-			{
-				bits.FastSet(termDocs.Doc);
-			}
-		}
+        public void Docs(OpenBitSet bits)
+        {
+            var termDocs = reader.TermDocs(new Term(fieldName, Term().Text));
+            while (termDocs.Next())
+            {
+                bits.FastSet(termDocs.Doc);
+            }
+        }
 
-		public void Docs(FixedBitSet bits)
-		{
-			var termDocs = reader.TermDocs(new Term(fieldName, Term().Text));
-			while (termDocs.Next())
-			{
-				bits.Set(termDocs.Doc);
-			}
-		}
-	}
+        public void Docs(FixedBitSet bits)
+        {
+            var termDocs = reader.TermDocs(new Term(fieldName, Term().Text));
+            while (termDocs.Next())
+            {
+                bits.Set(termDocs.Doc);
+            }
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Spatial/Util/TermsFilter.cs
----------------------------------------------------------------------
diff --git a/src/contrib/Spatial/Util/TermsFilter.cs b/src/contrib/Spatial/Util/TermsFilter.cs
index 4514277..4acfcef 100644
--- a/src/contrib/Spatial/Util/TermsFilter.cs
+++ b/src/contrib/Spatial/Util/TermsFilter.cs
@@ -1,4 +1,4 @@
-/*
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -23,95 +23,95 @@ using Lucene.Net.Search;
 
 namespace Lucene.Net.Spatial.Util
 {
-	/// <summary>
-	/// Constructs a filter for docs matching any of the terms added to this class.
-	/// Unlike a RangeFilter this can be used for filtering on multiple terms that are not necessarily in
-	/// a sequence. An example might be a collection of primary keys from a database query result or perhaps
-	/// a choice of "category" labels picked by the end user. As a filter, this is much faster than the
-	/// equivalent query (a BooleanQuery with many "should" TermQueries)
-	/// </summary>
-	public class TermsFilter : Filter
-	{
-		private readonly SortedSet<Term> terms = new SortedSet<Term>();
+    /// <summary>
+    /// Constructs a filter for docs matching any of the terms added to this class.
+    /// Unlike a RangeFilter this can be used for filtering on multiple terms that are not necessarily in
+    /// a sequence. An example might be a collection of primary keys from a database query result or perhaps
+    /// a choice of "category" labels picked by the end user. As a filter, this is much faster than the
+    /// equivalent query (a BooleanQuery with many "should" TermQueries)
+    /// </summary>
+    public class TermsFilter : Filter
+    {
+        private readonly SortedSet<Term> terms = new SortedSet<Term>();
 
-		/// <summary>
-		/// Adds a term to the list of acceptable terms
-		/// </summary>
-		/// <param name="term"></param>
-		public void AddTerm(Term term)
-		{
-			terms.Add(term);
-		}
+        /// <summary>
+        /// Adds a term to the list of acceptable terms
+        /// </summary>
+        /// <param name="term"></param>
+        public void AddTerm(Term term)
+        {
+            terms.Add(term);
+        }
 
-		public override DocIdSet GetDocIdSet(IndexReader reader)
-		{
-			var result = new FixedBitSet(reader.MaxDoc);
-			var fields = reader.GetFieldNames(IndexReader.FieldOption.ALL);
+        public override DocIdSet GetDocIdSet(IndexReader reader)
+        {
+            var result = new FixedBitSet(reader.MaxDoc);
+            var fields = reader.GetFieldNames(IndexReader.FieldOption.ALL);
 
-			if (fields == null || fields.Count == 0)
-			{
-				return result;
-			}
+            if (fields == null || fields.Count == 0)
+            {
+                return result;
+            }
 
-			String lastField = null;
-			TermsEnumCompatibility termsEnum = null;
-			foreach (Term term in terms)
-			{
-				if (!term.Field.Equals(lastField))
-				{
-					var termsC = new TermsEnumCompatibility(reader, term.Field);
-					if (termsC.Term() == null)
-					{
-						return result;
-					}
-					termsEnum = termsC;
-					lastField = term.Field;
-				}
+            String lastField = null;
+            TermsEnumCompatibility termsEnum = null;
+            foreach (Term term in terms)
+            {
+                if (!term.Field.Equals(lastField))
+                {
+                    var termsC = new TermsEnumCompatibility(reader, term.Field);
+                    if (termsC.Term() == null)
+                    {
+                        return result;
+                    }
+                    termsEnum = termsC;
+                    lastField = term.Field;
+                }
 
-				if (terms != null)
-				{
-					// TODO this check doesn't make sense, decide which variable its supposed to be for
-					Debug.Assert(termsEnum != null);
-					if (termsEnum.SeekCeil(term.Text) == TermsEnumCompatibility.SeekStatus.FOUND)
-					{
-						termsEnum.Docs(result);
-					}
-				}
-			}
-			return result;
-		}
+                if (terms != null)
+                {
+                    // TODO this check doesn't make sense, decide which variable its supposed to be for
+                    Debug.Assert(termsEnum != null);
+                    if (termsEnum.SeekCeil(term.Text) == TermsEnumCompatibility.SeekStatus.FOUND)
+                    {
+                        termsEnum.Docs(result);
+                    }
+                }
+            }
+            return result;
+        }
 
-		public override bool Equals(object obj)
-		{
-			if (this == obj)
-				return true;
+        public override bool Equals(object obj)
+        {
+            if (this == obj)
+                return true;
 
-			if ((obj == null) || (obj.GetType() != this.GetType()))
-				return false;
+            if ((obj == null) || (obj.GetType() != this.GetType()))
+                return false;
 
-			var test = (TermsFilter)obj;
-			if (terms == test.terms)
-				return true;
-			if (terms == null || terms.Count != test.terms.Count)
-				return false;
+            var test = (TermsFilter)obj;
+            if (terms == test.terms)
+                return true;
+            if (terms == null || terms.Count != test.terms.Count)
+                return false;
 
-			var e1 = terms.GetEnumerator();
-			var e2 = test.terms.GetEnumerator();
-			while (e1.MoveNext() && e2.MoveNext())
-			{
-				if (!e1.Current.Equals(e2.Current)) return false;
-			}
-			return true;
-		}
+            var e1 = terms.GetEnumerator();
+            var e2 = test.terms.GetEnumerator();
+            while (e1.MoveNext() && e2.MoveNext())
+            {
+                if (!e1.Current.Equals(e2.Current)) return false;
+            }
+            return true;
+        }
 
-		public override int GetHashCode()
-		{
-			int hash = 9;
-			foreach (Term term in terms)
-			{
-				hash = 31 * hash + term.GetHashCode();
-			}
-			return hash;
-		}
-	}
+        public override int GetHashCode()
+        {
+            int hash = 9;
+            foreach (Term term in terms)
+            {
+                hash = 31 * hash + term.GetHashCode();
+            }
+            return hash;
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Spatial/Util/ValueSourceFilter.cs
----------------------------------------------------------------------
diff --git a/src/contrib/Spatial/Util/ValueSourceFilter.cs b/src/contrib/Spatial/Util/ValueSourceFilter.cs
index f969c05..e92c120 100644
--- a/src/contrib/Spatial/Util/ValueSourceFilter.cs
+++ b/src/contrib/Spatial/Util/ValueSourceFilter.cs
@@ -1,4 +1,4 @@
-/*
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -25,30 +25,30 @@ namespace Lucene.Net.Spatial.Util
     /// Filter that matches all documents where a valuesource is
     /// in between a range of <c>min</c> and <c>max</c> inclusive.
     /// </summary>
-	public class ValueSourceFilter : Filter
-	{
-		readonly Filter startingFilter;
-		readonly ValueSource source;
-		public readonly double min;
-		public readonly double max;
+    public class ValueSourceFilter : Filter
+    {
+        readonly Filter startingFilter;
+        readonly ValueSource source;
+        public readonly double min;
+        public readonly double max;
 
-		public ValueSourceFilter(Filter startingFilter, ValueSource source, double min, double max)
-		{
-			if (startingFilter == null)
-			{
-				throw new ArgumentException("please provide a non-null startingFilter; you can use QueryWrapperFilter(MatchAllDocsQuery) as a no-op filter", "startingFilter");
-			}
-			this.startingFilter = startingFilter;
-			this.source = source;
-			this.min = min;
-			this.max = max;
-		}
+        public ValueSourceFilter(Filter startingFilter, ValueSource source, double min, double max)
+        {
+            if (startingFilter == null)
+            {
+                throw new ArgumentException("please provide a non-null startingFilter; you can use QueryWrapperFilter(MatchAllDocsQuery) as a no-op filter", "startingFilter");
+            }
+            this.startingFilter = startingFilter;
+            this.source = source;
+            this.min = min;
+            this.max = max;
+        }
 
-		public override DocIdSet GetDocIdSet(Index.IndexReader reader)
-		{
-			var values = source.GetValues(reader);
-			return new ValueSourceFilteredDocIdSet(startingFilter.GetDocIdSet(reader), values, this);
-		}
+        public override DocIdSet GetDocIdSet(Index.IndexReader reader)
+        {
+            var values = source.GetValues(reader);
+            return new ValueSourceFilteredDocIdSet(startingFilter.GetDocIdSet(reader), values, this);
+        }
 
         public class ValueSourceFilteredDocIdSet : FilteredDocIdSet
         {
@@ -68,5 +68,5 @@ namespace Lucene.Net.Spatial.Util
                 return val >= enclosingFilter.min && val <= enclosingFilter.max;
             }
         }
-	}
+    }
 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Spatial/Vector/DistanceValueSource.cs
----------------------------------------------------------------------
diff --git a/src/contrib/Spatial/Vector/DistanceValueSource.cs b/src/contrib/Spatial/Vector/DistanceValueSource.cs
index 29439e1..19e2ea0 100644
--- a/src/contrib/Spatial/Vector/DistanceValueSource.cs
+++ b/src/contrib/Spatial/Vector/DistanceValueSource.cs
@@ -1,4 +1,4 @@
-/*
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -26,93 +26,93 @@ using Spatial4n.Core.Shapes.Impl;
 
 namespace Lucene.Net.Spatial.Vector
 {
-	/// <summary>
+    /// <summary>
     /// An implementation of the Lucene ValueSource model that returns the distance.
-	/// </summary>
-	public class DistanceValueSource : ValueSource
-	{
-		private readonly PointVectorStrategy strategy;
-		private readonly Point from;
+    /// </summary>
+    public class DistanceValueSource : ValueSource
+    {
+        private readonly PointVectorStrategy strategy;
+        private readonly Point from;
 
-		public DistanceValueSource(PointVectorStrategy strategy, Point from)
-		{
-			this.strategy = strategy;
-			this.from = from;
-		}
+        public DistanceValueSource(PointVectorStrategy strategy, Point from)
+        {
+            this.strategy = strategy;
+            this.from = from;
+        }
 
-		public class DistanceDocValues : DocValues
-		{
-			private readonly DistanceValueSource enclosingInstance;
+        public class DistanceDocValues : DocValues
+        {
+            private readonly DistanceValueSource enclosingInstance;
 
-			private readonly double[] ptX, ptY;
-			private readonly IBits validX, validY;
+            private readonly double[] ptX, ptY;
+            private readonly IBits validX, validY;
 
             private readonly Point from;
             private readonly DistanceCalculator calculator;
             private readonly double nullValue;
 
-			public DistanceDocValues(DistanceValueSource enclosingInstance, IndexReader reader)
-			{
-				this.enclosingInstance = enclosingInstance;
+            public DistanceDocValues(DistanceValueSource enclosingInstance, IndexReader reader)
+            {
+                this.enclosingInstance = enclosingInstance;
 
-				ptX = FieldCache_Fields.DEFAULT.GetDoubles(reader, enclosingInstance.strategy.GetFieldNameX()/*, true*/);
-				ptY = FieldCache_Fields.DEFAULT.GetDoubles(reader, enclosingInstance.strategy.GetFieldNameY()/*, true*/);
-				validX = FieldCache_Fields.DEFAULT.GetDocsWithField(reader, enclosingInstance.strategy.GetFieldNameX());
-				validY = FieldCache_Fields.DEFAULT.GetDocsWithField(reader, enclosingInstance.strategy.GetFieldNameY());
+                ptX = FieldCache_Fields.DEFAULT.GetDoubles(reader, enclosingInstance.strategy.GetFieldNameX()/*, true*/);
+                ptY = FieldCache_Fields.DEFAULT.GetDoubles(reader, enclosingInstance.strategy.GetFieldNameY()/*, true*/);
+                validX = FieldCache_Fields.DEFAULT.GetDocsWithField(reader, enclosingInstance.strategy.GetFieldNameX());
+                validY = FieldCache_Fields.DEFAULT.GetDocsWithField(reader, enclosingInstance.strategy.GetFieldNameY());
 
                 from = enclosingInstance.from;
                 calculator = enclosingInstance.strategy.GetSpatialContext().GetDistCalc();
                 nullValue = (enclosingInstance.strategy.GetSpatialContext().IsGeo() ? 180 : double.MaxValue);
-			}
-
-			public override float FloatVal(int doc)
-			{
-				return (float)DoubleVal(doc);
-			}
-
-			public override double DoubleVal(int doc)
-			{
-				// make sure it has minX and area
-				if (validX.Get(doc))
-				{
-				    Debug.Assert(validY.Get(doc));
-					return calculator.Distance(from, ptX[doc], ptY[doc]);
-				}
-				return nullValue;
-			}
-
-			public override string ToString(int doc)
-			{
-				return enclosingInstance.Description() + "=" + FloatVal(doc);
-			}
-		}
-
-		public override DocValues GetValues(IndexReader reader)
-		{
-			return new DistanceDocValues(this, reader);
-		}
-
-		public override string Description()
-		{
+            }
+
+            public override float FloatVal(int doc)
+            {
+                return (float)DoubleVal(doc);
+            }
+
+            public override double DoubleVal(int doc)
+            {
+                // make sure it has minX and area
+                if (validX.Get(doc))
+                {
+                    Debug.Assert(validY.Get(doc));
+                    return calculator.Distance(from, ptX[doc], ptY[doc]);
+                }
+                return nullValue;
+            }
+
+            public override string ToString(int doc)
+            {
+                return enclosingInstance.Description() + "=" + FloatVal(doc);
+            }
+        }
+
+        public override DocValues GetValues(IndexReader reader)
+        {
+            return new DistanceDocValues(this, reader);
+        }
+
+        public override string Description()
+        {
             return "DistanceValueSource(" + strategy + ", " + from + ")";
-		}
+        }
 
-		public override bool Equals(object o)
-		{
-			if (this == o) return true;
+        public override bool Equals(object o)
+        {
+            if (this == o) return true;
 
-			var that = o as DistanceValueSource;
-			if (that == null) return false;
+            var that = o as DistanceValueSource;
+            if (that == null) return false;
 
             if (!from.Equals(that.from)) return false;
             if (!strategy.Equals(that.strategy)) return false;
 
-			return true;
-		}
+            return true;
+        }
 
-		public override int GetHashCode()
-		{
-		    return from.GetHashCode();
-		}
-	}
+        public override int GetHashCode()
+        {
+            return from.GetHashCode();
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Spatial/Vector/PointVectorStrategy.cs
----------------------------------------------------------------------
diff --git a/src/contrib/Spatial/Vector/PointVectorStrategy.cs b/src/contrib/Spatial/Vector/PointVectorStrategy.cs
index 5f3cd69..f3ef815 100644
--- a/src/contrib/Spatial/Vector/PointVectorStrategy.cs
+++ b/src/contrib/Spatial/Vector/PointVectorStrategy.cs
@@ -1,4 +1,4 @@
-/*
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -36,70 +36,70 @@ namespace Lucene.Net.Spatial.Vector
     /// Due to the simple use of numeric fields, this Strategy provides support for sorting by
     /// distance through {@link DistanceValueSource}
     /// </summary>
-	public class PointVectorStrategy : SpatialStrategy
-	{
-		public static String SUFFIX_X = "__x";
-		public static String SUFFIX_Y = "__y";
-
-		private readonly String fieldNameX;
-		private readonly String fieldNameY;
-
-		public int precisionStep = 8; // same as solr default
-
-		public PointVectorStrategy(SpatialContext ctx, String fieldNamePrefix)
-			: base(ctx, fieldNamePrefix)
-		{
-			this.fieldNameX = fieldNamePrefix + SUFFIX_X;
-			this.fieldNameY = fieldNamePrefix + SUFFIX_Y;
-		}
-
-		public void SetPrecisionStep(int p)
-		{
-			precisionStep = p;
-			if (precisionStep <= 0 || precisionStep >= 64)
-				precisionStep = int.MaxValue;
-		}
-
-		public string GetFieldNameX()
-		{
-			return fieldNameX;
-		}
-
-		public string GetFieldNameY()
-		{
-			return fieldNameY;
-		}
-
-		public override AbstractField[] CreateIndexableFields(Shape shape)
-		{
-		    var point = shape as Point;
-		    if (point != null)
-		        return CreateIndexableFields(point);
-
-		    throw new InvalidOperationException("Can only index Point, not " + shape);
-		}
+    public class PointVectorStrategy : SpatialStrategy
+    {
+        public static String SUFFIX_X = "__x";
+        public static String SUFFIX_Y = "__y";
+
+        private readonly String fieldNameX;
+        private readonly String fieldNameY;
+
+        public int precisionStep = 8; // same as solr default
+
+        public PointVectorStrategy(SpatialContext ctx, String fieldNamePrefix)
+            : base(ctx, fieldNamePrefix)
+        {
+            this.fieldNameX = fieldNamePrefix + SUFFIX_X;
+            this.fieldNameY = fieldNamePrefix + SUFFIX_Y;
+        }
+
+        public void SetPrecisionStep(int p)
+        {
+            precisionStep = p;
+            if (precisionStep <= 0 || precisionStep >= 64)
+                precisionStep = int.MaxValue;
+        }
+
+        public string GetFieldNameX()
+        {
+            return fieldNameX;
+        }
+
+        public string GetFieldNameY()
+        {
+            return fieldNameY;
+        }
+
+        public override AbstractField[] CreateIndexableFields(Shape shape)
+        {
+            var point = shape as Point;
+            if (point != null)
+                return CreateIndexableFields(point);
+
+            throw new InvalidOperationException("Can only index Point, not " + shape);
+        }
 
         public AbstractField[] CreateIndexableFields(Point point)
         {
-				var f = new AbstractField[2];
+                var f = new AbstractField[2];
 
-				var f0 = new NumericField(fieldNameX, precisionStep, Field.Store.NO, true)
-				         	{OmitNorms = true, OmitTermFreqAndPositions = true};
-				f0.SetDoubleValue(point.GetX());
-				f[0] = f0;
+                var f0 = new NumericField(fieldNameX, precisionStep, Field.Store.NO, true)
+                             {OmitNorms = true, OmitTermFreqAndPositions = true};
+                f0.SetDoubleValue(point.GetX());
+                f[0] = f0;
 
-				var f1 = new NumericField(fieldNameY, precisionStep, Field.Store.NO, true)
-				         	{OmitNorms = true, OmitTermFreqAndPositions = true};
-				f1.SetDoubleValue(point.GetY());
-				f[1] = f1;
+                var f1 = new NumericField(fieldNameY, precisionStep, Field.Store.NO, true)
+                             {OmitNorms = true, OmitTermFreqAndPositions = true};
+                f1.SetDoubleValue(point.GetY());
+                f[1] = f1;
 
-				return f;
-		}
+                return f;
+        }
 
-		public override ValueSource MakeDistanceValueSource(Point queryPoint)
-		{
+        public override ValueSource MakeDistanceValueSource(Point queryPoint)
+        {
             return new DistanceValueSource(this, queryPoint);
-		}
+        }
 
         public override ConstantScoreQuery MakeQuery(SpatialArgs args)
         {
@@ -129,74 +129,74 @@ namespace Lucene.Net.Spatial.Vector
                                             "found [" + shape.GetType().Name + "]"); //TODO
         }
 
-	    //TODO this is basically old code that hasn't been verified well and should probably be removed
+        //TODO this is basically old code that hasn't been verified well and should probably be removed
         public Query MakeQueryDistanceScore(SpatialArgs args)
         {
-	        // For starters, just limit the bbox
-			var shape = args.Shape;
-			if (!(shape is Rectangle || shape is Circle))
-				throw new InvalidOperationException("Only Rectangles and Circles are currently supported, found ["
-					+ shape.GetType().Name + "]");//TODO
-
-			Rectangle bbox = shape.GetBoundingBox();
-			if (bbox.GetCrossesDateLine())
-			{
-				throw new InvalidOperationException("Crossing dateline not yet supported");
-			}
-
-			ValueSource valueSource = null;
-
-			Query spatial = null;
-			SpatialOperation op = args.Operation;
-
-			if (SpatialOperation.Is(op,
-				SpatialOperation.BBoxWithin,
-				SpatialOperation.BBoxIntersects))
-			{
-				spatial = MakeWithin(bbox);
-			}
-			else if (SpatialOperation.Is(op,
-			  SpatialOperation.Intersects,
-			  SpatialOperation.IsWithin))
-			{
-				spatial = MakeWithin(bbox);
-				var circle = args.Shape as Circle;
-				if (circle != null)
-				{
-					// Make the ValueSource
+            // For starters, just limit the bbox
+            var shape = args.Shape;
+            if (!(shape is Rectangle || shape is Circle))
+                throw new InvalidOperationException("Only Rectangles and Circles are currently supported, found ["
+                    + shape.GetType().Name + "]");//TODO
+
+            Rectangle bbox = shape.GetBoundingBox();
+            if (bbox.GetCrossesDateLine())
+            {
+                throw new InvalidOperationException("Crossing dateline not yet supported");
+            }
+
+            ValueSource valueSource = null;
+
+            Query spatial = null;
+            SpatialOperation op = args.Operation;
+
+            if (SpatialOperation.Is(op,
+                SpatialOperation.BBoxWithin,
+                SpatialOperation.BBoxIntersects))
+            {
+                spatial = MakeWithin(bbox);
+            }
+            else if (SpatialOperation.Is(op,
+              SpatialOperation.Intersects,
+              SpatialOperation.IsWithin))
+            {
+                spatial = MakeWithin(bbox);
+                var circle = args.Shape as Circle;
+                if (circle != null)
+                {
+                    // Make the ValueSource
                     valueSource = MakeDistanceValueSource(shape.GetCenter());
 
-					var vsf = new ValueSourceFilter(
-						new QueryWrapperFilter(spatial), valueSource, 0, circle.GetRadius());
-
-					spatial = new FilteredQuery(new MatchAllDocsQuery(), vsf);
-				}
-			}
-			else if (op == SpatialOperation.IsDisjointTo)
-			{
-				spatial = MakeDisjoint(bbox);
-			}
-
-			if (spatial == null)
-			{
-				throw new UnsupportedSpatialOperation(args.Operation);
-			}
-
-			if (valueSource != null)
-			{
-				valueSource = new CachingDoubleValueSource(valueSource);
-			}
-			else
-			{
+                    var vsf = new ValueSourceFilter(
+                        new QueryWrapperFilter(spatial), valueSource, 0, circle.GetRadius());
+
+                    spatial = new FilteredQuery(new MatchAllDocsQuery(), vsf);
+                }
+            }
+            else if (op == SpatialOperation.IsDisjointTo)
+            {
+                spatial = MakeDisjoint(bbox);
+            }
+
+            if (spatial == null)
+            {
+                throw new UnsupportedSpatialOperation(args.Operation);
+            }
+
+            if (valueSource != null)
+            {
+                valueSource = new CachingDoubleValueSource(valueSource);
+            }
+            else
+            {
                 valueSource = MakeDistanceValueSource(shape.GetCenter());
-			}
-			Query spatialRankingQuery = new FunctionQuery(valueSource);
-			var bq = new BooleanQuery();
-			bq.Add(spatial, Occur.MUST);
-			bq.Add(spatialRankingQuery, Occur.MUST);
-			return bq;
+            }
+            Query spatialRankingQuery = new FunctionQuery(valueSource);
+            var bq = new BooleanQuery();
+            bq.Add(spatial, Occur.MUST);
+            bq.Add(spatialRankingQuery, Occur.MUST);
+            return bq;
 
-		}
+        }
 
         public override Filter MakeFilter(SpatialArgs args)
         {
@@ -209,30 +209,30 @@ namespace Lucene.Net.Spatial.Vector
                 return new QueryWrapperFilter(csq);
         }
 
-	    /// <summary>
-		/// Constructs a query to retrieve documents that fully contain the input envelope.
-		/// </summary>
-		/// <param name="bbox"></param>
+        /// <summary>
+        /// Constructs a query to retrieve documents that fully contain the input envelope.
+        /// </summary>
+        /// <param name="bbox"></param>
         private Query MakeWithin(Rectangle bbox)
-	    {
-	        var bq = new BooleanQuery();
-	        const Occur MUST = Occur.MUST;
-	        if (bbox.GetCrossesDateLine())
-	        {
-	            //use null as performance trick since no data will be beyond the world bounds
-	            bq.Add(RangeQuery(fieldNameX, null /*-180*/, bbox.GetMaxX()), Occur.SHOULD);
-	            bq.Add(RangeQuery(fieldNameX, bbox.GetMinX(), null /*+180*/), Occur.SHOULD);
-	            bq.MinimumNumberShouldMatch = 1; //must match at least one of the SHOULD
-	        }
-	        else
-	        {
-	            bq.Add(RangeQuery(fieldNameX, bbox.GetMinX(), bbox.GetMaxX()), MUST);
-	        }
-	        bq.Add(RangeQuery(fieldNameY, bbox.GetMinY(), bbox.GetMaxY()), MUST);
-	        return bq;
-	    }
-
-	    private NumericRangeQuery<Double> RangeQuery(String fieldName, double? min, double? max)
+        {
+            var bq = new BooleanQuery();
+            const Occur MUST = Occur.MUST;
+            if (bbox.GetCrossesDateLine())
+            {
+                //use null as performance trick since no data will be beyond the world bounds
+                bq.Add(RangeQuery(fieldNameX, null /*-180*/, bbox.GetMaxX()), Occur.SHOULD);
+                bq.Add(RangeQuery(fieldNameX, bbox.GetMinX(), null /*+180*/), Occur.SHOULD);
+                bq.MinimumNumberShouldMatch = 1; //must match at least one of the SHOULD
+            }
+            else
+            {
+                bq.Add(RangeQuery(fieldNameX, bbox.GetMinX(), bbox.GetMaxX()), MUST);
+            }
+            bq.Add(RangeQuery(fieldNameY, bbox.GetMinY(), bbox.GetMaxY()), MUST);
+            return bq;
+        }
+
+        private NumericRangeQuery<Double> RangeQuery(String fieldName, double? min, double? max)
         {
             return NumericRangeQuery.NewDoubleRange(
                 fieldName,
@@ -243,18 +243,18 @@ namespace Lucene.Net.Spatial.Vector
                 true); //inclusive
         }
 
-	    /// <summary>
-		/// Constructs a query to retrieve documents that fully contain the input envelope.
-		/// </summary>
-		/// <param name="bbox"></param>
+        /// <summary>
+        /// Constructs a query to retrieve documents that fully contain the input envelope.
+        /// </summary>
+        /// <param name="bbox"></param>
         private Query MakeDisjoint(Rectangle bbox)
-	    {
-	        if (bbox.GetCrossesDateLine())
-	            throw new InvalidOperationException("MakeDisjoint doesn't handle dateline cross");
-	        Query qX = RangeQuery(fieldNameX, bbox.GetMinX(), bbox.GetMaxX());
-	        Query qY = RangeQuery(fieldNameY, bbox.GetMinY(), bbox.GetMaxY());
-	        var bq = new BooleanQuery {{qX, Occur.MUST_NOT}, {qY, Occur.MUST_NOT}};
-	        return bq;
-	    }
-	}
+        {
+            if (bbox.GetCrossesDateLine())
+                throw new InvalidOperationException("MakeDisjoint doesn't handle dateline cross");
+            Query qX = RangeQuery(fieldNameX, bbox.GetMinX(), bbox.GetMaxX());
+            Query qY = RangeQuery(fieldNameY, bbox.GetMinY(), bbox.GetMaxY());
+            var bq = new BooleanQuery {{qX, Occur.MUST_NOT}, {qY, Occur.MUST_NOT}};
+            return bq;
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/SpellChecker/Spell/IDictionary.cs
----------------------------------------------------------------------
diff --git a/src/contrib/SpellChecker/Spell/IDictionary.cs b/src/contrib/SpellChecker/Spell/IDictionary.cs
index e6a4de3..53b916f 100644
--- a/src/contrib/SpellChecker/Spell/IDictionary.cs
+++ b/src/contrib/SpellChecker/Spell/IDictionary.cs
@@ -18,7 +18,7 @@
 
 namespace SpellChecker.Net.Search.Spell
 {
-	
+    
     /// <summary> A simple interface representing a Dictionary</summary>
     public interface IDictionary
     {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/SpellChecker/Spell/LuceneDictionary.cs
----------------------------------------------------------------------
diff --git a/src/contrib/SpellChecker/Spell/LuceneDictionary.cs b/src/contrib/SpellChecker/Spell/LuceneDictionary.cs
index b5539be..3771f24 100644
--- a/src/contrib/SpellChecker/Spell/LuceneDictionary.cs
+++ b/src/contrib/SpellChecker/Spell/LuceneDictionary.cs
@@ -32,7 +32,7 @@ namespace SpellChecker.Net.Search.Spell
     {
         internal IndexReader reader;
         internal System.String field;
-		
+        
         public LuceneDictionary(IndexReader reader, System.String field)
         {
             this.reader = reader;
@@ -53,7 +53,7 @@ namespace SpellChecker.Net.Search.Spell
         {
             return GetEnumerator();
         }
-		
+        
         internal sealed class LuceneIterator : System.Collections.Generic.IEnumerator<string>
         {
             private readonly TermEnum termEnum;
@@ -61,7 +61,7 @@ namespace SpellChecker.Net.Search.Spell
             private bool hasNextCalled;
 
             private readonly LuceneDictionary enclosingInstance;
-			
+            
             public LuceneIterator(LuceneDictionary enclosingInstance)
             {
                 this.enclosingInstance = enclosingInstance;
@@ -93,7 +93,7 @@ namespace SpellChecker.Net.Search.Spell
             {
                 get { return Current; }
             }
-			
+            
             public bool MoveNext()
             {
                 hasNextCalled = true;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/SpellChecker/Spell/PlainTextDictionary.cs
----------------------------------------------------------------------
diff --git a/src/contrib/SpellChecker/Spell/PlainTextDictionary.cs b/src/contrib/SpellChecker/Spell/PlainTextDictionary.cs
index 3d38b50..586450a 100644
--- a/src/contrib/SpellChecker/Spell/PlainTextDictionary.cs
+++ b/src/contrib/SpellChecker/Spell/PlainTextDictionary.cs
@@ -19,8 +19,8 @@ using System;
 
 namespace SpellChecker.Net.Search.Spell
 {
-	
-	
+    
+    
     /// <summary> Dictionary represented by a file text.
     /// <p/>Format allowed: 1 word per line:<br/>
     /// word1<br/>
@@ -46,16 +46,16 @@ namespace SpellChecker.Net.Search.Spell
         {
             return GetEnumerator();
         }
-		
+        
         private System.IO.StreamReader in_Renamed;
         private System.String line;
         private bool has_next_called;
-		
+        
         public PlainTextDictionary(System.IO.FileInfo file)
         {
             in_Renamed = new System.IO.StreamReader(new System.IO.StreamReader(file.FullName, System.Text.Encoding.Default).BaseStream, new System.IO.StreamReader(file.FullName, System.Text.Encoding.Default).CurrentEncoding);
         }
-		
+        
         public PlainTextDictionary(System.IO.Stream dictFile)
         {
             in_Renamed = new System.IO.StreamReader(new System.IO.StreamReader(dictFile, System.Text.Encoding.Default).BaseStream, new System.IO.StreamReader(dictFile, System.Text.Encoding.Default).CurrentEncoding);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/SpellChecker/Spell/SpellChecker.cs
----------------------------------------------------------------------
diff --git a/src/contrib/SpellChecker/Spell/SpellChecker.cs b/src/contrib/SpellChecker/Spell/SpellChecker.cs
index 6b43ee5..efa390e 100644
--- a/src/contrib/SpellChecker/Spell/SpellChecker.cs
+++ b/src/contrib/SpellChecker/Spell/SpellChecker.cs
@@ -223,7 +223,7 @@ namespace SpellChecker.Net.Search.Spell
                 String[] grams;
                 String key;
 
-				var alreadySeen = new HashSet<string>();
+                var alreadySeen = new HashSet<string>();
                 for (var ng = GetMin(lengthWord); ng <= GetMax(lengthWord); ng++)
                 {
                     key = "gram" + ng; // form key
@@ -288,8 +288,8 @@ namespace SpellChecker.Net.Search.Spell
                         }
                     }
 
-					if (alreadySeen.Add(sugWord.termString) == false) // we already seen this word, no point returning it twice
-						continue;
+                    if (alreadySeen.Add(sugWord.termString) == false) // we already seen this word, no point returning it twice
+                        continue;
 
                     sugQueue.InsertWithOverflow(sugWord);
                     if (sugQueue.Size() == numSug)