lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject svn commit: r1353237 - /incubator/lucene.net/trunk/src/core/Analysis/
Date Sun, 24 Jun 2012 09:54:18 GMT
Author: synhershko
Date: Sun Jun 24 09:54:14 2012
New Revision: 1353237

URL: http://svn.apache.org/viewvc?rev=1353237&view=rev
Log:
Code cleanup

Modified:
    incubator/lucene.net/trunk/src/core/Analysis/ASCIIFoldingFilter.cs
    incubator/lucene.net/trunk/src/core/Analysis/Analyzer.cs
    incubator/lucene.net/trunk/src/core/Analysis/BaseCharFilter.cs
    incubator/lucene.net/trunk/src/core/Analysis/CachingTokenFilter.cs
    incubator/lucene.net/trunk/src/core/Analysis/CharArraySet.cs
    incubator/lucene.net/trunk/src/core/Analysis/CharFilter.cs
    incubator/lucene.net/trunk/src/core/Analysis/CharReader.cs
    incubator/lucene.net/trunk/src/core/Analysis/CharStream.cs
    incubator/lucene.net/trunk/src/core/Analysis/CharTokenizer.cs
    incubator/lucene.net/trunk/src/core/Analysis/ISOLatin1AccentFilter.cs
    incubator/lucene.net/trunk/src/core/Analysis/KeywordAnalyzer.cs
    incubator/lucene.net/trunk/src/core/Analysis/KeywordTokenizer.cs
    incubator/lucene.net/trunk/src/core/Analysis/LengthFilter.cs
    incubator/lucene.net/trunk/src/core/Analysis/LetterTokenizer.cs
    incubator/lucene.net/trunk/src/core/Analysis/LowerCaseFilter.cs
    incubator/lucene.net/trunk/src/core/Analysis/LowerCaseTokenizer.cs
    incubator/lucene.net/trunk/src/core/Analysis/MappingCharFilter.cs
    incubator/lucene.net/trunk/src/core/Analysis/NormalizeCharMap.cs
    incubator/lucene.net/trunk/src/core/Analysis/NumericTokenStream.cs
    incubator/lucene.net/trunk/src/core/Analysis/PerFieldAnalyzerWrapper.cs
    incubator/lucene.net/trunk/src/core/Analysis/PorterStemFilter.cs
    incubator/lucene.net/trunk/src/core/Analysis/PorterStemmer.cs
    incubator/lucene.net/trunk/src/core/Analysis/SimpleAnalyzer.cs
    incubator/lucene.net/trunk/src/core/Analysis/StopAnalyzer.cs
    incubator/lucene.net/trunk/src/core/Analysis/StopFilter.cs
    incubator/lucene.net/trunk/src/core/Analysis/TeeSinkTokenFilter.cs
    incubator/lucene.net/trunk/src/core/Analysis/Token.cs
    incubator/lucene.net/trunk/src/core/Analysis/TokenFilter.cs
    incubator/lucene.net/trunk/src/core/Analysis/Tokenizer.cs
    incubator/lucene.net/trunk/src/core/Analysis/WhitespaceAnalyzer.cs
    incubator/lucene.net/trunk/src/core/Analysis/WhitespaceTokenizer.cs

Modified: incubator/lucene.net/trunk/src/core/Analysis/ASCIIFoldingFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Analysis/ASCIIFoldingFilter.cs?rev=1353237&r1=1353236&r2=1353237&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Analysis/ASCIIFoldingFilter.cs (original)
+++ incubator/lucene.net/trunk/src/core/Analysis/ASCIIFoldingFilter.cs Sun Jun 24 09:54:14 2012
@@ -15,7 +15,6 @@
  * limitations under the License.
  */
 
-using System;
 using Lucene.Net.Analysis.Tokenattributes;
 using ArrayUtil = Lucene.Net.Util.ArrayUtil;
 

Modified: incubator/lucene.net/trunk/src/core/Analysis/Analyzer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Analysis/Analyzer.cs?rev=1353237&r1=1353236&r2=1353237&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Analysis/Analyzer.cs (original)
+++ incubator/lucene.net/trunk/src/core/Analysis/Analyzer.cs Sun Jun 24 09:54:14 2012
@@ -35,7 +35,7 @@ namespace Lucene.Net.Analysis
 		/// Reader.  Must be able to handle null field name for
 		/// backward compatibility.
 		/// </summary>
-		public abstract TokenStream TokenStream(System.String fieldName, System.IO.TextReader reader);
+		public abstract TokenStream TokenStream(String fieldName, System.IO.TextReader reader);
 		
 		/// <summary>Creates a TokenStream that is allowed to be re-used
 		/// from the previous time that the same thread called
@@ -44,7 +44,7 @@ namespace Lucene.Net.Analysis
 		/// analyzer should use this method for better
 		/// performance.
 		/// </summary>
-		public virtual TokenStream ReusableTokenStream(System.String fieldName, System.IO.TextReader reader)
+		public virtual TokenStream ReusableTokenStream(String fieldName, System.IO.TextReader reader)
 		{
 			return TokenStream(fieldName, reader);
 		}
@@ -98,7 +98,7 @@ namespace Lucene.Net.Analysis
                 System.Reflection.MethodInfo m = this.GetType().GetMethod("TokenStream", new[] { typeof(string), typeof(System.IO.TextReader) });
                 overridesTokenStreamMethod = m.DeclaringType != typeof(TClass);
             }
