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:04 UTC

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

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/core/Document/Fieldable.cs
----------------------------------------------------------------------
diff --git a/src/core/Document/Fieldable.cs b/src/core/Document/Fieldable.cs
index 89d37d1..daa47f2 100644
--- a/src/core/Document/Fieldable.cs
+++ b/src/core/Document/Fieldable.cs
@@ -22,32 +22,32 @@ using FieldInvertState = Lucene.Net.Index.FieldInvertState;
 
 namespace Lucene.Net.Documents
 {
-	/// <summary> Synonymous with <see cref="Field" />.
-	/// 
-	/// <p/><bold>WARNING</bold>: This interface may change within minor versions, despite Lucene's backward compatibility requirements.
-	/// This means new methods may be added from version to version.  This change only affects the Fieldable API; other backwards
-	/// compatibility promises remain intact. For example, Lucene can still
-	/// read and write indices created within the same major version.
-	/// <p/>
-	/// 
-	/// 
-	/// </summary>
-	public interface IFieldable
-	{
+    /// <summary> Synonymous with <see cref="Field" />.
+    /// 
+    /// <p/><bold>WARNING</bold>: This interface may change within minor versions, despite Lucene's backward compatibility requirements.
+    /// This means new methods may be added from version to version.  This change only affects the Fieldable API; other backwards
+    /// compatibility promises remain intact. For example, Lucene can still
+    /// read and write indices created within the same major version.
+    /// <p/>
+    /// 
+    /// 
+    /// </summary>
+    public interface IFieldable
+    {
         /// <summary>Gets or sets the boost factor for hits for this field.  This value will be
         /// multiplied into the score of all hits on this this field of this
         /// document.
-	    /// 
-	    /// <p/>The boost is multiplied by <see cref="Lucene.Net.Documents.Document.Boost" /> of the document
-	    /// containing this field.  If a document has multiple fields with the same
-	    /// name, all such values are multiplied together.  This product is then
-	    /// used to compute the norm factor for the field.  By
-	    /// default, in the <see cref="Lucene.Net.Search.Similarity.ComputeNorm(String,Lucene.Net.Index.FieldInvertState)"/>
-	    /// method, the boost value is multiplied
-	    /// by the <see cref="Lucene.Net.Search.Similarity.LengthNorm(String,int)"/>
-	    /// and then rounded by <see cref="Lucene.Net.Search.Similarity.EncodeNorm(float)" /> before it is stored in the
-	    /// index.  One should attempt to ensure that this product does not overflow
-	    /// the range of that encoding.
+        /// 
+        /// <p/>The boost is multiplied by <see cref="Lucene.Net.Documents.Document.Boost" /> of the document
+        /// containing this field.  If a document has multiple fields with the same
+        /// name, all such values are multiplied together.  This product is then
+        /// used to compute the norm factor for the field.  By
+        /// default, in the <see cref="Lucene.Net.Search.Similarity.ComputeNorm(String,Lucene.Net.Index.FieldInvertState)"/>
+        /// method, the boost value is multiplied
+        /// by the <see cref="Lucene.Net.Search.Similarity.LengthNorm(String,int)"/>
+        /// and then rounded by <see cref="Lucene.Net.Search.Similarity.EncodeNorm(float)" /> before it is stored in the
+        /// index.  One should attempt to ensure that this product does not overflow
+        /// the range of that encoding.
         /// 
         /// <p/>The default value is 1.0.
         /// 
@@ -56,78 +56,78 @@ namespace Lucene.Net.Documents
         /// <see cref="Lucene.Net.Search.Searcher.Doc(int)" /> may thus not have the same value present as when
         /// this field was indexed.
         /// 
-	    /// </summary>
-	    /// <seealso cref="Lucene.Net.Documents.Document.Boost">
-	    /// </seealso>
-	    /// <seealso cref="Lucene.Net.Search.Similarity.ComputeNorm(String, FieldInvertState)">
-	    /// </seealso>
-	    /// <seealso cref="Lucene.Net.Search.Similarity.EncodeNorm(float)">
-	    /// </seealso>
-	    float Boost { get; set; }
-
-	    /// <summary>Returns the name of the field as an interned string.
-	    /// For example "date", "title", "body", ...
-	    /// </summary>
-	    string Name { get; }
-
-	    /// <summary>The value of the field as a String, or null.
-	    /// <p/>
-	    /// For indexing, if isStored()==true, the stringValue() will be used as the stored field value
-	    /// unless isBinary()==true, in which case GetBinaryValue() will be used.
-	    /// 
-	    /// If isIndexed()==true and isTokenized()==false, this String value will be indexed as a single token.
-	    /// If isIndexed()==true and isTokenized()==true, then tokenStreamValue() will be used to generate indexed tokens if not null,
-	    /// else readerValue() will be used to generate indexed tokens if not null, else stringValue() will be used to generate tokens.
-	    /// </summary>
-	    string StringValue { get; }
-
-	    /// <summary>The value of the field as a Reader, which can be used at index time to generate indexed tokens.</summary>
-	    /// <seealso cref="StringValue()">
-	    /// </seealso>
-	    TextReader ReaderValue { get; }
-
-	    /// <summary>The TokenStream for this field to be used when indexing, or null.</summary>
-	    /// <seealso cref="StringValue()">
-	    /// </seealso>
-	    TokenStream TokenStreamValue { get; }
-
-	    /// <summary>True if the value of the field is to be stored in the index for return
-	    /// with search hits. 
-	    /// </summary>
-	    bool IsStored { get; }
-
-	    /// <summary>True if the value of the field is to be indexed, so that it may be
-	    /// searched on. 
-	    /// </summary>
-	    bool IsIndexed { get; }
-
-	    /// <summary>True if the value of the field should be tokenized as text prior to
-	    /// indexing.  Un-tokenized fields are indexed as a single word and may not be
-	    /// Reader-valued. 
-	    /// </summary>
-	    bool IsTokenized { get; }
-
-	    /// <summary>True if the term or terms used to index this field are stored as a term
-	    /// vector, available from <see cref="Lucene.Net.Index.IndexReader.GetTermFreqVector(int,String)" />.
-	    /// These methods do not provide access to the original content of the field,
-	    /// only to terms used to index it. If the original content must be
-	    /// preserved, use the <c>stored</c> attribute instead.
-	    /// 
-	    /// </summary>
-	    /// <seealso cref="Lucene.Net.Index.IndexReader.GetTermFreqVector(int, String)">
-	    /// </seealso>
-	    bool IsTermVectorStored { get; }
-
-	    /// <summary> True if terms are stored as term vector together with their offsets 
-	    /// (start and end positon in source text).
-	    /// </summary>
-	    bool IsStoreOffsetWithTermVector { get; }
-
-	    /// <summary> True if terms are stored as term vector together with their token positions.</summary>
-	    bool IsStorePositionWithTermVector { get; }
-
-	    /// <summary>True if the value of the field is stored as binary </summary>
-	    bool IsBinary { get; }
+        /// </summary>
+        /// <seealso cref="Lucene.Net.Documents.Document.Boost">
+        /// </seealso>
+        /// <seealso cref="Lucene.Net.Search.Similarity.ComputeNorm(String, FieldInvertState)">
+        /// </seealso>
+        /// <seealso cref="Lucene.Net.Search.Similarity.EncodeNorm(float)">
+        /// </seealso>
+        float Boost { get; set; }
+
+        /// <summary>Returns the name of the field as an interned string.
+        /// For example "date", "title", "body", ...
+        /// </summary>
+        string Name { get; }
+
+        /// <summary>The value of the field as a String, or null.
+        /// <p/>
+        /// For indexing, if isStored()==true, the stringValue() will be used as the stored field value
+        /// unless isBinary()==true, in which case GetBinaryValue() will be used.
+        /// 
+        /// If isIndexed()==true and isTokenized()==false, this String value will be indexed as a single token.
+        /// If isIndexed()==true and isTokenized()==true, then tokenStreamValue() will be used to generate indexed tokens if not null,
+        /// else readerValue() will be used to generate indexed tokens if not null, else stringValue() will be used to generate tokens.
+        /// </summary>
+        string StringValue { get; }
+
+        /// <summary>The value of the field as a Reader, which can be used at index time to generate indexed tokens.</summary>
+        /// <seealso cref="StringValue()">
+        /// </seealso>
+        TextReader ReaderValue { get; }
+
+        /// <summary>The TokenStream for this field to be used when indexing, or null.</summary>
+        /// <seealso cref="StringValue()">
+        /// </seealso>
+        TokenStream TokenStreamValue { get; }
+
+        /// <summary>True if the value of the field is to be stored in the index for return
+        /// with search hits. 
+        /// </summary>
+        bool IsStored { get; }
+
+        /// <summary>True if the value of the field is to be indexed, so that it may be
+        /// searched on. 
+        /// </summary>
+        bool IsIndexed { get; }
+
+        /// <summary>True if the value of the field should be tokenized as text prior to
+        /// indexing.  Un-tokenized fields are indexed as a single word and may not be
+        /// Reader-valued. 
+        /// </summary>
+        bool IsTokenized { get; }
+
+        /// <summary>True if the term or terms used to index this field are stored as a term
+        /// vector, available from <see cref="Lucene.Net.Index.IndexReader.GetTermFreqVector(int,String)" />.
+        /// These methods do not provide access to the original content of the field,
+        /// only to terms used to index it. If the original content must be
+        /// preserved, use the <c>stored</c> attribute instead.
+        /// 
+        /// </summary>
+        /// <seealso cref="Lucene.Net.Index.IndexReader.GetTermFreqVector(int, String)">
+        /// </seealso>
+        bool IsTermVectorStored { get; }
+
+        /// <summary> True if terms are stored as term vector together with their offsets 
+        /// (start and end positon in source text).
+        /// </summary>
+        bool IsStoreOffsetWithTermVector { get; }
+
+        /// <summary> True if terms are stored as term vector together with their token positions.</summary>
+        bool IsStorePositionWithTermVector { get; }
+
+        /// <summary>True if the value of the field is stored as binary </summary>
+        bool IsBinary { get; }
 
         /// <summary>
         /// True if norms are omitted for this indexed field.
@@ -137,69 +137,69 @@ namespace Lucene.Net.Documents
         /// This effectively disables indexing boosts and length normalization for this field.
         /// </para>
         /// </summary>
-	    bool OmitNorms { get; set; }
-
-
-	    /// <summary> Indicates whether a Field is Lazy or not.  The semantics of Lazy loading are such that if a Field is lazily loaded, retrieving
-	    /// it's values via <see cref="StringValue()" /> or <see cref="GetBinaryValue()" /> is only valid as long as the <see cref="Lucene.Net.Index.IndexReader" /> that
-	    /// retrieved the <see cref="Document" /> is still open.
-	    /// 
-	    /// </summary>
-	    /// <value> true if this field can be loaded lazily </value>
-	    bool IsLazy { get; }
-
-	    /// <summary> Returns offset into byte[] segment that is used as value, if Field is not binary
-	    /// returned value is undefined
-	    /// </summary>
-	    /// <value> index of the first character in byte[] segment that represents this Field value </value>
-	    int BinaryOffset { get; }
-
-	    /// <summary> Returns length of byte[] segment that is used as value, if Field is not binary
-	    /// returned value is undefined
-	    /// </summary>
-	    /// <value> length of byte[] segment that represents this Field value </value>
-	    int BinaryLength { get; }
-
-	    /// <summary> Return the raw byte[] for the binary field.  Note that
-	    /// you must also call <see cref="BinaryLength" /> and <see cref="BinaryOffset" />
-	    /// to know which range of bytes in this
-	    /// returned array belong to the field.
-	    /// </summary>
-	    /// <returns> reference to the Field value as byte[]. </returns>
-	    byte[] GetBinaryValue();
-
-	    /// <summary> Return the raw byte[] for the binary field.  Note that
+        bool OmitNorms { get; set; }
+
+
+        /// <summary> Indicates whether a Field is Lazy or not.  The semantics of Lazy loading are such that if a Field is lazily loaded, retrieving
+        /// it's values via <see cref="StringValue()" /> or <see cref="GetBinaryValue()" /> is only valid as long as the <see cref="Lucene.Net.Index.IndexReader" /> that
+        /// retrieved the <see cref="Document" /> is still open.
+        /// 
+        /// </summary>
+        /// <value> true if this field can be loaded lazily </value>
+        bool IsLazy { get; }
+
+        /// <summary> Returns offset into byte[] segment that is used as value, if Field is not binary
+        /// returned value is undefined
+        /// </summary>
+        /// <value> index of the first character in byte[] segment that represents this Field value </value>
+        int BinaryOffset { get; }
+
+        /// <summary> Returns length of byte[] segment that is used as value, if Field is not binary
+        /// returned value is undefined
+        /// </summary>
+        /// <value> length of byte[] segment that represents this Field value </value>
+        int BinaryLength { get; }
+
+        /// <summary> Return the raw byte[] for the binary field.  Note that
+        /// you must also call <see cref="BinaryLength" /> and <see cref="BinaryOffset" />
+        /// to know which range of bytes in this
+        /// returned array belong to the field.
+        /// </summary>
+        /// <returns> reference to the Field value as byte[]. </returns>
+        byte[] GetBinaryValue();
+
+        /// <summary> Return the raw byte[] for the binary field.  Note that
         /// you must also call <see cref="BinaryLength" /> and <see cref="BinaryOffset" />
-		/// to know which range of bytes in this
-		/// returned array belong to the field.<p/>
-		/// About reuse: if you pass in the result byte[] and it is
-		/// used, likely the underlying implementation will hold
-		/// onto this byte[] and return it in future calls to
-		/// <see cref="GetBinaryValue()" /> or <see cref="GetBinaryValue()" />.
-		/// So if you subsequently re-use the same byte[] elsewhere
-		/// it will alter this Fieldable's value.
-		/// </summary>
-		/// <param name="result"> User defined buffer that will be used if
-		/// possible.  If this is null or not large enough, a new
-		/// buffer is allocated
-		/// </param>
-		/// <returns> reference to the Field value as byte[].
-		/// </returns>
-		byte[] GetBinaryValue(byte[] result);
-
-	    /// Expert:
-	    /// <para>
-	    /// If set, omit term freq, positions and payloads from
-	    /// postings for this field.
-	    /// </para>
-	    /// <para>
-	    /// <b>NOTE</b>: While this option reduces storage space
-	    /// required in the index, it also means any query
-	    /// requiring positional information, such as
-	    /// <see cref="Lucene.Net.Search.PhraseQuery"/> or 
-	    /// <see cref="Lucene.Net.Search.Spans.SpanQuery"/> 
-	    /// subclasses will silently fail to find results.
-	    /// </para>
-	    bool OmitTermFreqAndPositions { set; get; }
-	}
+        /// to know which range of bytes in this
+        /// returned array belong to the field.<p/>
+        /// About reuse: if you pass in the result byte[] and it is
+        /// used, likely the underlying implementation will hold
+        /// onto this byte[] and return it in future calls to
+        /// <see cref="GetBinaryValue()" /> or <see cref="GetBinaryValue()" />.
+        /// So if you subsequently re-use the same byte[] elsewhere
+        /// it will alter this Fieldable's value.
+        /// </summary>
+        /// <param name="result"> User defined buffer that will be used if
+        /// possible.  If this is null or not large enough, a new
+        /// buffer is allocated
+        /// </param>
+        /// <returns> reference to the Field value as byte[].
+        /// </returns>
+        byte[] GetBinaryValue(byte[] result);
+
+        /// Expert:
+        /// <para>
+        /// If set, omit term freq, positions and payloads from
+        /// postings for this field.
+        /// </para>
+        /// <para>
+        /// <b>NOTE</b>: While this option reduces storage space
+        /// required in the index, it also means any query
+        /// requiring positional information, such as
+        /// <see cref="Lucene.Net.Search.PhraseQuery"/> or 
+        /// <see cref="Lucene.Net.Search.Spans.SpanQuery"/> 
+        /// subclasses will silently fail to find results.
+        /// </para>
+        bool OmitTermFreqAndPositions { set; get; }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/core/Document/LoadFirstFieldSelector.cs
----------------------------------------------------------------------
diff --git a/src/core/Document/LoadFirstFieldSelector.cs b/src/core/Document/LoadFirstFieldSelector.cs
index 4f353f6..c6a9dc3 100644
--- a/src/core/Document/LoadFirstFieldSelector.cs
+++ b/src/core/Document/LoadFirstFieldSelector.cs
@@ -18,18 +18,18 @@
 using System;
 namespace Lucene.Net.Documents
 {
-	
-	/// <summary> Load the First field and break.
-	/// <p/>
-	/// See <see cref="FieldSelectorResult.LOAD_AND_BREAK" />
-	/// </summary>
-	[Serializable]
-	public class LoadFirstFieldSelector : FieldSelector
-	{
-		
-		public virtual FieldSelectorResult Accept(System.String fieldName)
-		{
-			return FieldSelectorResult.LOAD_AND_BREAK;
-		}
-	}
+    
+    /// <summary> Load the First field and break.
+    /// <p/>
+    /// See <see cref="FieldSelectorResult.LOAD_AND_BREAK" />
+    /// </summary>
+    [Serializable]
+    public class LoadFirstFieldSelector : FieldSelector
+    {
+        
+        public virtual FieldSelectorResult Accept(System.String fieldName)
+        {
+            return FieldSelectorResult.LOAD_AND_BREAK;
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/core/Document/MapFieldSelector.cs
----------------------------------------------------------------------
diff --git a/src/core/Document/MapFieldSelector.cs b/src/core/Document/MapFieldSelector.cs
index 92a8959..87d91ff 100644
--- a/src/core/Document/MapFieldSelector.cs
+++ b/src/core/Document/MapFieldSelector.cs
@@ -22,47 +22,47 @@ using Lucene.Net.Support;
 
 namespace Lucene.Net.Documents
 {
-	/// <summary>A <see cref="FieldSelector" /> based on a Map of field names to <see cref="FieldSelectorResult" />s</summary>
-	[Serializable]
-	public class MapFieldSelector : FieldSelector
-	{
-		internal IDictionary<string, FieldSelectorResult> fieldSelections;
-		
-		/// <summary>Create a a MapFieldSelector</summary>
-		/// <param name="fieldSelections">maps from field names (String) to <see cref="FieldSelectorResult" />s
-		/// </param>
+    /// <summary>A <see cref="FieldSelector" /> based on a Map of field names to <see cref="FieldSelectorResult" />s</summary>
+    [Serializable]
+    public class MapFieldSelector : FieldSelector
+    {
+        internal IDictionary<string, FieldSelectorResult> fieldSelections;
+        
+        /// <summary>Create a a MapFieldSelector</summary>
+        /// <param name="fieldSelections">maps from field names (String) to <see cref="FieldSelectorResult" />s
+        /// </param>
         public MapFieldSelector(IDictionary<string, FieldSelectorResult> fieldSelections)
-		{
-			this.fieldSelections = fieldSelections;
-		}
-		
-		/// <summary>Create a a MapFieldSelector</summary>
-		/// <param name="fields">fields to LOAD.  List of Strings.  All other fields are NO_LOAD.
-		/// </param>
-		public MapFieldSelector(IList<string> fields)
-		{
-			fieldSelections = new HashMap<string, FieldSelectorResult>(fields.Count * 5 / 3);
-			foreach(var field in fields)
-				fieldSelections[field] = FieldSelectorResult.LOAD;
-		}
-		
-		/// <summary>Create a a MapFieldSelector</summary>
-		/// <param name="fields">fields to LOAD.  All other fields are NO_LOAD.
-		/// </param>
-		public MapFieldSelector(params System.String[] fields)
+        {
+            this.fieldSelections = fieldSelections;
+        }
+        
+        /// <summary>Create a a MapFieldSelector</summary>
+        /// <param name="fields">fields to LOAD.  List of Strings.  All other fields are NO_LOAD.
+        /// </param>
+        public MapFieldSelector(IList<string> fields)
+        {
+            fieldSelections = new HashMap<string, FieldSelectorResult>(fields.Count * 5 / 3);
+            foreach(var field in fields)
+                fieldSelections[field] = FieldSelectorResult.LOAD;
+        }
+        
+        /// <summary>Create a a MapFieldSelector</summary>
+        /// <param name="fields">fields to LOAD.  All other fields are NO_LOAD.
+        /// </param>
+        public MapFieldSelector(params System.String[] fields)
             : this(fields.ToList()) // TODO: this is slow
-		{
-		}
-		
-		/// <summary>Load field according to its associated value in fieldSelections</summary>
-		/// <param name="field">a field name
-		/// </param>
-		/// <returns> the fieldSelections value that field maps to or NO_LOAD if none.
-		/// </returns>
-		public virtual FieldSelectorResult Accept(System.String field)
-		{
-		    FieldSelectorResult selection = fieldSelections[field];
+        {
+        }
+        
+        /// <summary>Load field according to its associated value in fieldSelections</summary>
+        /// <param name="field">a field name
+        /// </param>
+        /// <returns> the fieldSelections value that field maps to or NO_LOAD if none.
+        /// </returns>
+        public virtual FieldSelectorResult Accept(System.String field)
+        {
+            FieldSelectorResult selection = fieldSelections[field];
             return selection != FieldSelectorResult.INVALID ? selection : FieldSelectorResult.NO_LOAD; // TODO: See FieldSelectorResult
-		}
-	}
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/core/Document/NumberTools.cs
----------------------------------------------------------------------
diff --git a/src/core/Document/NumberTools.cs b/src/core/Document/NumberTools.cs
index f877120..9a467a7 100644
--- a/src/core/Document/NumberTools.cs
+++ b/src/core/Document/NumberTools.cs
@@ -21,145 +21,145 @@ using NumericUtils = Lucene.Net.Util.NumericUtils;
 
 namespace Lucene.Net.Documents
 {
-	
-	// do not remove this class in 3.0, it may be needed to decode old indexes!
-	
-	/// <summary> Provides support for converting longs to Strings, and back again. The strings
-	/// are structured so that lexicographic sorting order is preserved.
-	/// 
-	/// <p/>
-	/// That is, if l1 is less than l2 for any two longs l1 and l2, then
-	/// NumberTools.longToString(l1) is lexicographically less than
-	/// NumberTools.longToString(l2). (Similarly for "greater than" and "equals".)
-	/// 
-	/// <p/>
-	/// This class handles <b>all</b> long values (unlike
-	/// <see cref="Lucene.Net.Documents.DateField" />).
-	/// 
-	/// </summary>
-	/// <deprecated> For new indexes use <see cref="NumericUtils" /> instead, which
-	/// provides a sortable binary representation (prefix encoded) of numeric
-	/// values.
-	/// To index and efficiently query numeric values use <see cref="NumericField" />
-	/// and <see cref="NumericRangeQuery{T}" />.
-	/// This class is included for use with existing
-	/// indices and will be removed in a future release (possibly Lucene 4.0).
-	/// </deprecated>
+    
+    // do not remove this class in 3.0, it may be needed to decode old indexes!
+    
+    /// <summary> Provides support for converting longs to Strings, and back again. The strings
+    /// are structured so that lexicographic sorting order is preserved.
+    /// 
+    /// <p/>
+    /// That is, if l1 is less than l2 for any two longs l1 and l2, then
+    /// NumberTools.longToString(l1) is lexicographically less than
+    /// NumberTools.longToString(l2). (Similarly for "greater than" and "equals".)
+    /// 
+    /// <p/>
+    /// This class handles <b>all</b> long values (unlike
+    /// <see cref="Lucene.Net.Documents.DateField" />).
+    /// 
+    /// </summary>
+    /// <deprecated> For new indexes use <see cref="NumericUtils" /> instead, which
+    /// provides a sortable binary representation (prefix encoded) of numeric
+    /// values.
+    /// To index and efficiently query numeric values use <see cref="NumericField" />
+    /// and <see cref="NumericRangeQuery{T}" />.
+    /// This class is included for use with existing
+    /// indices and will be removed in a future release (possibly Lucene 4.0).
+    /// </deprecated>
     [Obsolete("For new indexes use NumericUtils instead, which provides a sortable binary representation (prefix encoded) of numeric values. To index and efficiently query numeric values use NumericField and NumericRangeQuery. This class is included for use with existing indices and will be removed in a future release (possibly Lucene 4.0).")]
-	public class NumberTools
-	{
-		
-		private const int RADIX = 36;
-		
-		private const char NEGATIVE_PREFIX = '-';
-		
-		// NB: NEGATIVE_PREFIX must be < POSITIVE_PREFIX
-		private const char POSITIVE_PREFIX = '0';
-		
-		//NB: this must be less than
-		/// <summary> Equivalent to longToString(Long.MIN_VALUE)</summary>
+    public class NumberTools
+    {
+        
+        private const int RADIX = 36;
+        
+        private const char NEGATIVE_PREFIX = '-';
+        
+        // NB: NEGATIVE_PREFIX must be < POSITIVE_PREFIX
+        private const char POSITIVE_PREFIX = '0';
+        
+        //NB: this must be less than
+        /// <summary> Equivalent to longToString(Long.MIN_VALUE)</summary>
 #if !PRE_LUCENE_NET_2_0_0_COMPATIBLE
-		public static readonly System.String MIN_STRING_VALUE = NEGATIVE_PREFIX + "0000000000000";
+        public static readonly System.String MIN_STRING_VALUE = NEGATIVE_PREFIX + "0000000000000";
 #else
         public static readonly System.String MIN_STRING_VALUE = NEGATIVE_PREFIX + "0000000000000000";
 #endif
-		
-		/// <summary> Equivalent to longToString(Long.MAX_VALUE)</summary>
+        
+        /// <summary> Equivalent to longToString(Long.MAX_VALUE)</summary>
 #if !PRE_LUCENE_NET_2_0_0_COMPATIBLE
-		public static readonly System.String MAX_STRING_VALUE = POSITIVE_PREFIX + "1y2p0ij32e8e7";
+        public static readonly System.String MAX_STRING_VALUE = POSITIVE_PREFIX + "1y2p0ij32e8e7";
 #else
         public static readonly System.String MAX_STRING_VALUE = POSITIVE_PREFIX + "7fffffffffffffff";
 #endif
-		
-		/// <summary> The length of (all) strings returned by <see cref="LongToString" /></summary>
-		public static readonly int STR_SIZE = MIN_STRING_VALUE.Length;
-		
-		/// <summary> Converts a long to a String suitable for indexing.</summary>
-		public static System.String LongToString(long l)
-		{
-			
-			if (l == System.Int64.MinValue)
-			{
-				// special case, because long is not symmetric around zero
-				return MIN_STRING_VALUE;
-			}
-			
-			System.Text.StringBuilder buf = new System.Text.StringBuilder(STR_SIZE);
-			
-			if (l < 0)
-			{
-				buf.Append(NEGATIVE_PREFIX);
-				l = System.Int64.MaxValue + l + 1;
-			}
-			else
-			{
-				buf.Append(POSITIVE_PREFIX);
-			}
+        
+        /// <summary> The length of (all) strings returned by <see cref="LongToString" /></summary>
+        public static readonly int STR_SIZE = MIN_STRING_VALUE.Length;
+        
+        /// <summary> Converts a long to a String suitable for indexing.</summary>
+        public static System.String LongToString(long l)
+        {
+            
+            if (l == System.Int64.MinValue)
+            {
+                // special case, because long is not symmetric around zero
+                return MIN_STRING_VALUE;
+            }
+            
+            System.Text.StringBuilder buf = new System.Text.StringBuilder(STR_SIZE);
+            
+            if (l < 0)
+            {
+                buf.Append(NEGATIVE_PREFIX);
+                l = System.Int64.MaxValue + l + 1;
+            }
+            else
+            {
+                buf.Append(POSITIVE_PREFIX);
+            }
 #if !PRE_LUCENE_NET_2_0_0_COMPATIBLE
             System.String num = ToString(l);
 #else
             System.String num = System.Convert.ToString(l, RADIX);
 #endif
-			
-			int padLen = STR_SIZE - num.Length - buf.Length;
-			while (padLen-- > 0)
-			{
-				buf.Append('0');
-			}
-			buf.Append(num);
-			
-			return buf.ToString();
-		}
-		
-		/// <summary> Converts a String that was returned by <see cref="LongToString" /> back to a
-		/// long.
-		/// 
-		/// </summary>
-		/// <throws>  IllegalArgumentException </throws>
-		/// <summary>             if the input is null
-		/// </summary>
-		/// <throws>  NumberFormatException </throws>
-		/// <summary>             if the input does not parse (it was not a String returned by
-		/// longToString()).
-		/// </summary>
-		public static long StringToLong(System.String str)
-		{
-			if (str == null)
-			{
-				throw new System.NullReferenceException("string cannot be null");
-			}
-			if (str.Length != STR_SIZE)
-			{
-				throw new System.FormatException("string is the wrong size");
-			}
-			
-			if (str.Equals(MIN_STRING_VALUE))
-			{
-				return System.Int64.MinValue;
-			}
-			
-			char prefix = str[0];
+            
+            int padLen = STR_SIZE - num.Length - buf.Length;
+            while (padLen-- > 0)
+            {
+                buf.Append('0');
+            }
+            buf.Append(num);
+            
+            return buf.ToString();
+        }
+        
+        /// <summary> Converts a String that was returned by <see cref="LongToString" /> back to a
+        /// long.
+        /// 
+        /// </summary>
+        /// <throws>  IllegalArgumentException </throws>
+        /// <summary>             if the input is null
+        /// </summary>
+        /// <throws>  NumberFormatException </throws>
+        /// <summary>             if the input does not parse (it was not a String returned by
+        /// longToString()).
+        /// </summary>
+        public static long StringToLong(System.String str)
+        {
+            if (str == null)
+            {
+                throw new System.NullReferenceException("string cannot be null");
+            }
+            if (str.Length != STR_SIZE)
+            {
+                throw new System.FormatException("string is the wrong size");
+            }
+            
+            if (str.Equals(MIN_STRING_VALUE))
+            {
+                return System.Int64.MinValue;
+            }
+            
+            char prefix = str[0];
 #if !PRE_LUCENE_NET_2_0_0_COMPATIBLE
-			long l = ToLong(str.Substring(1));
+            long l = ToLong(str.Substring(1));
 #else
             long l = System.Convert.ToInt64(str.Substring(1), RADIX);
 #endif
-			
-			if (prefix == POSITIVE_PREFIX)
-			{
-				// nop
-			}
-			else if (prefix == NEGATIVE_PREFIX)
-			{
-				l = l - System.Int64.MaxValue - 1;
-			}
-			else
-			{
-				throw new System.FormatException("string does not begin with the correct prefix");
-			}
-			
-			return l;
-		}
+            
+            if (prefix == POSITIVE_PREFIX)
+            {
+                // nop
+            }
+            else if (prefix == NEGATIVE_PREFIX)
+            {
+                l = l - System.Int64.MaxValue - 1;
+            }
+            else
+            {
+                throw new System.FormatException("string does not begin with the correct prefix");
+            }
+            
+            return l;
+        }
 
 #if !PRE_LUCENE_NET_2_0_0_COMPATIBLE
         #region BASE36 OPS 
@@ -217,5 +217,5 @@ namespace Lucene.Net.Documents
         }
         #endregion
 #endif
-	}
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/core/Document/NumericField.cs
----------------------------------------------------------------------
diff --git a/src/core/Document/NumericField.cs b/src/core/Document/NumericField.cs
index e77dee4..3358670 100644
--- a/src/core/Document/NumericField.cs
+++ b/src/core/Document/NumericField.cs
@@ -26,269 +26,269 @@ using SortField = Lucene.Net.Search.SortField;
 
 namespace Lucene.Net.Documents
 {
-	// javadocs
-	
-	/// <summary> <p/>This class provides a <see cref="Field" /> that enables indexing
-	/// of numeric values for efficient range filtering and
-	/// sorting.  Here's an example usage, adding an int value:
+    // javadocs
+    
+    /// <summary> <p/>This class provides a <see cref="Field" /> that enables indexing
+    /// of numeric values for efficient range filtering and
+    /// sorting.  Here's an example usage, adding an int value:
     /// <code>
-	/// document.add(new NumericField(name).setIntValue(value));
+    /// document.add(new NumericField(name).setIntValue(value));
     /// </code>
-	/// 
-	/// For optimal performance, re-use the
-	/// <c>NumericField</c> and <see cref="Document" /> instance for more than
-	/// one document:
-	/// 
+    /// 
+    /// For optimal performance, re-use the
+    /// <c>NumericField</c> and <see cref="Document" /> instance for more than
+    /// one document:
+    /// 
     /// <code>
-	/// NumericField field = new NumericField(name);
-	/// Document document = new Document();
-	/// document.add(field);
-	/// 
-	/// for(all documents) {
-	/// ...
-	/// field.setIntValue(value)
-	/// writer.addDocument(document);
-	/// ...
-	/// }
+    /// NumericField field = new NumericField(name);
+    /// Document document = new Document();
+    /// document.add(field);
+    /// 
+    /// for(all documents) {
+    /// ...
+    /// field.setIntValue(value)
+    /// writer.addDocument(document);
+    /// ...
+    /// }
     /// </code>
-	/// 
-	/// <p/>The .Net native types <c>int</c>, <c>long</c>,
-	/// <c>float</c> and <c>double</c> are
-	/// directly supported.  However, any value that can be
-	/// converted into these native types can also be indexed.
-	/// For example, date/time values represented by a
-	/// <see cref="System.DateTime" /> can be translated into a long
+    /// 
+    /// <p/>The .Net native types <c>int</c>, <c>long</c>,
+    /// <c>float</c> and <c>double</c> are
+    /// directly supported.  However, any value that can be
+    /// converted into these native types can also be indexed.
+    /// For example, date/time values represented by a
+    /// <see cref="System.DateTime" /> can be translated into a long
     /// value using the <c>java.util.Date.getTime</c> method.  If you
-	/// don't need millisecond precision, you can quantize the
-	/// value, either by dividing the result of
-	/// <c>java.util.Date.getTime</c> or using the separate getters
-	/// (for year, month, etc.) to construct an <c>int</c> or
-	/// <c>long</c> value.<p/>
-	/// 
-	/// <p/>To perform range querying or filtering against a
-	/// <c>NumericField</c>, use <see cref="NumericRangeQuery{T}" /> or <see cref="NumericRangeFilter{T}" />
-	///.  To sort according to a
-	/// <c>NumericField</c>, use the normal numeric sort types, eg
-	/// <see cref="SortField.INT" />  <c>NumericField</c> values
-	/// can also be loaded directly from <see cref="FieldCache" />.<p/>
-	/// 
-	/// <p/>By default, a <c>NumericField</c>'s value is not stored but
-	/// is indexed for range filtering and sorting.  You can use
-	/// the <see cref="NumericField(String,Field.Store,bool)" />
-	/// constructor if you need to change these defaults.<p/>
-	/// 
-	/// <p/>You may add the same field name as a <c>NumericField</c> to
-	/// the same document more than once.  Range querying and
-	/// filtering will be the logical OR of all values; so a range query
-	/// will hit all documents that have at least one value in
-	/// the range. However sort behavior is not defined.  If you need to sort,
-	/// you should separately index a single-valued <c>NumericField</c>.<p/>
-	/// 
-	/// <p/>A <c>NumericField</c> will consume somewhat more disk space
-	/// in the index than an ordinary single-valued field.
-	/// However, for a typical index that includes substantial
-	/// textual content per document, this increase will likely
-	/// be in the noise. <p/>
-	/// 
-	/// <p/>Within Lucene, each numeric value is indexed as a
-	/// <em>trie</em> structure, where each term is logically
-	/// assigned to larger and larger pre-defined brackets (which
-	/// are simply lower-precision representations of the value).
-	/// The step size between each successive bracket is called the
-	/// <c>precisionStep</c>, measured in bits.  Smaller
-	/// <c>precisionStep</c> values result in larger number
-	/// of brackets, which consumes more disk space in the index
-	/// but may result in faster range search performance.  The
-	/// default value, 4, was selected for a reasonable tradeoff
-	/// of disk space consumption versus performance.  You can
-	/// use the expert constructor <see cref="NumericField(String,int,Field.Store,bool)" />
-	/// if you'd
-	/// like to change the value.  Note that you must also
-	/// specify a congruent value when creating <see cref="NumericRangeQuery{T}" />
-	/// or <see cref="NumericRangeFilter{T}" />.
-	/// For low cardinality fields larger precision steps are good.
-	/// If the cardinality is &lt; 100, it is fair
-	/// to use <see cref="int.MaxValue" />, which produces one
-	/// term per value.
-	/// 
-	/// <p/>For more information on the internals of numeric trie
-	/// indexing, including the <a
-	/// href="../search/NumericRangeQuery.html#precisionStepDesc"><c>precisionStep</c></a>
-	/// configuration, see <see cref="NumericRangeQuery{T}" />. The format of
-	/// indexed values is described in <see cref="NumericUtils" />.
-	/// 
-	/// <p/>If you only need to sort by numeric value, and never
-	/// run range querying/filtering, you can index using a
+    /// don't need millisecond precision, you can quantize the
+    /// value, either by dividing the result of
+    /// <c>java.util.Date.getTime</c> or using the separate getters
+    /// (for year, month, etc.) to construct an <c>int</c> or
+    /// <c>long</c> value.<p/>
+    /// 
+    /// <p/>To perform range querying or filtering against a
+    /// <c>NumericField</c>, use <see cref="NumericRangeQuery{T}" /> or <see cref="NumericRangeFilter{T}" />
+    ///.  To sort according to a
+    /// <c>NumericField</c>, use the normal numeric sort types, eg
+    /// <see cref="SortField.INT" />  <c>NumericField</c> values
+    /// can also be loaded directly from <see cref="FieldCache" />.<p/>
+    /// 
+    /// <p/>By default, a <c>NumericField</c>'s value is not stored but
+    /// is indexed for range filtering and sorting.  You can use
+    /// the <see cref="NumericField(String,Field.Store,bool)" />
+    /// constructor if you need to change these defaults.<p/>
+    /// 
+    /// <p/>You may add the same field name as a <c>NumericField</c> to
+    /// the same document more than once.  Range querying and
+    /// filtering will be the logical OR of all values; so a range query
+    /// will hit all documents that have at least one value in
+    /// the range. However sort behavior is not defined.  If you need to sort,
+    /// you should separately index a single-valued <c>NumericField</c>.<p/>
+    /// 
+    /// <p/>A <c>NumericField</c> will consume somewhat more disk space
+    /// in the index than an ordinary single-valued field.
+    /// However, for a typical index that includes substantial
+    /// textual content per document, this increase will likely
+    /// be in the noise. <p/>
+    /// 
+    /// <p/>Within Lucene, each numeric value is indexed as a
+    /// <em>trie</em> structure, where each term is logically
+    /// assigned to larger and larger pre-defined brackets (which
+    /// are simply lower-precision representations of the value).
+    /// The step size between each successive bracket is called the
+    /// <c>precisionStep</c>, measured in bits.  Smaller
+    /// <c>precisionStep</c> values result in larger number
+    /// of brackets, which consumes more disk space in the index
+    /// but may result in faster range search performance.  The
+    /// default value, 4, was selected for a reasonable tradeoff
+    /// of disk space consumption versus performance.  You can
+    /// use the expert constructor <see cref="NumericField(String,int,Field.Store,bool)" />
+    /// if you'd
+    /// like to change the value.  Note that you must also
+    /// specify a congruent value when creating <see cref="NumericRangeQuery{T}" />
+    /// or <see cref="NumericRangeFilter{T}" />.
+    /// For low cardinality fields larger precision steps are good.
+    /// If the cardinality is &lt; 100, it is fair
+    /// to use <see cref="int.MaxValue" />, which produces one
+    /// term per value.
+    /// 
+    /// <p/>For more information on the internals of numeric trie
+    /// indexing, including the <a
+    /// href="../search/NumericRangeQuery.html#precisionStepDesc"><c>precisionStep</c></a>
+    /// configuration, see <see cref="NumericRangeQuery{T}" />. The format of
+    /// indexed values is described in <see cref="NumericUtils" />.
+    /// 
+    /// <p/>If you only need to sort by numeric value, and never
+    /// run range querying/filtering, you can index using a
     /// <c>precisionStep</c> of <see cref="int.MaxValue" />.
-	/// This will minimize disk space consumed. <p/>
-	/// 
-	/// <p/>More advanced users can instead use <see cref="NumericTokenStream" />
-	/// directly, when indexing numbers. This
-	/// class is a wrapper around this token stream type for
-	/// easier, more intuitive usage.<p/>
-	/// 
-	/// <p/><b>NOTE:</b> This class is only used during
-	/// indexing. When retrieving the stored field value from a
-	/// <see cref="Document" /> instance after search, you will get a
-	/// conventional <see cref="IFieldable" /> instance where the numeric
-	/// values are returned as <see cref="String" />s (according to
-	/// <c>toString(value)</c> of the used data type).
-	/// 
-	/// <p/><font color="red"><b>NOTE:</b> This API is
-	/// experimental and might change in incompatible ways in the
-	/// next release.</font>
-	/// 
-	/// </summary>
-	/// <since> 2.9
-	/// </since>
-	[Serializable]
-	public sealed class NumericField:AbstractField
-	{
-		
-		new private readonly NumericTokenStream tokenStream;
-		
-		/// <summary> Creates a field for numeric values using the default <c>precisionStep</c>
-		/// <see cref="NumericUtils.PRECISION_STEP_DEFAULT" /> (4). The instance is not yet initialized with
-		/// a numeric value, before indexing a document containing this field,
-		/// set a value using the various set<em>???</em>Value() methods.
-		/// This constructor creates an indexed, but not stored field.
-		/// </summary>
-		/// <param name="name">the field name
-		/// </param>
-		public NumericField(System.String name):this(name, NumericUtils.PRECISION_STEP_DEFAULT, Field.Store.NO, true)
-		{
-		}
-		
-		/// <summary> Creates a field for numeric values using the default <c>precisionStep</c>
-		/// <see cref="NumericUtils.PRECISION_STEP_DEFAULT" /> (4). The instance is not yet initialized with
-		/// a numeric value, before indexing a document containing this field,
-		/// set a value using the various set<em>???</em>Value() methods.
-		/// </summary>
-		/// <param name="name">the field name
-		/// </param>
-		/// <param name="store">if the field should be stored in plain text form
-		/// (according to <c>toString(value)</c> of the used data type)
-		/// </param>
-		/// <param name="index">if the field should be indexed using <see cref="NumericTokenStream" />
-		/// </param>
-		public NumericField(System.String name, Field.Store store, bool index):this(name, NumericUtils.PRECISION_STEP_DEFAULT, store, index)
-		{
-		}
-		
-		/// <summary> Creates a field for numeric values with the specified
-		/// <c>precisionStep</c>. The instance is not yet initialized with
-		/// a numeric value, before indexing a document containing this field,
-		/// set a value using the various set<em>???</em>Value() methods.
-		/// This constructor creates an indexed, but not stored field.
-		/// </summary>
-		/// <param name="name">the field name
-		/// </param>
-		/// <param name="precisionStep">the used <a href="../search/NumericRangeQuery.html#precisionStepDesc">precision step</a>
-		/// </param>
-		public NumericField(System.String name, int precisionStep):this(name, precisionStep, Field.Store.NO, true)
-		{
-		}
-		
-		/// <summary> Creates a field for numeric values with the specified
-		/// <c>precisionStep</c>. The instance is not yet initialized with
-		/// a numeric value, before indexing a document containing this field,
-		/// set a value using the various set<em>???</em>Value() methods.
-		/// </summary>
-		/// <param name="name">the field name
-		/// </param>
-		/// <param name="precisionStep">the used <a href="../search/NumericRangeQuery.html#precisionStepDesc">precision step</a>
-		/// </param>
-		/// <param name="store">if the field should be stored in plain text form
-		/// (according to <c>toString(value)</c> of the used data type)
-		/// </param>
-		/// <param name="index">if the field should be indexed using <see cref="NumericTokenStream" />
-		/// </param>
-		public NumericField(System.String name, int precisionStep, Field.Store store, bool index):base(name, store, index?Field.Index.ANALYZED_NO_NORMS:Field.Index.NO, Field.TermVector.NO)
-		{
-			OmitTermFreqAndPositions = true;
-			tokenStream = new NumericTokenStream(precisionStep);
-		}
+    /// This will minimize disk space consumed. <p/>
+    /// 
+    /// <p/>More advanced users can instead use <see cref="NumericTokenStream" />
+    /// directly, when indexing numbers. This
+    /// class is a wrapper around this token stream type for
+    /// easier, more intuitive usage.<p/>
+    /// 
+    /// <p/><b>NOTE:</b> This class is only used during
+    /// indexing. When retrieving the stored field value from a
+    /// <see cref="Document" /> instance after search, you will get a
+    /// conventional <see cref="IFieldable" /> instance where the numeric
+    /// values are returned as <see cref="String" />s (according to
+    /// <c>toString(value)</c> of the used data type).
+    /// 
+    /// <p/><font color="red"><b>NOTE:</b> This API is
+    /// experimental and might change in incompatible ways in the
+    /// next release.</font>
+    /// 
+    /// </summary>
+    /// <since> 2.9
+    /// </since>
+    [Serializable]
+    public sealed class NumericField:AbstractField
+    {
+        
+        new private readonly NumericTokenStream tokenStream;
+        
+        /// <summary> Creates a field for numeric values using the default <c>precisionStep</c>
+        /// <see cref="NumericUtils.PRECISION_STEP_DEFAULT" /> (4). The instance is not yet initialized with
+        /// a numeric value, before indexing a document containing this field,
+        /// set a value using the various set<em>???</em>Value() methods.
+        /// This constructor creates an indexed, but not stored field.
+        /// </summary>
+        /// <param name="name">the field name
+        /// </param>
+        public NumericField(System.String name):this(name, NumericUtils.PRECISION_STEP_DEFAULT, Field.Store.NO, true)
+        {
+        }
+        
+        /// <summary> Creates a field for numeric values using the default <c>precisionStep</c>
+        /// <see cref="NumericUtils.PRECISION_STEP_DEFAULT" /> (4). The instance is not yet initialized with
+        /// a numeric value, before indexing a document containing this field,
+        /// set a value using the various set<em>???</em>Value() methods.
+        /// </summary>
+        /// <param name="name">the field name
+        /// </param>
+        /// <param name="store">if the field should be stored in plain text form
+        /// (according to <c>toString(value)</c> of the used data type)
+        /// </param>
+        /// <param name="index">if the field should be indexed using <see cref="NumericTokenStream" />
+        /// </param>
+        public NumericField(System.String name, Field.Store store, bool index):this(name, NumericUtils.PRECISION_STEP_DEFAULT, store, index)
+        {
+        }
+        
+        /// <summary> Creates a field for numeric values with the specified
+        /// <c>precisionStep</c>. The instance is not yet initialized with
+        /// a numeric value, before indexing a document containing this field,
+        /// set a value using the various set<em>???</em>Value() methods.
+        /// This constructor creates an indexed, but not stored field.
+        /// </summary>
+        /// <param name="name">the field name
+        /// </param>
+        /// <param name="precisionStep">the used <a href="../search/NumericRangeQuery.html#precisionStepDesc">precision step</a>
+        /// </param>
+        public NumericField(System.String name, int precisionStep):this(name, precisionStep, Field.Store.NO, true)
+        {
+        }
+        
+        /// <summary> Creates a field for numeric values with the specified
+        /// <c>precisionStep</c>. The instance is not yet initialized with
+        /// a numeric value, before indexing a document containing this field,
+        /// set a value using the various set<em>???</em>Value() methods.
+        /// </summary>
+        /// <param name="name">the field name
+        /// </param>
+        /// <param name="precisionStep">the used <a href="../search/NumericRangeQuery.html#precisionStepDesc">precision step</a>
+        /// </param>
+        /// <param name="store">if the field should be stored in plain text form
+        /// (according to <c>toString(value)</c> of the used data type)
+        /// </param>
+        /// <param name="index">if the field should be indexed using <see cref="NumericTokenStream" />
+        /// </param>
+        public NumericField(System.String name, int precisionStep, Field.Store store, bool index):base(name, store, index?Field.Index.ANALYZED_NO_NORMS:Field.Index.NO, Field.TermVector.NO)
+        {
+            OmitTermFreqAndPositions = true;
+            tokenStream = new NumericTokenStream(precisionStep);
+        }
 
-	    /// <summary>Returns a <see cref="NumericTokenStream" /> for indexing the numeric value. </summary>
-	    public override TokenStream TokenStreamValue
-	    {
-	        get { return IsIndexed ? tokenStream : null; }
-	    }
+        /// <summary>Returns a <see cref="NumericTokenStream" /> for indexing the numeric value. </summary>
+        public override TokenStream TokenStreamValue
+        {
+            get { return IsIndexed ? tokenStream : null; }
+        }
 
-	    /// <summary>Returns always <c>null</c> for numeric fields </summary>
-		public override byte[] GetBinaryValue(byte[] result)
-		{
-			return null;
-		}
+        /// <summary>Returns always <c>null</c> for numeric fields </summary>
+        public override byte[] GetBinaryValue(byte[] result)
+        {
+            return null;
+        }
 
-	    /// <summary>Returns always <c>null</c> for numeric fields </summary>
-	    public override TextReader ReaderValue
-	    {
-	        get { return null; }
-	    }
+        /// <summary>Returns always <c>null</c> for numeric fields </summary>
+        public override TextReader ReaderValue
+        {
+            get { return null; }
+        }
 
-	    /// <summary>Returns the numeric value as a string (how it is stored, when <see cref="Field.Store.YES" /> is chosen). </summary>
-	    public override string StringValue
-	    {
-	        get { return (fieldsData == null) ? null : fieldsData.ToString(); }
-	    }
+        /// <summary>Returns the numeric value as a string (how it is stored, when <see cref="Field.Store.YES" /> is chosen). </summary>
+        public override string StringValue
+        {
+            get { return (fieldsData == null) ? null : fieldsData.ToString(); }
+        }
 
-	    /// <summary>Returns the current numeric value as a subclass of <see cref="Number" />, <c>null</c> if not yet initialized. </summary>
-	    public ValueType NumericValue
-	    {
-	        get { return (System.ValueType) fieldsData; }
-	    }
+        /// <summary>Returns the current numeric value as a subclass of <see cref="Number" />, <c>null</c> if not yet initialized. </summary>
+        public ValueType NumericValue
+        {
+            get { return (System.ValueType) fieldsData; }
+        }
 
-	    /// <summary> Initializes the field with the supplied <c>long</c> value.</summary>
-		/// <param name="value_Renamed">the numeric value
-		/// </param>
-		/// <returns> this instance, because of this you can use it the following way:
-		/// <c>document.add(new NumericField(name, precisionStep).SetLongValue(value))</c>
-		/// </returns>
-		public NumericField SetLongValue(long value_Renamed)
-		{
-			tokenStream.SetLongValue(value_Renamed);
-			fieldsData = value_Renamed;
-			return this;
-		}
-		
-		/// <summary> Initializes the field with the supplied <c>int</c> value.</summary>
-		/// <param name="value_Renamed">the numeric value
-		/// </param>
-		/// <returns> this instance, because of this you can use it the following way:
-		/// <c>document.add(new NumericField(name, precisionStep).setIntValue(value))</c>
-		/// </returns>
-		public NumericField SetIntValue(int value_Renamed)
-		{
-			tokenStream.SetIntValue(value_Renamed);
-			fieldsData = value_Renamed;
-			return this;
-		}
-		
-		/// <summary> Initializes the field with the supplied <c>double</c> value.</summary>
-		/// <param name="value_Renamed">the numeric value
-		/// </param>
-		/// <returns> this instance, because of this you can use it the following way:
-		/// <c>document.add(new NumericField(name, precisionStep).setDoubleValue(value))</c>
-		/// </returns>
-		public NumericField SetDoubleValue(double value_Renamed)
-		{
-			tokenStream.SetDoubleValue(value_Renamed);
-			fieldsData = value_Renamed;
-			return this;
-		}
-		
-		/// <summary> Initializes the field with the supplied <c>float</c> value.</summary>
-		/// <param name="value_Renamed">the numeric value
-		/// </param>
-		/// <returns> this instance, because of this you can use it the following way:
-		/// <c>document.add(new NumericField(name, precisionStep).setFloatValue(value))</c>
-		/// </returns>
-		public NumericField SetFloatValue(float value_Renamed)
-		{
-			tokenStream.SetFloatValue(value_Renamed);
-			fieldsData = value_Renamed;
-			return this;
-		}
-	}
+        /// <summary> Initializes the field with the supplied <c>long</c> value.</summary>
+        /// <param name="value_Renamed">the numeric value
+        /// </param>
+        /// <returns> this instance, because of this you can use it the following way:
+        /// <c>document.add(new NumericField(name, precisionStep).SetLongValue(value))</c>
+        /// </returns>
+        public NumericField SetLongValue(long value_Renamed)
+        {
+            tokenStream.SetLongValue(value_Renamed);
+            fieldsData = value_Renamed;
+            return this;
+        }
+        
+        /// <summary> Initializes the field with the supplied <c>int</c> value.</summary>
+        /// <param name="value_Renamed">the numeric value
+        /// </param>
+        /// <returns> this instance, because of this you can use it the following way:
+        /// <c>document.add(new NumericField(name, precisionStep).setIntValue(value))</c>
+        /// </returns>
+        public NumericField SetIntValue(int value_Renamed)
+        {
+            tokenStream.SetIntValue(value_Renamed);
+            fieldsData = value_Renamed;
+            return this;
+        }
+        
+        /// <summary> Initializes the field with the supplied <c>double</c> value.</summary>
+        /// <param name="value_Renamed">the numeric value
+        /// </param>
+        /// <returns> this instance, because of this you can use it the following way:
+        /// <c>document.add(new NumericField(name, precisionStep).setDoubleValue(value))</c>
+        /// </returns>
+        public NumericField SetDoubleValue(double value_Renamed)
+        {
+            tokenStream.SetDoubleValue(value_Renamed);
+            fieldsData = value_Renamed;
+            return this;
+        }
+        
+        /// <summary> Initializes the field with the supplied <c>float</c> value.</summary>
+        /// <param name="value_Renamed">the numeric value
+        /// </param>
+        /// <returns> this instance, because of this you can use it the following way:
+        /// <c>document.add(new NumericField(name, precisionStep).setFloatValue(value))</c>
+        /// </returns>
+        public NumericField SetFloatValue(float value_Renamed)
+        {
+            tokenStream.SetFloatValue(value_Renamed);
+            fieldsData = value_Renamed;
+            return this;
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/core/Document/SetBasedFieldSelector.cs
----------------------------------------------------------------------
diff --git a/src/core/Document/SetBasedFieldSelector.cs b/src/core/Document/SetBasedFieldSelector.cs
index 14e3e02..f7c2055 100644
--- a/src/core/Document/SetBasedFieldSelector.cs
+++ b/src/core/Document/SetBasedFieldSelector.cs
@@ -20,50 +20,50 @@ using System.Collections.Generic;
 
 namespace Lucene.Net.Documents
 {
-	/// <summary> Declare what fields to load normally and what fields to load lazily
-	/// 
-	/// 
-	/// </summary>
-	[Serializable]
-	public class SetBasedFieldSelector : FieldSelector
-	{
-		private ISet<string> fieldsToLoad;
-		private ISet<string> lazyFieldsToLoad;
-		
-		/// <summary> Pass in the Set of <see cref="Field" /> names to load and the Set of <see cref="Field" /> names to load lazily.  If both are null, the
-		/// Document will not have any <see cref="Field" /> on it.  
-		/// </summary>
-		/// <param name="fieldsToLoad">A Set of <see cref="String" /> field names to load.  May be empty, but not null
-		/// </param>
-		/// <param name="lazyFieldsToLoad">A Set of <see cref="String" /> field names to load lazily.  May be empty, but not null  
-		/// </param>
-		public SetBasedFieldSelector(ISet<string> fieldsToLoad, ISet<string> lazyFieldsToLoad)
-		{
-			this.fieldsToLoad = fieldsToLoad;
-			this.lazyFieldsToLoad = lazyFieldsToLoad;
-		}
+    /// <summary> Declare what fields to load normally and what fields to load lazily
+    /// 
+    /// 
+    /// </summary>
+    [Serializable]
+    public class SetBasedFieldSelector : FieldSelector
+    {
+        private ISet<string> fieldsToLoad;
+        private ISet<string> lazyFieldsToLoad;
+        
+        /// <summary> Pass in the Set of <see cref="Field" /> names to load and the Set of <see cref="Field" /> names to load lazily.  If both are null, the
+        /// Document will not have any <see cref="Field" /> on it.  
+        /// </summary>
+        /// <param name="fieldsToLoad">A Set of <see cref="String" /> field names to load.  May be empty, but not null
+        /// </param>
+        /// <param name="lazyFieldsToLoad">A Set of <see cref="String" /> field names to load lazily.  May be empty, but not null  
+        /// </param>
+        public SetBasedFieldSelector(ISet<string> fieldsToLoad, ISet<string> lazyFieldsToLoad)
+        {
+            this.fieldsToLoad = fieldsToLoad;
+            this.lazyFieldsToLoad = lazyFieldsToLoad;
+        }
 
         /// <summary> Indicate whether to load the field with the given name or not. If the <see cref="AbstractField.Name()" /> is not in either of the 
-		/// initializing Sets, then <see cref="Lucene.Net.Documents.FieldSelectorResult.NO_LOAD" /> is returned.  If a Field name
-		/// is in both <c>fieldsToLoad</c> and <c>lazyFieldsToLoad</c>, lazy has precedence.
-		/// 
-		/// </summary>
-		/// <param name="fieldName">The <see cref="Field" /> name to check
-		/// </param>
-		/// <returns> The <see cref="FieldSelectorResult" />
-		/// </returns>
-		public virtual FieldSelectorResult Accept(System.String fieldName)
-		{
-			FieldSelectorResult result = FieldSelectorResult.NO_LOAD;
-			if (fieldsToLoad.Contains(fieldName) == true)
-			{
-				result = FieldSelectorResult.LOAD;
-			}
-			if (lazyFieldsToLoad.Contains(fieldName) == true)
-			{
-				result = FieldSelectorResult.LAZY_LOAD;
-			}
-			return result;
-		}
-	}
+        /// initializing Sets, then <see cref="Lucene.Net.Documents.FieldSelectorResult.NO_LOAD" /> is returned.  If a Field name
+        /// is in both <c>fieldsToLoad</c> and <c>lazyFieldsToLoad</c>, lazy has precedence.
+        /// 
+        /// </summary>
+        /// <param name="fieldName">The <see cref="Field" /> name to check
+        /// </param>
+        /// <returns> The <see cref="FieldSelectorResult" />
+        /// </returns>
+        public virtual FieldSelectorResult Accept(System.String fieldName)
+        {
+            FieldSelectorResult result = FieldSelectorResult.NO_LOAD;
+            if (fieldsToLoad.Contains(fieldName) == true)
+            {
+                result = FieldSelectorResult.LOAD;
+            }
+            if (lazyFieldsToLoad.Contains(fieldName) == true)
+            {
+                result = FieldSelectorResult.LAZY_LOAD;
+            }
+            return result;
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/core/Index/AllTermDocs.cs
----------------------------------------------------------------------
diff --git a/src/core/Index/AllTermDocs.cs b/src/core/Index/AllTermDocs.cs
index da5f16d..a3e51ab 100644
--- a/src/core/Index/AllTermDocs.cs
+++ b/src/core/Index/AllTermDocs.cs
@@ -21,16 +21,16 @@ namespace Lucene.Net.Index
 {
 
     class AllTermDocs : AbstractAllTermDocs
-	{
-		protected internal BitVector deletedDocs;
-				
-		protected internal AllTermDocs(SegmentReader parent) : base(parent.MaxDoc)
-		{
-			lock (parent)
-			{
-				this.deletedDocs = parent.deletedDocs;
-			}
-		}
+    {
+        protected internal BitVector deletedDocs;
+                
+        protected internal AllTermDocs(SegmentReader parent) : base(parent.MaxDoc)
+        {
+            lock (parent)
+            {
+                this.deletedDocs = parent.deletedDocs;
+            }
+        }
 
         protected override void Dispose(bool disposing)
         {
@@ -41,5 +41,5 @@ namespace Lucene.Net.Index
         {
             return deletedDocs != null && deletedDocs.Get(doc);
         }
-	}
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/core/Index/BufferedDeletes.cs
----------------------------------------------------------------------
diff --git a/src/core/Index/BufferedDeletes.cs b/src/core/Index/BufferedDeletes.cs
index 52ef1df..5b10ce7 100644
--- a/src/core/Index/BufferedDeletes.cs
+++ b/src/core/Index/BufferedDeletes.cs
@@ -21,22 +21,22 @@ using Lucene.Net.Support;
 
 namespace Lucene.Net.Index
 {
-	
-	/// <summary>Holds buffered deletes, by docID, term or query.  We
-	/// hold two instances of this class: one for the deletes
-	/// prior to the last flush, the other for deletes after
-	/// the last flush.  This is so if we need to abort
-	/// (discard all buffered docs) we can also discard the
-	/// buffered deletes yet keep the deletes done during
-	/// previously flushed segments. 
-	/// </summary>
-	class BufferedDeletes
-	{
-		internal int numTerms;
+    
+    /// <summary>Holds buffered deletes, by docID, term or query.  We
+    /// hold two instances of this class: one for the deletes
+    /// prior to the last flush, the other for deletes after
+    /// the last flush.  This is so if we need to abort
+    /// (discard all buffered docs) we can also discard the
+    /// buffered deletes yet keep the deletes done during
+    /// previously flushed segments. 
+    /// </summary>
+    class BufferedDeletes
+    {
+        internal int numTerms;
         internal IDictionary<Term,Num> terms = null;
-		internal IDictionary<Query, int> queries = new HashMap<Query, int>();
-		internal List<int> docIDs = new List<int>();
-		internal long bytesUsed;
+        internal IDictionary<Query, int> queries = new HashMap<Query, int>();
+        internal List<int> docIDs = new List<int>();
+        internal long bytesUsed;
         internal  bool doTermSort;
 
         public BufferedDeletes(bool doTermSort)
@@ -53,91 +53,91 @@ namespace Lucene.Net.Index
             }
         }
                 
-		
-		// Number of documents a delete term applies to.
-		internal sealed class Num
-		{
-			internal int num;
-			
-			internal Num(int num)
-			{
-				this.num = num;
-			}
-			
-			internal int GetNum()
-			{
-				return num;
-			}
-			
-			internal void  SetNum(int num)
-			{
-				// Only record the new number if it's greater than the
-				// current one.  This is important because if multiple
-				// threads are replacing the same doc at nearly the
-				// same time, it's possible that one thread that got a
-				// higher docID is scheduled before the other
-				// threads.
-				if (num > this.num)
-					this.num = num;
-			}
-		}
-		
-		internal virtual int Size()
-		{
-			// We use numTerms not terms.size() intentionally, so
-			// that deletes by the same term multiple times "count",
-			// ie if you ask to flush every 1000 deletes then even
-			// dup'd terms are counted towards that 1000
-			return numTerms + queries.Count + docIDs.Count;
-		}
-		
-		internal virtual void  Update(BufferedDeletes @in)
-		{
-			numTerms += @in.numTerms;
-			bytesUsed += @in.bytesUsed;
-		    foreach (KeyValuePair<Term, Num> term in @in.terms)
+        
+        // Number of documents a delete term applies to.
+        internal sealed class Num
+        {
+            internal int num;
+            
+            internal Num(int num)
+            {
+                this.num = num;
+            }
+            
+            internal int GetNum()
+            {
+                return num;
+            }
+            
+            internal void  SetNum(int num)
+            {
+                // Only record the new number if it's greater than the
+                // current one.  This is important because if multiple
+                // threads are replacing the same doc at nearly the
+                // same time, it's possible that one thread that got a
+                // higher docID is scheduled before the other
+                // threads.
+                if (num > this.num)
+                    this.num = num;
+            }
+        }
+        
+        internal virtual int Size()
+        {
+            // We use numTerms not terms.size() intentionally, so
+            // that deletes by the same term multiple times "count",
+            // ie if you ask to flush every 1000 deletes then even
+            // dup'd terms are counted towards that 1000
+            return numTerms + queries.Count + docIDs.Count;
+        }
+        
+        internal virtual void  Update(BufferedDeletes @in)
+        {
+            numTerms += @in.numTerms;
+            bytesUsed += @in.bytesUsed;
+            foreach (KeyValuePair<Term, Num> term in @in.terms)
             {
                 terms[term.Key] = term.Value;
-		    }
+            }
             foreach (KeyValuePair<Query, int> term in @in.queries)
             {
                 queries[term.Key] = term.Value;
             }
 
-			docIDs.AddRange(@in.docIDs);
-			@in.Clear();
-		}
-		
-		internal virtual void  Clear()
-		{
-			terms.Clear();
-			queries.Clear();
-			docIDs.Clear();
-			numTerms = 0;
-			bytesUsed = 0;
-		}
-		
-		internal virtual void  AddBytesUsed(long b)
-		{
-			bytesUsed += b;
-		}
-		
-		internal virtual bool Any()
-		{
-			return terms.Count > 0 || docIDs.Count > 0 || queries.Count > 0;
-		}
-		
-		// Remaps all buffered deletes based on a completed
-		// merge
-		internal virtual void  Remap(MergeDocIDRemapper mapper, SegmentInfos infos, int[][] docMaps, int[] delCounts, MergePolicy.OneMerge merge, int mergeDocCount)
-		{
-			lock (this)
-			{
-				IDictionary<Term, Num> newDeleteTerms;
-				
-				// Remap delete-by-term
-				if (terms.Count > 0)
-				{
+            docIDs.AddRange(@in.docIDs);
+            @in.Clear();
+        }
+        
+        internal virtual void  Clear()
+        {
+            terms.Clear();
+            queries.Clear();
+            docIDs.Clear();
+            numTerms = 0;
+            bytesUsed = 0;
+        }
+        
+        internal virtual void  AddBytesUsed(long b)
+        {
+            bytesUsed += b;
+        }
+        
+        internal virtual bool Any()
+        {
+            return terms.Count > 0 || docIDs.Count > 0 || queries.Count > 0;
+        }
+        
+        // Remaps all buffered deletes based on a completed
+        // merge
+        internal virtual void  Remap(MergeDocIDRemapper mapper, SegmentInfos infos, int[][] docMaps, int[] delCounts, MergePolicy.OneMerge merge, int mergeDocCount)
+        {
+            lock (this)
+            {
+                IDictionary<Term, Num> newDeleteTerms;
+                
+                // Remap delete-by-term
+                if (terms.Count > 0)
+                {
                     if (doTermSort)
                     {
                         newDeleteTerms = new SortedDictionary<Term, Num>();
@@ -146,51 +146,51 @@ namespace Lucene.Net.Index
                     {
                         newDeleteTerms = new HashMap<Term, Num>();
                     }
-					foreach(var entry in terms)
-					{
-						Num num = entry.Value;
-						newDeleteTerms[entry.Key] = new Num(mapper.Remap(num.GetNum()));
-					}
-				}
-				else
-					newDeleteTerms = null;
-				
-				// Remap delete-by-docID
-				List<int> newDeleteDocIDs;
-				
-				if (docIDs.Count > 0)
-				{
-					newDeleteDocIDs = new List<int>(docIDs.Count);
-					foreach(int num in docIDs)
-					{
-						newDeleteDocIDs.Add(mapper.Remap(num));
-					}
-				}
-				else
-					newDeleteDocIDs = null;
-				
-				// Remap delete-by-query
-				HashMap<Query, int> newDeleteQueries;
-				
-				if (queries.Count > 0)
-				{
+                    foreach(var entry in terms)
+                    {
+                        Num num = entry.Value;
+                        newDeleteTerms[entry.Key] = new Num(mapper.Remap(num.GetNum()));
+                    }
+                }
+                else
+                    newDeleteTerms = null;
+                
+                // Remap delete-by-docID
+                List<int> newDeleteDocIDs;
+                
+                if (docIDs.Count > 0)
+                {
+                    newDeleteDocIDs = new List<int>(docIDs.Count);
+                    foreach(int num in docIDs)
+                    {
+                        newDeleteDocIDs.Add(mapper.Remap(num));
+                    }
+                }
+                else
+                    newDeleteDocIDs = null;
+                
+                // Remap delete-by-query
+                HashMap<Query, int> newDeleteQueries;
+                
+                if (queries.Count > 0)
+                {
                     newDeleteQueries = new HashMap<Query, int>(queries.Count);
-					foreach(var entry in queries)
-					{
-						int num = entry.Value;
-						newDeleteQueries[entry.Key] = mapper.Remap(num);
-					}
-				}
-				else
-					newDeleteQueries = null;
-				
-				if (newDeleteTerms != null)
-					terms = newDeleteTerms;
-				if (newDeleteDocIDs != null)
-					docIDs = newDeleteDocIDs;
-				if (newDeleteQueries != null)
-					queries = newDeleteQueries;
-			}
-		}
-	}
+                    foreach(var entry in queries)
+                    {
+                        int num = entry.Value;
+                        newDeleteQueries[entry.Key] = mapper.Remap(num);
+                    }
+                }
+                else
+                    newDeleteQueries = null;
+                
+                if (newDeleteTerms != null)
+                    terms = newDeleteTerms;
+                if (newDeleteDocIDs != null)
+                    docIDs = newDeleteDocIDs;
+                if (newDeleteQueries != null)
+                    queries = newDeleteQueries;
+            }
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/core/Index/ByteBlockPool.cs
----------------------------------------------------------------------
diff --git a/src/core/Index/ByteBlockPool.cs b/src/core/Index/ByteBlockPool.cs
index 041c756..50afde0 100644
--- a/src/core/Index/ByteBlockPool.cs
+++ b/src/core/Index/ByteBlockPool.cs
@@ -38,135 +38,135 @@ using Lucene.Net.Support;
 
 namespace Lucene.Net.Index
 {
-	
-	sealed public class ByteBlockPool
-	{
-		private void  InitBlock()
-		{
-			byteUpto = DocumentsWriter.BYTE_BLOCK_SIZE;
-		}
-		
-		public /*internal*/ abstract class Allocator
-		{
-			public /*internal*/ abstract void  RecycleByteBlocks(byte[][] blocks, int start, int end);
+    
+    sealed public class ByteBlockPool
+    {
+        private void  InitBlock()
+        {
+            byteUpto = DocumentsWriter.BYTE_BLOCK_SIZE;
+        }
+        
+        public /*internal*/ abstract class Allocator
+        {
+            public /*internal*/ abstract void  RecycleByteBlocks(byte[][] blocks, int start, int end);
             public /*internal*/ abstract void RecycleByteBlocks(IList<byte[]> blocks);
-			public /*internal*/ abstract byte[] GetByteBlock(bool trackAllocations);
-		}
-		
-		public byte[][] buffers = new byte[10][];
-		
-		internal int bufferUpto = - 1; // Which buffer we are upto
-		public int byteUpto; // Where we are in head buffer
-		
-		public byte[] buffer; // Current head buffer
-		public int byteOffset = - DocumentsWriter.BYTE_BLOCK_SIZE; // Current head offset
-		
-		private readonly bool trackAllocations;
-		private readonly Allocator allocator;
-		
-		public ByteBlockPool(Allocator allocator, bool trackAllocations)
-		{
-			InitBlock();
-			this.allocator = allocator;
-			this.trackAllocations = trackAllocations;
-		}
-		
-		public void  Reset()
-		{
-			if (bufferUpto != - 1)
-			{
-				// We allocated at least one buffer
-				
-				for (int i = 0; i < bufferUpto; i++)
-				// Fully zero fill buffers that we fully used
-					System.Array.Clear(buffers[i], 0, buffers[i].Length);
-				
-				// Partial zero fill the final buffer
-				System.Array.Clear(buffers[bufferUpto], 0, byteUpto);
-				
-				if (bufferUpto > 0)
-				// Recycle all but the first buffer
-					allocator.RecycleByteBlocks(buffers, 1, 1 + bufferUpto);
-				
-				// Re-use the first buffer
-				bufferUpto = 0;
-				byteUpto = 0;
-				byteOffset = 0;
-				buffer = buffers[0];
-			}
-		}
-		
-		public void  NextBuffer()
-		{
-			if (1 + bufferUpto == buffers.Length)
-			{
-				var newBuffers = new byte[(int) (buffers.Length * 1.5)][];
-				Array.Copy(buffers, 0, newBuffers, 0, buffers.Length);
-				buffers = newBuffers;
-			}
-			buffer = buffers[1 + bufferUpto] = allocator.GetByteBlock(trackAllocations);
-			bufferUpto++;
-			
-			byteUpto = 0;
-			byteOffset += DocumentsWriter.BYTE_BLOCK_SIZE;
-		}
-		
-		public int NewSlice(int size)
-		{
-			if (byteUpto > DocumentsWriter.BYTE_BLOCK_SIZE - size)
-				NextBuffer();
-			int upto = byteUpto;
-			byteUpto += size;
-			buffer[byteUpto - 1] = 16;
-			return upto;
-		}
-		
-		// Size of each slice.  These arrays should be at most 16
-		// elements (index is encoded with 4 bits).  First array
-		// is just a compact way to encode X+1 with a max.  Second
-		// array is the length of each slice, ie first slice is 5
-		// bytes, next slice is 14 bytes, etc.
-		internal static readonly int[] nextLevelArray = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 9};
-		internal static readonly int[] levelSizeArray = new int[]{5, 14, 20, 30, 40, 40, 80, 80, 120, 200};
-		internal static readonly int FIRST_LEVEL_SIZE = levelSizeArray[0];
+            public /*internal*/ abstract byte[] GetByteBlock(bool trackAllocations);
+        }
+        
+        public byte[][] buffers = new byte[10][];
+        
+        internal int bufferUpto = - 1; // Which buffer we are upto
+        public int byteUpto; // Where we are in head buffer
+        
+        public byte[] buffer; // Current head buffer
+        public int byteOffset = - DocumentsWriter.BYTE_BLOCK_SIZE; // Current head offset
+        
+        private readonly bool trackAllocations;
+        private readonly Allocator allocator;
+        
+        public ByteBlockPool(Allocator allocator, bool trackAllocations)
+        {
+            InitBlock();
+            this.allocator = allocator;
+            this.trackAllocations = trackAllocations;
+        }
+        
+        public void  Reset()
+        {
+            if (bufferUpto != - 1)
+            {
+                // We allocated at least one buffer
+                
+                for (int i = 0; i < bufferUpto; i++)
+                // Fully zero fill buffers that we fully used
+                    System.Array.Clear(buffers[i], 0, buffers[i].Length);
+                
+                // Partial zero fill the final buffer
+                System.Array.Clear(buffers[bufferUpto], 0, byteUpto);
+                
+                if (bufferUpto > 0)
+                // Recycle all but the first buffer
+                    allocator.RecycleByteBlocks(buffers, 1, 1 + bufferUpto);
+                
+                // Re-use the first buffer
+                bufferUpto = 0;
+                byteUpto = 0;
+                byteOffset = 0;
+                buffer = buffers[0];
+            }
+        }
+        
+        public void  NextBuffer()
+        {
+            if (1 + bufferUpto == buffers.Length)
+            {
+                var newBuffers = new byte[(int) (buffers.Length * 1.5)][];
+                Array.Copy(buffers, 0, newBuffers, 0, buffers.Length);
+                buffers = newBuffers;
+            }
+            buffer = buffers[1 + bufferUpto] = allocator.GetByteBlock(trackAllocations);
+            bufferUpto++;
+            
+            byteUpto = 0;
+            byteOffset += DocumentsWriter.BYTE_BLOCK_SIZE;
+        }
+        
+        public int NewSlice(int size)
+        {
+            if (byteUpto > DocumentsWriter.BYTE_BLOCK_SIZE - size)
+                NextBuffer();
+            int upto = byteUpto;
+            byteUpto += size;
+            buffer[byteUpto - 1] = 16;
+            return upto;
+        }
+        
+        // Size of each slice.  These arrays should be at most 16
+        // elements (index is encoded with 4 bits).  First array
+        // is just a compact way to encode X+1 with a max.  Second
+        // array is the length of each slice, ie first slice is 5
+        // bytes, next slice is 14 bytes, etc.
+        internal static readonly int[] nextLevelArray = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 9};
+        internal static readonly int[] levelSizeArray = new int[]{5, 14, 20, 30, 40, 40, 80, 80, 120, 200};
+        internal static readonly int FIRST_LEVEL_SIZE = levelSizeArray[0];
         public readonly static int FIRST_LEVEL_SIZE_For_NUnit_Test = levelSizeArray[0];
-		
-		public int AllocSlice(byte[] slice, int upto)
-		{
-			
-			int level = slice[upto] & 15;
-			int newLevel = nextLevelArray[level];
-			int newSize = levelSizeArray[newLevel];
-			
-			// Maybe allocate another block
-			if (byteUpto > DocumentsWriter.BYTE_BLOCK_SIZE - newSize)
-				NextBuffer();
-			
-			int newUpto = byteUpto;
-			int offset = newUpto + byteOffset;
-			byteUpto += newSize;
-			
-			// Copy forward the past 3 bytes (which we are about
-			// to overwrite with the forwarding address):
-			buffer[newUpto] = slice[upto - 3];
-			buffer[newUpto + 1] = slice[upto - 2];
-			buffer[newUpto + 2] = slice[upto - 1];
-			
-			// Write forwarding address at end of last slice:
-			slice[upto - 3] = (byte) (Number.URShift(offset, 24));
-			slice[upto - 2] = (byte) (Number.URShift(offset, 16));
-			slice[upto - 1] = (byte) (Number.URShift(offset, 8));
-			slice[upto] = (byte) offset;
-			
-			// Write new level:
-			buffer[byteUpto - 1] = (byte) (16 | newLevel);
-			
-			return newUpto + 3;
-		}
+        
+        public int AllocSlice(byte[] slice, int upto)
+        {
+            
+            int level = slice[upto] & 15;
+            int newLevel = nextLevelArray[level];
+            int newSize = levelSizeArray[newLevel];
+            
+            // Maybe allocate another block
+            if (byteUpto > DocumentsWriter.BYTE_BLOCK_SIZE - newSize)
+                NextBuffer();
+            
+            int newUpto = byteUpto;
+            int offset = newUpto + byteOffset;
+            byteUpto += newSize;
+            
+            // Copy forward the past 3 bytes (which we are about
+            // to overwrite with the forwarding address):
+            buffer[newUpto] = slice[upto - 3];
+            buffer[newUpto + 1] = slice[upto - 2];
+            buffer[newUpto + 2] = slice[upto - 1];
+            
+            // Write forwarding address at end of last slice:
+            slice[upto - 3] = (byte) (Number.URShift(offset, 24));
+            slice[upto - 2] = (byte) (Number.URShift(offset, 16));
+            slice[upto - 1] = (byte) (Number.URShift(offset, 8));
+            slice[upto] = (byte) offset;
+            
+            // Write new level:
+            buffer[byteUpto - 1] = (byte) (16 | newLevel);
+            
+            return newUpto + 3;
+        }
 
         public static int FIRST_LEVEL_SIZE_ForNUnit
         {
             get { return FIRST_LEVEL_SIZE; }
         }
-	}
+    }
 }
\ No newline at end of file