-            catch (System.MethodAccessException nsme)
+            catch (MethodAccessException)
             {
                 // can't happen, as baseClass is subclass of Analyzer
                 overridesTokenStreamMethod = false;
@@ -120,7 +120,7 @@ namespace Lucene.Net.Analysis
 		/// </param>
 		/// <returns> position increment gap, added to the next token emitted from <see cref="TokenStream(String,System.IO.TextReader)" />
 		/// </returns>
-		public virtual int GetPositionIncrementGap(System.String fieldName)
+		public virtual int GetPositionIncrementGap(String fieldName)
 		{
 			return 0;
 		}
@@ -139,12 +139,9 @@ namespace Lucene.Net.Analysis
 		/// </returns>
 		public virtual int GetOffsetGap(IFieldable field)
 		{
-			if (field.IsTokenized)
-				return 1;
-			else
-				return 0;
+			return field.IsTokenized ? 1 : 0;
 		}
-		
+
 		/// <summary>Frees persistent resources used by this Analyzer </summary>
 		public void  Close()
 		{

Modified: incubator/lucene.net/trunk/src/core/Analysis/BaseCharFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Analysis/BaseCharFilter.cs?rev=1353237&r1=1353236&r2=1353237&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Analysis/BaseCharFilter.cs (original)
+++ incubator/lucene.net/trunk/src/core/Analysis/BaseCharFilter.cs Sun Jun 24 09:54:14 2012
@@ -68,8 +68,7 @@ namespace Lucene.Net.Analysis
 
             if (currentOff < offsets[mid])
                 return mid == 0 ? currentOff : currentOff + diffs[mid - 1];
-            else
-                return currentOff + diffs[mid];
+        	return currentOff + diffs[mid];
         }
 
         protected int LastCumulativeDiff

Modified: incubator/lucene.net/trunk/src/core/Analysis/CachingTokenFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Analysis/CachingTokenFilter.cs?rev=1353237&r1=1353236&r2=1353237&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Analysis/CachingTokenFilter.cs (original)
+++ incubator/lucene.net/trunk/src/core/Analysis/CachingTokenFilter.cs Sun Jun 24 09:54:14 2012
@@ -15,9 +15,6 @@
  * limitations under the License.
  */
 
-using System;
-using Lucene.Net.Util;
-
 namespace Lucene.Net.Analysis
 {
 	
@@ -31,9 +28,9 @@ namespace Lucene.Net.Analysis
 	/// </summary>
 	public sealed class CachingTokenFilter : TokenFilter
 	{
-        private System.Collections.Generic.LinkedList<AttributeSource.State> cache = null;
+        private System.Collections.Generic.LinkedList<State> cache = null;
 		private System.Collections.Generic.IEnumerator<State> iterator = null;
-		private AttributeSource.State finalState;
+		private State finalState;
 		
 		public CachingTokenFilter(TokenStream input):base(input)
 		{

Modified: incubator/lucene.net/trunk/src/core/Analysis/CharArraySet.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Analysis/CharArraySet.cs?rev=1353237&r1=1353236&r2=1353237&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Analysis/CharArraySet.cs (original)
+++ incubator/lucene.net/trunk/src/core/Analysis/CharArraySet.cs Sun Jun 24 09:54:14 2012
@@ -50,7 +50,7 @@ namespace Lucene.Net.Analysis
         char[][] _Entries;
         int _Count;
         bool _IgnoreCase;
-        public static CharArraySet EMPTY_SET = CharArraySet.UnmodifiableSet(new CharArraySet(0, false));
+        public static CharArraySet EMPTY_SET = UnmodifiableSet(new CharArraySet(0, false));
 
         private void Init(int startSize, bool ignoreCase)
         {
@@ -84,7 +84,7 @@ namespace Lucene.Net.Analysis
 
         private void AddItems<T>(IEnumerable<T> items)
         {
-            foreach(T item in items)
+            foreach(var item in items)
             {
                 Add(item.ToString());
             }
@@ -167,7 +167,7 @@ namespace Lucene.Net.Analysis
 
             if (_IgnoreCase)
                 for (int i = 0; i < text.Length; i++)
-                    text[i] = System.Char.ToLower(text[i]);
+                    text[i] = Char.ToLower(text[i]);
             int slot = GetSlot(text, 0, text.Length);
             if (_Entries[slot] != null)
                 return false;
@@ -300,12 +300,8 @@ namespace Lucene.Net.Analysis
 
         public bool Contains(object item)
         {
-            if (item is char[])
-            {
-                char[] text = (char[])item;
-                return Contains(text, 0, text.Length);
-            }
-            return Contains(item.ToString());
+        	var text = item as char[];
+        	return text != null ? Contains(text, 0, text.Length) : Contains(item.ToString());
         }
 
         public bool Add(object item)
@@ -334,7 +330,7 @@ namespace Lucene.Net.Analysis
             if (set._ReadOnly)
                 return set;
 
-            CharArraySet newSet = new CharArraySet(set._Entries, set._IgnoreCase, set.Count) {IsReadOnly = true};
+            var newSet = new CharArraySet(set._Entries, set._IgnoreCase, set.Count) {IsReadOnly = true};
             return newSet;
         }
 
@@ -351,7 +347,7 @@ namespace Lucene.Net.Analysis
                 throw new ArgumentNullException("set", "Given set is null!");
             if (set == EMPTY_SET)
                 return EMPTY_SET;
-            bool ignoreCase = set is CharArraySet ? ((CharArraySet)set)._IgnoreCase : false;
+            bool ignoreCase = set is CharArraySet && ((CharArraySet)set)._IgnoreCase;
             var arrSet = new CharArraySet(set.Count, ignoreCase);
             arrSet.AddItems(set);
             return arrSet;
@@ -456,9 +452,9 @@ namespace Lucene.Net.Analysis
         /// The IEnumerator&lt;String&gt; for this set.  Strings are constructed on the fly,
         /// so use <c>nextCharArray</c> for more efficient access
         /// </summary>
-        class CharArraySetEnumerator : IEnumerator<string>
+        public class CharArraySetEnumerator : IEnumerator<string>
         {
-            CharArraySet _Creator;
+        	readonly CharArraySet _Creator;
             int pos = -1;
             char[] cur;
 
@@ -491,7 +487,7 @@ namespace Lucene.Net.Analysis
             {
             }
 
-            object System.Collections.IEnumerator.Current
+            object IEnumerator.Current
             {
                 get { return new string(NextCharArray()); }
             }

Modified: incubator/lucene.net/trunk/src/core/Analysis/CharFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Analysis/CharFilter.cs?rev=1353237&r1=1353236&r2=1353237&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Analysis/CharFilter.cs (original)
+++ incubator/lucene.net/trunk/src/core/Analysis/CharFilter.cs Sun Jun 24 09:54:14 2012
@@ -15,8 +15,6 @@
  * limitations under the License.
  */
 
-using System;
-
 namespace Lucene.Net.Analysis
 {
 	

Modified: incubator/lucene.net/trunk/src/core/Analysis/CharReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Analysis/CharReader.cs?rev=1353237&r1=1353236&r2=1353237&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Analysis/CharReader.cs (original)
+++ incubator/lucene.net/trunk/src/core/Analysis/CharReader.cs Sun Jun 24 09:54:14 2012
@@ -15,8 +15,6 @@
  * limitations under the License.
  */
 
-using System;
-
 namespace Lucene.Net.Analysis
 {
 	
@@ -35,14 +33,13 @@ namespace Lucene.Net.Analysis
 		
 		public static CharStream Get(System.IO.TextReader input)
 		{
-            if (input is CharStream)
-                return (CharStream) input;
-            else
-            {
-                // {{Aroush-2.9}} isn't there a better (faster) way to do this?
-                System.IO.MemoryStream theString = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(input.ReadToEnd()));
-                return new CharReader(new System.IO.StreamReader(theString));
-            }
+			var charStream = input as CharStream;
+			if (charStream != null)
+				return charStream;
+			
+			// {{Aroush-2.9}} isn't there a better (faster) way to do this?
+			var theString = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(input.ReadToEnd()));
+			return new CharReader(new System.IO.StreamReader(theString));
 			//return input is CharStream?(CharStream) input:new CharReader(input);
 		}
 		

Modified: incubator/lucene.net/trunk/src/core/Analysis/CharStream.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Analysis/CharStream.cs?rev=1353237&r1=1353236&r2=1353237&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Analysis/CharStream.cs (original)
+++ incubator/lucene.net/trunk/src/core/Analysis/CharStream.cs Sun Jun 24 09:54:14 2012
@@ -15,8 +15,6 @@
  * limitations under the License.
  */
 
-using System;
-
 namespace Lucene.Net.Analysis
 {
 	

Modified: incubator/lucene.net/trunk/src/core/Analysis/CharTokenizer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Analysis/CharTokenizer.cs?rev=1353237&r1=1353236&r2=1353237&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Analysis/CharTokenizer.cs (original)
+++ incubator/lucene.net/trunk/src/core/Analysis/CharTokenizer.cs Sun Jun 24 09:54:14 2012
@@ -15,7 +15,6 @@
  * limitations under the License.
  */
 
-using System;
 using Lucene.Net.Analysis.Tokenattributes;
 using AttributeSource = Lucene.Net.Util.AttributeSource;
 
@@ -46,10 +45,10 @@ namespace Lucene.Net.Analysis
 		private int offset = 0, bufferIndex = 0, dataLen = 0;
 		private const int MAX_WORD_LEN = 255;
 		private const int IO_BUFFER_SIZE = 4096;
-		private char[] ioBuffer = new char[IO_BUFFER_SIZE];
+		private readonly char[] ioBuffer = new char[IO_BUFFER_SIZE];
 		
-		private ITermAttribute termAtt;
-		private IOffsetAttribute offsetAtt;
+		private readonly ITermAttribute termAtt;
+		private readonly IOffsetAttribute offsetAtt;
 		
 		/// <summary>Returns true iff a character should be included in a token.  This
 		/// tokenizer generates as tokens adjacent sequences of characters which
@@ -79,14 +78,13 @@ namespace Lucene.Net.Analysis
 				if (bufferIndex >= dataLen)
 				{
 					offset += dataLen;
-					dataLen = input.Read((System.Char[]) ioBuffer, 0, ioBuffer.Length);
+					dataLen = input.Read(ioBuffer, 0, ioBuffer.Length);
 					if (dataLen <= 0)
 					{
 						dataLen = 0; // so next offset += dataLen won't decrement offset
 						if (length > 0)
 							break;
-						else
-							return false;
+						return false;
 					}
 					bufferIndex = 0;
 				}

Modified: incubator/lucene.net/trunk/src/core/Analysis/ISOLatin1AccentFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Analysis/ISOLatin1AccentFilter.cs?rev=1353237&r1=1353236&r2=1353237&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Analysis/ISOLatin1AccentFilter.cs (original)
+++ incubator/lucene.net/trunk/src/core/Analysis/ISOLatin1AccentFilter.cs Sun Jun 24 09:54:14 2012
@@ -43,7 +43,7 @@ namespace Lucene.Net.Analysis
 		
 		private char[] output = new char[256];
 		private int outputPos;
-		private ITermAttribute termAtt;
+		private readonly ITermAttribute termAtt;
 		
 		public override bool IncrementToken()
 		{
@@ -65,10 +65,9 @@ namespace Lucene.Net.Analysis
 				}
 				return true;
 			}
-			else
-				return false;
+			return false;
 		}
-		
+
 		/// <summary> To replace accented characters in a String by unaccented equivalents.</summary>
 		public void  RemoveAccents(char[] input, int length)
 		{

Modified: incubator/lucene.net/trunk/src/core/Analysis/KeywordAnalyzer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Analysis/KeywordAnalyzer.cs?rev=1353237&r1=1353236&r2=1353237&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Analysis/KeywordAnalyzer.cs (original)
+++ incubator/lucene.net/trunk/src/core/Analysis/KeywordAnalyzer.cs Sun Jun 24 09:54:14 2012
@@ -15,8 +15,6 @@
  * limitations under the License.
  */
 
-using System;
-
 namespace Lucene.Net.Analysis
 {
 	
@@ -42,7 +40,7 @@ namespace Lucene.Net.Analysis
 				// tokenStream but not reusableTokenStream
 				return TokenStream(fieldName, reader);
 			}
-			Tokenizer tokenizer = (Tokenizer) PreviousTokenStream;
+			var tokenizer = (Tokenizer) PreviousTokenStream;
 			if (tokenizer == null)
 			{
 				tokenizer = new KeywordTokenizer(reader);

Modified: incubator/lucene.net/trunk/src/core/Analysis/KeywordTokenizer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Analysis/KeywordTokenizer.cs?rev=1353237&r1=1353236&r2=1353237&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Analysis/KeywordTokenizer.cs (original)
+++ incubator/lucene.net/trunk/src/core/Analysis/KeywordTokenizer.cs Sun Jun 24 09:54:14 2012
@@ -15,7 +15,6 @@
  * limitations under the License.
  */
 
-using System;
 using Lucene.Net.Analysis.Tokenattributes;
 using AttributeSource = Lucene.Net.Util.AttributeSource;
 

Modified: incubator/lucene.net/trunk/src/core/Analysis/LengthFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Analysis/LengthFilter.cs?rev=1353237&r1=1353236&r2=1353237&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Analysis/LengthFilter.cs (original)
+++ incubator/lucene.net/trunk/src/core/Analysis/LengthFilter.cs Sun Jun 24 09:54:14 2012
@@ -15,7 +15,6 @@
  * limitations under the License.
  */
 
-using System;
 using Lucene.Net.Analysis.Tokenattributes;
 
 namespace Lucene.Net.Analysis
@@ -28,7 +27,7 @@ namespace Lucene.Net.Analysis
 		internal int min;
 		internal int max;
 		
-		private ITermAttribute termAtt;
+		private readonly ITermAttribute termAtt;
 		
 		/// <summary> Build a filter that removes words that are too long or too
 		/// short from the text.
@@ -47,7 +46,7 @@ namespace Lucene.Net.Analysis
 			// return the first non-stop word found
 			while (input.IncrementToken())
 			{
-				int len = termAtt.TermLength();
+				var len = termAtt.TermLength();
 				if (len >= min && len <= max)
 				{
 					return true;

Modified: incubator/lucene.net/trunk/src/core/Analysis/LetterTokenizer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Analysis/LetterTokenizer.cs?rev=1353237&r1=1353236&r2=1353237&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Analysis/LetterTokenizer.cs (original)
+++ incubator/lucene.net/trunk/src/core/Analysis/LetterTokenizer.cs Sun Jun 24 09:54:14 2012
@@ -15,8 +15,6 @@
  * limitations under the License.
  */
 
-using System;
-
 using AttributeSource = Lucene.Net.Util.AttributeSource;
 
 namespace Lucene.Net.Analysis
@@ -32,17 +30,19 @@ namespace Lucene.Net.Analysis
 	public class LetterTokenizer:CharTokenizer
 	{
 		/// <summary>Construct a new LetterTokenizer. </summary>
-		public LetterTokenizer(System.IO.TextReader in_Renamed):base(in_Renamed)
+		public LetterTokenizer(System.IO.TextReader @in):base(@in)
 		{
 		}
 		
 		/// <summary>Construct a new LetterTokenizer using a given <see cref="AttributeSource" />. </summary>
-		public LetterTokenizer(AttributeSource source, System.IO.TextReader in_Renamed):base(source, in_Renamed)
+		public LetterTokenizer(AttributeSource source, System.IO.TextReader @in)
+			: base(source, @in)
 		{
 		}
 		
 		/// <summary>Construct a new LetterTokenizer using a given <see cref="Lucene.Net.Util.AttributeSource.AttributeFactory" />. </summary>
-		public LetterTokenizer(AttributeFactory factory, System.IO.TextReader in_Renamed):base(factory, in_Renamed)
+		public LetterTokenizer(AttributeFactory factory, System.IO.TextReader @in)
+			: base(factory, @in)
 		{
 		}
 		

Modified: incubator/lucene.net/trunk/src/core/Analysis/LowerCaseFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Analysis/LowerCaseFilter.cs?rev=1353237&r1=1353236&r2=1353237&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Analysis/LowerCaseFilter.cs (original)
+++ incubator/lucene.net/trunk/src/core/Analysis/LowerCaseFilter.cs Sun Jun 24 09:54:14 2012
@@ -15,7 +15,6 @@
  * limitations under the License.
  */
 
-using System;
 using Lucene.Net.Analysis.Tokenattributes;
 
 namespace Lucene.Net.Analysis
@@ -24,12 +23,13 @@ namespace Lucene.Net.Analysis
 	/// <summary>Normalizes token text to lower case.</summary>
 	public sealed class LowerCaseFilter:TokenFilter
 	{
-		public LowerCaseFilter(TokenStream in_Renamed):base(in_Renamed)
+		public LowerCaseFilter(TokenStream @in)
+			: base(@in)
 		{
             termAtt = AddAttribute<ITermAttribute>();
 		}
 		
-		private ITermAttribute termAtt;
+		private readonly ITermAttribute termAtt;
 		
 		public override bool IncrementToken()
 		{
@@ -43,8 +43,7 @@ namespace Lucene.Net.Analysis
 				
 				return true;
 			}
-			else
-				return false;
+			return false;
 		}
 	}
 }
\ No newline at end of file

Modified: incubator/lucene.net/trunk/src/core/Analysis/LowerCaseTokenizer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Analysis/LowerCaseTokenizer.cs?rev=1353237&r1=1353236&r2=1353237&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Analysis/LowerCaseTokenizer.cs (original)
+++ incubator/lucene.net/trunk/src/core/Analysis/LowerCaseTokenizer.cs Sun Jun 24 09:54:14 2012
@@ -15,8 +15,6 @@
  * limitations under the License.
  */
 
-using System;
-
 using AttributeSource = Lucene.Net.Util.AttributeSource;
 
 namespace Lucene.Net.Analysis
@@ -34,17 +32,20 @@ namespace Lucene.Net.Analysis
 	public sealed class LowerCaseTokenizer:LetterTokenizer
 	{
 		/// <summary>Construct a new LowerCaseTokenizer. </summary>
-		public LowerCaseTokenizer(System.IO.TextReader in_Renamed):base(in_Renamed)
+		public LowerCaseTokenizer(System.IO.TextReader @in)
+			: base(@in)
 		{
 		}
 		
 		/// <summary>Construct a new LowerCaseTokenizer using a given <see cref="AttributeSource" />. </summary>
-		public LowerCaseTokenizer(AttributeSource source, System.IO.TextReader in_Renamed):base(source, in_Renamed)
+		public LowerCaseTokenizer(AttributeSource source, System.IO.TextReader @in)
+			: base(source, @in)
 		{
 		}
 		
 		/// <summary>Construct a new LowerCaseTokenizer using a given <see cref="Lucene.Net.Util.AttributeSource.AttributeFactory" />. </summary>
-		public LowerCaseTokenizer(AttributeFactory factory, System.IO.TextReader in_Renamed):base(factory, in_Renamed)
+		public LowerCaseTokenizer(AttributeFactory factory, System.IO.TextReader @in)
+			: base(factory, @in)
 		{
 		}
 		

Modified: incubator/lucene.net/trunk/src/core/Analysis/MappingCharFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Analysis/MappingCharFilter.cs?rev=1353237&r1=1353236&r2=1353237&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Analysis/MappingCharFilter.cs (original)
+++ incubator/lucene.net/trunk/src/core/Analysis/MappingCharFilter.cs Sun Jun 24 09:54:14 2012
@@ -15,7 +15,6 @@
  * limitations under the License.
  */
 
-using System;
 using System.Collections.Generic;
 
 namespace Lucene.Net.Analysis
@@ -28,20 +27,22 @@ namespace Lucene.Net.Analysis
 	/// </summary>
 	public class MappingCharFilter : BaseCharFilter
 	{
-		private NormalizeCharMap normMap;
-		private System.Collections.Generic.LinkedList<char> buffer;
+		private readonly NormalizeCharMap normMap;
+		private LinkedList<char> buffer;
 		private System.String replacement;
 		private int charPointer;
 		private int nextCharCounter;
 		
 		/// Default constructor that takes a <see cref="CharStream" />.
-		public MappingCharFilter(NormalizeCharMap normMap, CharStream in_Renamed):base(in_Renamed)
+		public MappingCharFilter(NormalizeCharMap normMap, CharStream @in)
+			: base(@in)
 		{
 			this.normMap = normMap;
 		}
 		
 		/// Easy-use constructor that takes a <see cref="System.IO.TextReader" />.
-		public MappingCharFilter(NormalizeCharMap normMap, System.IO.TextReader in_Renamed):base(CharReader.Get(in_Renamed))
+		public MappingCharFilter(NormalizeCharMap normMap, System.IO.TextReader @in)
+			: base(CharReader.Get(@in))
 		{
 			this.normMap = normMap;
 		}
@@ -87,7 +88,7 @@ namespace Lucene.Net.Analysis
 		private int NextChar()
 		{
 			nextCharCounter++;
-			if (buffer != null && !(buffer.Count == 0))
+			if (buffer != null && buffer.Count != 0)
 			{
 				char tempObject = buffer.First.Value;
 				buffer.RemoveFirst();
@@ -143,7 +144,7 @@ namespace Lucene.Net.Analysis
 		
 		public  override int Read(System.Char[] cbuf, int off, int len)
 		{
-			char[] tmp = new char[len];
+			var tmp = new char[len];
 			int l = input.Read(tmp, 0, len);
 			if (l != 0)
 			{

Modified: incubator/lucene.net/trunk/src/core/Analysis/NormalizeCharMap.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Analysis/NormalizeCharMap.cs?rev=1353237&r1=1353236&r2=1353237&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Analysis/NormalizeCharMap.cs (original)
+++ incubator/lucene.net/trunk/src/core/Analysis/NormalizeCharMap.cs Sun Jun 24 09:54:14 2012
@@ -15,7 +15,6 @@
  * limitations under the License.
  */
 
-using System;
 using Lucene.Net.Support;
 
 namespace Lucene.Net.Analysis
@@ -43,14 +42,14 @@ namespace Lucene.Net.Analysis
 		public virtual void  Add(System.String singleMatch, System.String replacement)
 		{
 			NormalizeCharMap currMap = this;
-			for (int i = 0; i < singleMatch.Length; i++)
+			for (var i = 0; i < singleMatch.Length; i++)
 			{
 				char c = singleMatch[i];
 				if (currMap.submap == null)
 				{
 					currMap.submap = new HashMap<char, NormalizeCharMap>(1);
 				}
-				NormalizeCharMap map = currMap.submap[c];
+				var map = currMap.submap[c];
 				if (map == null)
 				{
 					map = new NormalizeCharMap();

Modified: incubator/lucene.net/trunk/src/core/Analysis/NumericTokenStream.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Analysis/NumericTokenStream.cs?rev=1353237&r1=1353236&r2=1353237&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Analysis/NumericTokenStream.cs (original)
+++ incubator/lucene.net/trunk/src/core/Analysis/NumericTokenStream.cs Sun Jun 24 09:54:14 2012
@@ -15,7 +15,6 @@
  * limitations under the License.
  */
 
-using System;
 using Lucene.Net.Analysis.Tokenattributes;
 using Lucene.Net.Search;
 using AttributeSource = Lucene.Net.Util.AttributeSource;
@@ -264,7 +263,7 @@ namespace Lucene.Net.Analysis
 		private IPositionIncrementAttribute posIncrAtt;
 		
 		private int shift = 0, valSize = 0; // valSize==0 means not initialized
-		private int precisionStep;
+		private readonly int precisionStep;
 		
 		private long value_Renamed = 0L;
 	}

Modified: incubator/lucene.net/trunk/src/core/Analysis/PerFieldAnalyzerWrapper.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Analysis/PerFieldAnalyzerWrapper.cs?rev=1353237&r1=1353236&r2=1353237&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Analysis/PerFieldAnalyzerWrapper.cs (original)
+++ incubator/lucene.net/trunk/src/core/Analysis/PerFieldAnalyzerWrapper.cs Sun Jun 24 09:54:14 2012
@@ -15,7 +15,6 @@
  * limitations under the License.
  */
 
-using System;
 using System.Collections.Generic;
 using Lucene.Net.Support;
 
@@ -43,8 +42,8 @@ namespace Lucene.Net.Analysis
 	/// </summary>
 	public class PerFieldAnalyzerWrapper:Analyzer
 	{
-		private Analyzer defaultAnalyzer;
-		private IDictionary<string, Analyzer> analyzerMap = new HashMap<string, Analyzer>();
+		private readonly Analyzer defaultAnalyzer;
+		private readonly IDictionary<string, Analyzer> analyzerMap = new HashMap<string, Analyzer>();
 		
 		
 		/// <summary> Constructs with default analyzer.
@@ -68,7 +67,7 @@ namespace Lucene.Net.Analysis
 		/// <param name="fieldAnalyzers">a Map (String field name to the Analyzer) to be 
 		/// used for those fields 
 		/// </param>
-        public PerFieldAnalyzerWrapper(Analyzer defaultAnalyzer, IDictionary<string, Analyzer> fieldAnalyzers)
+        public PerFieldAnalyzerWrapper(Analyzer defaultAnalyzer, IEnumerable<KeyValuePair<string, Analyzer>> fieldAnalyzers)
 		{
 			this.defaultAnalyzer = defaultAnalyzer;
 			if (fieldAnalyzers != null)
@@ -94,12 +93,8 @@ namespace Lucene.Net.Analysis
 		
 		public override TokenStream TokenStream(System.String fieldName, System.IO.TextReader reader)
 		{
-			Analyzer analyzer = analyzerMap[fieldName];
-			if (analyzer == null)
-			{
-				analyzer = defaultAnalyzer;
-			}
-			
+			var analyzer = analyzerMap[fieldName] ?? defaultAnalyzer;
+
 			return analyzer.TokenStream(fieldName, reader);
 		}
 		
@@ -112,22 +107,20 @@ namespace Lucene.Net.Analysis
 				// tokenStream but not reusableTokenStream
 				return TokenStream(fieldName, reader);
 			}
-			Analyzer analyzer = analyzerMap[fieldName];
-			if (analyzer == null)
-				analyzer = defaultAnalyzer;
-			
+			var analyzer = analyzerMap[fieldName] ?? defaultAnalyzer;
+
 			return analyzer.ReusableTokenStream(fieldName, reader);
 		}
 		
 		/// <summary>Return the positionIncrementGap from the analyzer assigned to fieldName </summary>
 		public override int GetPositionIncrementGap(string fieldName)
 		{
-			Analyzer analyzer = analyzerMap[fieldName] ?? defaultAnalyzer;
+			var analyzer = analyzerMap[fieldName] ?? defaultAnalyzer;
 		    return analyzer.GetPositionIncrementGap(fieldName);
 		}
 
         /// <summary> Return the offsetGap from the analyzer assigned to field </summary>
-        public override int GetOffsetGap(Lucene.Net.Documents.IFieldable field)
+        public override int GetOffsetGap(Documents.IFieldable field)
         {
             Analyzer analyzer = analyzerMap[field.Name] ?? defaultAnalyzer;
             return analyzer.GetOffsetGap(field);
@@ -136,7 +129,7 @@ namespace Lucene.Net.Analysis
 		public override System.String ToString()
 		{
 			// {{Aroush-2.9}} will 'analyzerMap.ToString()' work in the same way as Java's java.util.HashMap.toString()? 
-			return "PerFieldAnalyzerWrapper(" + analyzerMap.ToString() + ", default=" + defaultAnalyzer + ")";
+			return "PerFieldAnalyzerWrapper(" + analyzerMap + ", default=" + defaultAnalyzer + ")";
 		}
 	}
 }
\ No newline at end of file

Modified: incubator/lucene.net/trunk/src/core/Analysis/PorterStemFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Analysis/PorterStemFilter.cs?rev=1353237&r1=1353236&r2=1353237&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Analysis/PorterStemFilter.cs (original)
+++ incubator/lucene.net/trunk/src/core/Analysis/PorterStemFilter.cs Sun Jun 24 09:54:14 2012
@@ -15,7 +15,6 @@
  * limitations under the License.
  */
 
-using System;
 using Lucene.Net.Analysis.Tokenattributes;
 
 namespace Lucene.Net.Analysis
@@ -41,8 +40,8 @@ namespace Lucene.Net.Analysis
 	/// </summary>
 	public sealed class PorterStemFilter:TokenFilter
 	{
-		private PorterStemmer stemmer;
-		private ITermAttribute termAtt;
+		private readonly PorterStemmer stemmer;
+		private readonly ITermAttribute termAtt;
 		
 		public PorterStemFilter(TokenStream in_Renamed):base(in_Renamed)
 		{

Modified: incubator/lucene.net/trunk/src/core/Analysis/PorterStemmer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Analysis/PorterStemmer.cs?rev=1353237&r1=1353236&r2=1353237&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Analysis/PorterStemmer.cs (original)
+++ incubator/lucene.net/trunk/src/core/Analysis/PorterStemmer.cs Sun Jun 24 09:54:14 2012
@@ -81,7 +81,7 @@ namespace Lucene.Net.Analysis
 		{
 			if (b.Length <= i + EXTRA)
 			{
-				char[] new_b = new char[b.Length + INC];
+				var new_b = new char[b.Length + INC];
 				Array.Copy(b, 0, new_b, 0, b.Length);
 				b = new_b;
 			}
@@ -637,7 +637,7 @@ namespace Lucene.Net.Analysis
 			Reset();
 			if (b.Length < wordLen)
 			{
-				char[] new_b = new char[wordLen + EXTRA];
+				var new_b = new char[wordLen + EXTRA];
 				b = new_b;
 			}
 			Array.Copy(wordBuffer, offset, b, 0, wordLen);
@@ -688,22 +688,22 @@ namespace Lucene.Net.Analysis
 		[STAThread]
 		public static void  Main(System.String[] args)
 		{
-			PorterStemmer s = new PorterStemmer();
+			var s = new PorterStemmer();
 			
 			for (int i = 0; i < args.Length; i++)
 			{
 				try
 				{
 					System.IO.Stream in_Renamed = new System.IO.FileStream(args[i], System.IO.FileMode.Open, System.IO.FileAccess.Read);
-					byte[] buffer = new byte[1024];
-					int bufferLen, offset, ch;
-					
-					bufferLen = in_Renamed.Read(buffer, 0, buffer.Length);
-					offset = 0;
+					var buffer = new byte[1024];
+
+					int bufferLen = in_Renamed.Read(buffer, 0, buffer.Length);
+					int offset = 0;
 					s.Reset();
 					
 					while (true)
 					{
+						int ch;
 						if (offset < bufferLen)
 							ch = buffer[offset++];
 						else
@@ -716,14 +716,14 @@ namespace Lucene.Net.Analysis
 								ch = buffer[offset++];
 						}
 						
-						if (System.Char.IsLetter((char) ch))
+						if (Char.IsLetter((char) ch))
 						{
-							s.Add(System.Char.ToLower((char) ch));
+							s.Add(Char.ToLower((char) ch));
 						}
 						else
 						{
 							s.Stem();
-							System.Console.Out.Write(s.ToString());
+							Console.Out.Write(s.ToString());
 							s.Reset();
 							if (ch < 0)
 								break;
@@ -738,7 +738,7 @@ namespace Lucene.Net.Analysis
 				}
 				catch (System.IO.IOException e)
 				{
-					System.Console.Out.WriteLine("error reading " + args[i]);
+					Console.Out.WriteLine("error reading " + args[i]);
 				}
 			}
 		}

Modified: incubator/lucene.net/trunk/src/core/Analysis/SimpleAnalyzer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Analysis/SimpleAnalyzer.cs?rev=1353237&r1=1353236&r2=1353237&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Analysis/SimpleAnalyzer.cs (original)
+++ incubator/lucene.net/trunk/src/core/Analysis/SimpleAnalyzer.cs Sun Jun 24 09:54:14 2012
@@ -15,8 +15,6 @@
  * limitations under the License.
  */
 
-using System;
-
 namespace Lucene.Net.Analysis
 {
 	
@@ -33,7 +31,7 @@ namespace Lucene.Net.Analysis
 		
 		public override TokenStream ReusableTokenStream(System.String fieldName, System.IO.TextReader reader)
 		{
-			Tokenizer tokenizer = (Tokenizer) PreviousTokenStream;
+			var tokenizer = (Tokenizer) PreviousTokenStream;
 			if (tokenizer == null)
 			{
 				tokenizer = new LowerCaseTokenizer(reader);

Modified: incubator/lucene.net/trunk/src/core/Analysis/StopAnalyzer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Analysis/StopAnalyzer.cs?rev=1353237&r1=1353236&r2=1353237&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Analysis/StopAnalyzer.cs (original)
+++ incubator/lucene.net/trunk/src/core/Analysis/StopAnalyzer.cs Sun Jun 24 09:54:14 2012
@@ -15,7 +15,6 @@
  * limitations under the License.
  */
 
-using System;
 using System.Collections.Generic;
 using Version = Lucene.Net.Util.Version;
 
@@ -36,8 +35,8 @@ namespace Lucene.Net.Analysis
 	
 	public sealed class StopAnalyzer:Analyzer
 	{
-		private ISet<string> stopWords;
-		private bool enablePositionIncrements;
+		private readonly ISet<string> stopWords;
+		private readonly bool enablePositionIncrements;
 
 		/// <summary>An unmodifiable set containing some common English words that are not usually useful
 		/// for searching.
@@ -70,7 +69,7 @@ namespace Lucene.Net.Analysis
 		public StopAnalyzer(Version matchVersion, System.IO.FileInfo stopwordsFile)
 		{
 			stopWords = WordlistLoader.GetWordSet(stopwordsFile);
-			this.enablePositionIncrements = StopFilter.GetEnablePositionIncrementsVersionDefault(matchVersion);
+			enablePositionIncrements = StopFilter.GetEnablePositionIncrementsVersionDefault(matchVersion);
 		}
 
         /// <summary>Builds an analyzer with the stop words from the given reader. </summary>
@@ -83,7 +82,7 @@ namespace Lucene.Net.Analysis
         public StopAnalyzer(Version matchVersion, System.IO.TextReader stopwords)
         {
             stopWords = WordlistLoader.GetWordSet(stopwords);
-            this.enablePositionIncrements = StopFilter.GetEnablePositionIncrementsVersionDefault(matchVersion);
+            enablePositionIncrements = StopFilter.GetEnablePositionIncrementsVersionDefault(matchVersion);
         }
 
         /// <summary>Filters LowerCaseTokenizer with StopFilter. </summary>
@@ -118,11 +117,10 @@ namespace Lucene.Net.Analysis
 		
 		public override TokenStream ReusableTokenStream(System.String fieldName, System.IO.TextReader reader)
 		{
-			SavedStreams streams = (SavedStreams) PreviousTokenStream;
+			var streams = (SavedStreams) PreviousTokenStream;
 			if (streams == null)
 			{
-				streams = new SavedStreams(this);
-				streams.source = new LowerCaseTokenizer(reader);
+				streams = new SavedStreams(this) {source = new LowerCaseTokenizer(reader)};
 				streams.result = new StopFilter(enablePositionIncrements, streams.source, stopWords);
 				PreviousTokenStream = streams;
 			}
@@ -133,8 +131,8 @@ namespace Lucene.Net.Analysis
 		static StopAnalyzer()
 		{
 			{
-				System.String[] stopWords = new System.String[]{"a", "an", "and", "are", "as", "at", "be", "but", "by", "for", "if", "in", "into", "is", "it", "no", "not", "of", "on", "or", "such", "that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with"};
-				CharArraySet stopSet = new CharArraySet(stopWords.Length, false);
+				var stopWords = new System.String[]{"a", "an", "and", "are", "as", "at", "be", "but", "by", "for", "if", "in", "into", "is", "it", "no", "not", "of", "on", "or", "such", "that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with"};
+				var stopSet = new CharArraySet(stopWords.Length, false);
 				stopSet.AddAll(stopWords);
 				ENGLISH_STOP_WORDS_SET = CharArraySet.UnmodifiableSet(stopSet);
 			}

Modified: incubator/lucene.net/trunk/src/core/Analysis/StopFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Analysis/StopFilter.cs?rev=1353237&r1=1353236&r2=1353237&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Analysis/StopFilter.cs (original)
+++ incubator/lucene.net/trunk/src/core/Analysis/StopFilter.cs Sun Jun 24 09:54:14 2012
@@ -29,11 +29,11 @@ namespace Lucene.Net.Analysis
 	
 	public sealed class StopFilter:TokenFilter
 	{
-		private CharArraySet stopWords;
+		private readonly CharArraySet stopWords;
 		private bool enablePositionIncrements = false;
 		
-		private ITermAttribute termAtt;
-		private IPositionIncrementAttribute posIncrAtt;
+		private readonly ITermAttribute termAtt;
+		private readonly IPositionIncrementAttribute posIncrAtt;
 		
 		/// <summary> Construct a token stream filtering the given input.
 		/// If <c>stopWords</c> is an instance of <see cref="CharArraySet" /> (true if
@@ -73,8 +73,8 @@ namespace Lucene.Net.Analysis
 		///  <param name="in_Renamed">Input stream</param>
 		/// <param name="stopWords">A Set of strings or char[] or any other ToString()-able set representing the stopwords</param>
 		/// <seealso cref="MakeStopSet(String[])"/>
-		public StopFilter(bool enablePositionIncrements, TokenStream in_Renamed, ISet<string> stopWords)
-            : this(enablePositionIncrements, in_Renamed, stopWords, false)
+		public StopFilter(bool enablePositionIncrements, TokenStream @in, ISet<string> stopWords)
+			: this(enablePositionIncrements, @in, stopWords, false)
 		{ }
 		
 		/// <summary> Builds a Set from an array of stop words,
@@ -108,7 +108,7 @@ namespace Lucene.Net.Analysis
 		/// <returns> a Set containing the words</returns>
 		public static ISet<string> MakeStopSet(string[] stopWords, bool ignoreCase)
 		{
-			CharArraySet stopSet = new CharArraySet(stopWords.Length, ignoreCase);
+			var stopSet = new CharArraySet(stopWords.Length, ignoreCase);
 		    stopSet.AddAll(stopWords);
 			return stopSet;
 		}
@@ -119,7 +119,7 @@ namespace Lucene.Net.Analysis
 		/// <returns>A Set (<see cref="CharArraySet"/>)containing the words</returns>
 		public static ISet<string> MakeStopSet(IList<object> stopWords, bool ignoreCase)
 		{
-			CharArraySet stopSet = new CharArraySet(stopWords.Count, ignoreCase);
+			var stopSet = new CharArraySet(stopWords.Count, ignoreCase);
             foreach(var word in stopWords)
                 stopSet.Add(word.ToString());
 			return stopSet;
@@ -173,7 +173,7 @@ namespace Lucene.Net.Analysis
 	    public bool EnablePositionIncrements
 	    {
 	        get { return enablePositionIncrements; }
-	        set { this.enablePositionIncrements = value; }
+	        set { enablePositionIncrements = value; }
 	    }
 	}
 }
\ No newline at end of file

Modified: incubator/lucene.net/trunk/src/core/Analysis/TeeSinkTokenFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Analysis/TeeSinkTokenFilter.cs?rev=1353237&r1=1353236&r2=1353237&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Analysis/TeeSinkTokenFilter.cs (original)
+++ incubator/lucene.net/trunk/src/core/Analysis/TeeSinkTokenFilter.cs Sun Jun 24 09:54:14 2012
@@ -74,7 +74,7 @@ namespace Lucene.Net.Analysis
 				return true;
 			}
 		}
-		private LinkedList<WeakReference> sinks = new LinkedList<WeakReference>();
+		private readonly LinkedList<WeakReference> sinks = new LinkedList<WeakReference>();
 		
 		/// <summary> Instantiates a new TeeSinkTokenFilter.</summary>
 		public TeeSinkTokenFilter(TokenStream input):base(input)
@@ -94,8 +94,8 @@ namespace Lucene.Net.Analysis
 		/// </seealso>
 		public SinkTokenStream NewSinkTokenStream(SinkFilter filter)
 		{
-			SinkTokenStream sink = new SinkTokenStream(this.CloneAttributes(), filter);
-			this.sinks.AddLast(new System.WeakReference(sink));
+			var sink = new SinkTokenStream(this.CloneAttributes(), filter);
+			sinks.AddLast(new WeakReference(sink));
 			return sink;
 		}
 		
@@ -111,11 +111,11 @@ namespace Lucene.Net.Analysis
 				throw new System.ArgumentException("The supplied sink is not compatible to this tee");
 			}
 			// add eventually missing attribute impls to the existing sink
-            foreach (Attribute impl in this.CloneAttributes().GetAttributeImplsIterator())
+            foreach (var impl in this.CloneAttributes().GetAttributeImplsIterator())
             {
                 sink.AddAttributeImpl(impl);
             }
-			this.sinks.AddLast(new WeakReference(sink));
+			sinks.AddLast(new WeakReference(sink));
 		}
 		
 		/// <summary> <c>TeeSinkTokenFilter</c> passes all tokens to the added sinks
@@ -135,10 +135,10 @@ namespace Lucene.Net.Analysis
 			if (input.IncrementToken())
 			{
 				// capture state lazily - maybe no SinkFilter accepts this state
-				AttributeSource.State state = null;
+				State state = null;
 				foreach(WeakReference wr in sinks)
 				{
-				    SinkTokenStream sink = (SinkTokenStream)wr.Target;
+				    var sink = (SinkTokenStream)wr.Target;
 					if (sink != null)
 					{
 						if (sink.Accept(this))
@@ -160,10 +160,10 @@ namespace Lucene.Net.Analysis
 		public override void  End()
 		{
 			base.End();
-			AttributeSource.State finalState = CaptureState();
+			State finalState = CaptureState();
 			foreach(WeakReference wr in sinks)
 			{
-                SinkTokenStream sink = (SinkTokenStream)wr.Target;
+                var sink = (SinkTokenStream)wr.Target;
 				if (sink != null)
 				{
 					sink.SetFinalState(finalState);
@@ -190,10 +190,10 @@ namespace Lucene.Net.Analysis
 		
 		public sealed class SinkTokenStream : TokenStream
 		{
-            private LinkedList<AttributeSource.State> cachedStates = new LinkedList<AttributeSource.State>();
-			private AttributeSource.State finalState;
+            private readonly LinkedList<State> cachedStates = new LinkedList<State>();
+			private State finalState;
 			private IEnumerator<AttributeSource.State> it = null;
-			private SinkFilter filter;
+			private readonly SinkFilter filter;
 
 			internal SinkTokenStream(AttributeSource source, SinkFilter filter)
                 : base(source)
@@ -233,7 +233,7 @@ namespace Lucene.Net.Analysis
 					return false;
 				}
 				
-				AttributeSource.State state = it.Current;
+				State state = it.Current;
 				RestoreState(state);
 				return true;
 			}

Modified: incubator/lucene.net/trunk/src/core/Analysis/Token.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Analysis/Token.cs?rev=1353237&r1=1353236&r2=1353237&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Analysis/Token.cs (original)
+++ incubator/lucene.net/trunk/src/core/Analysis/Token.cs Sun Jun 24 09:54:14 2012
@@ -117,11 +117,11 @@ namespace Lucene.Net.Analysis
 	[Serializable]
 	public class Token : Attribute, ITermAttribute, ITypeAttribute, IPositionIncrementAttribute, IFlagsAttribute, IOffsetAttribute, IPayloadAttribute
 	{
-		public const System.String DEFAULT_TYPE = "word";
-		
-		private static int MIN_BUFFER_SIZE = 10;
+		public const String DEFAULT_TYPE = "word";
+
+		private const int MIN_BUFFER_SIZE = 10;
 
-        private char[] termBuffer;
+		private char[] termBuffer;
 		private int termLength;
 		private int startOffset, endOffset;
 		private string type = DEFAULT_TYPE;
@@ -151,7 +151,7 @@ namespace Lucene.Net.Analysis
 		/// <param name="start">start offset in the source text</param>
 		/// <param name="end">end offset in the source text</param>
 		/// <param name="typ">the lexical type of this Token</param>
-		public Token(int start, int end, System.String typ)
+		public Token(int start, int end, String typ)
 		{
 			startOffset = start;
 			endOffset = end;
@@ -180,7 +180,7 @@ namespace Lucene.Net.Analysis
 		/// <param name="text">term text</param>
 		/// <param name="start">start offset</param>
 		/// <param name="end">end offset</param>
-		public Token(System.String text, int start, int end)
+		public Token(String text, int start, int end)
 		{
 		    SetTermBuffer(text);
 			startOffset = start;
@@ -370,7 +370,7 @@ namespace Lucene.Net.Analysis
 				{
 					// Not big enough; create a new array with slight
 					// over allocation and preserve content
-					char[] newCharBuffer = new char[ArrayUtil.GetNextSize(newSize)];
+					var newCharBuffer = new char[ArrayUtil.GetNextSize(newSize)];
 					Array.Copy(termBuffer, 0, newCharBuffer, 0, termBuffer.Length);
 					termBuffer = newCharBuffer;
 				}
@@ -485,19 +485,19 @@ namespace Lucene.Net.Analysis
 	    public virtual int Flags
 	    {
 	        get { return flags; }
-	        set { this.flags = value; }
+	        set { flags = value; }
 	    }
 
 	    /// <summary> Returns this Token's payload.</summary>
 	    public virtual Payload Payload
 	    {
-	        get { return this.payload; }
-	        set { this.payload = value; }
+	        get { return payload; }
+	        set { payload = value; }
 	    }
 
-	    public override System.String ToString()
+	    public override String ToString()
 		{
-			System.Text.StringBuilder sb = new System.Text.StringBuilder();
+			var sb = new System.Text.StringBuilder();
 			sb.Append('(');
 			InitTermBuffer();
 			if (termBuffer == null)
@@ -529,7 +529,7 @@ namespace Lucene.Net.Analysis
 		
 		public override System.Object Clone()
 		{
-			Token t = (Token) base.Clone();
+			var t = (Token) base.Clone();
 			// Do a deep clone
 			if (termBuffer != null)
 			{
@@ -551,49 +551,44 @@ namespace Lucene.Net.Analysis
 		/// </summary>
 		public virtual Token Clone(char[] newTermBuffer, int newTermOffset, int newTermLength, int newStartOffset, int newEndOffset)
 		{
-			Token t = new Token(newTermBuffer, newTermOffset, newTermLength, newStartOffset, newEndOffset);
-			t.positionIncrement = positionIncrement;
-			t.flags = flags;
-			t.type = type;
+			var t = new Token(newTermBuffer, newTermOffset, newTermLength, newStartOffset, newEndOffset)
+			        	{positionIncrement = positionIncrement, flags = flags, type = type};
 			if (payload != null)
 				t.payload = (Payload) payload.Clone();
 			return t;
 		}
 		
-		public  override bool Equals(System.Object obj)
+		public  override bool Equals(Object obj)
 		{
 			if (obj == this)
 				return true;
+
+			var other = obj as Token;
+			if (other == null)
+				return false;
 			
-			if (obj is Token)
+			InitTermBuffer();
+			other.InitTermBuffer();
+
+			if (termLength == other.termLength && startOffset == other.startOffset && endOffset == other.endOffset &&
+			    flags == other.flags && positionIncrement == other.positionIncrement && SubEqual(type, other.type) &&
+			    SubEqual(payload, other.payload))
 			{
-				Token other = (Token) obj;
-				
-				InitTermBuffer();
-				other.InitTermBuffer();
-				
-				if (termLength == other.termLength && startOffset == other.startOffset && endOffset == other.endOffset && flags == other.flags && positionIncrement == other.positionIncrement && SubEqual(type, other.type) && SubEqual(payload, other.payload))
-				{
-					for (int i = 0; i < termLength; i++)
-						if (termBuffer[i] != other.termBuffer[i])
-							return false;
-					return true;
-				}
-				else
-					return false;
+				for (int i = 0; i < termLength; i++)
+					if (termBuffer[i] != other.termBuffer[i])
+						return false;
+				return true;
 			}
-			else
-				return false;
+			return false;
 		}
 		
 		private bool SubEqual(System.Object o1, System.Object o2)
 		{
 			if (o1 == null)
 				return o2 == null;
-			else
-				return o1.Equals(o2);
+			return o1.Equals(o2);
 		}
-		
+
 		public override int GetHashCode()
 		{
 			InitTermBuffer();
@@ -783,7 +778,7 @@ namespace Lucene.Net.Analysis
 		{
 			if (target is Token)
 			{
-				Token to = (Token) target;
+				var to = (Token) target;
 				to.Reinit(this);
 				// reinit shares the payload, so clone it:
 				if (payload != null)
@@ -819,7 +814,7 @@ namespace Lucene.Net.Analysis
         public class TokenAttributeFactory : AttributeSource.AttributeFactory
         {
 
-            private AttributeSource.AttributeFactory _delegateFactory;
+            private readonly AttributeSource.AttributeFactory _delegateFactory;
 
             /// <summary>
             /// <b>Expert</b>: Creates an AttributeFactory returning {@link Token} as instance for the basic attributes
@@ -841,12 +836,8 @@ namespace Lucene.Net.Analysis
             {
                 if (this == other) return true;
 
-                if (other is TokenAttributeFactory)
-                {
-                    TokenAttributeFactory af = (TokenAttributeFactory)other;
-                    return this._delegateFactory.Equals(af._delegateFactory);
-                }
-                return false;
+            	var af = other as TokenAttributeFactory;
+            	return af != null && _delegateFactory.Equals(af._delegateFactory);
             }
 
             public override int GetHashCode()

Modified: incubator/lucene.net/trunk/src/core/Analysis/TokenFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Analysis/TokenFilter.cs?rev=1353237&r1=1353236&r2=1353237&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Analysis/TokenFilter.cs (original)
+++ incubator/lucene.net/trunk/src/core/Analysis/TokenFilter.cs Sun Jun 24 09:54:14 2012
@@ -15,8 +15,6 @@
  * limitations under the License.
  */
 
-using System;
-
 namespace Lucene.Net.Analysis
 {
 	

Modified: incubator/lucene.net/trunk/src/core/Analysis/Tokenizer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Analysis/Tokenizer.cs?rev=1353237&r1=1353236&r2=1353237&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Analysis/Tokenizer.cs (original)
+++ incubator/lucene.net/trunk/src/core/Analysis/Tokenizer.cs Sun Jun 24 09:54:14 2012
@@ -15,8 +15,6 @@
  * limitations under the License.
  */
 
-using System;
-
 using AttributeSource = Lucene.Net.Util.AttributeSource;
 
 namespace Lucene.Net.Analysis

Modified: incubator/lucene.net/trunk/src/core/Analysis/WhitespaceAnalyzer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Analysis/WhitespaceAnalyzer.cs?rev=1353237&r1=1353236&r2=1353237&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Analysis/WhitespaceAnalyzer.cs (original)
+++ incubator/lucene.net/trunk/src/core/Analysis/WhitespaceAnalyzer.cs Sun Jun 24 09:54:14 2012
@@ -15,8 +15,6 @@
  * limitations under the License.
  */
 
-using System;
-
 namespace Lucene.Net.Analysis
 {
 	
@@ -31,7 +29,7 @@ namespace Lucene.Net.Analysis
 		
 		public override TokenStream ReusableTokenStream(System.String fieldName, System.IO.TextReader reader)
 		{
-			Tokenizer tokenizer = (Tokenizer) PreviousTokenStream;
+			var tokenizer = (Tokenizer) PreviousTokenStream;
 			if (tokenizer == null)
 			{
 				tokenizer = new WhitespaceTokenizer(reader);

Modified: incubator/lucene.net/trunk/src/core/Analysis/WhitespaceTokenizer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Analysis/WhitespaceTokenizer.cs?rev=1353237&r1=1353236&r2=1353237&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Analysis/WhitespaceTokenizer.cs (original)
+++ incubator/lucene.net/trunk/src/core/Analysis/WhitespaceTokenizer.cs Sun Jun 24 09:54:14 2012
@@ -15,8 +15,6 @@
  * limitations under the License.
  */
 
-using System;
-
 using AttributeSource = Lucene.Net.Util.AttributeSource;
 
 namespace Lucene.Net.Analysis
@@ -29,17 +27,20 @@ namespace Lucene.Net.Analysis
 	public class WhitespaceTokenizer:CharTokenizer
 	{
 		/// <summary>Construct a new WhitespaceTokenizer. </summary>
-		public WhitespaceTokenizer(System.IO.TextReader in_Renamed):base(in_Renamed)
+		public WhitespaceTokenizer(System.IO.TextReader @in)
+			: base(@in)
 		{
 		}
 		
 		/// <summary>Construct a new WhitespaceTokenizer using a given <see cref="AttributeSource" />. </summary>
-		public WhitespaceTokenizer(AttributeSource source, System.IO.TextReader in_Renamed):base(source, in_Renamed)
+		public WhitespaceTokenizer(AttributeSource source, System.IO.TextReader @in)
+			: base(source, @in)
 		{
 		}
 		
 		/// <summary>Construct a new WhitespaceTokenizer using a given <see cref="Lucene.Net.Util.AttributeSource.AttributeFactory" />. </summary>
-		public WhitespaceTokenizer(AttributeFactory factory, System.IO.TextReader in_Renamed):base(factory, in_Renamed)
+		public WhitespaceTokenizer(AttributeFactory factory, System.IO.TextReader @in)
+			: base(factory, @in)
 		{
 		}
 		



Mime
View raw message