lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ccurr...@apache.org
Subject [34/51] [partial] Mass convert mixed tabs to spaces
Date Wed, 03 Apr 2013 17:40:17 GMT
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Snowball/SF/Snowball/Ext/SwedishStemmer.cs
----------------------------------------------------------------------
diff --git a/src/contrib/Snowball/SF/Snowball/Ext/SwedishStemmer.cs b/src/contrib/Snowball/SF/Snowball/Ext/SwedishStemmer.cs
index c47fd36..03f53fc 100644
--- a/src/contrib/Snowball/SF/Snowball/Ext/SwedishStemmer.cs
+++ b/src/contrib/Snowball/SF/Snowball/Ext/SwedishStemmer.cs
@@ -23,336 +23,336 @@ namespace SF.Snowball.Ext
 {
 #pragma warning disable 162,164
 
-	/// <summary> Generated class implementing code defined by a snowball script.</summary>
-	public class SwedishStemmer : SnowballProgram
-	{
-		public SwedishStemmer()
-		{
-			InitBlock();
-		}
-		private void  InitBlock()
-		{
-			a_0 = new Among[]{new Among("a", - 1, 1, "", this), new Among("arna", 0, 1, "", this), new Among("erna", 0, 1, "", this), new Among("heterna", 2, 1, "", this), new Among("orna", 0, 1, "", this), new Among("ad", - 1, 1, "", this), new Among("e", - 1, 1, "", this), new Among("ade", 6, 1, "", this), new Among("ande", 6, 1, "", this), new Among("arne", 6, 1, "", this), new Among("are", 6, 1, "", this), new Among("aste", 6, 1, "", this), new Among("en", - 1, 1, "", this), new Among("anden", 12, 1, "", this), new Among("aren", 12, 1, "", this), new Among("heten", 12, 1, "", this), new Among("ern", - 1, 1, "", this), new Among("ar", - 1, 1, "", this), new Among("er", - 1, 1, "", this), new Among("heter", 18, 1, "", this), new Among("or", - 1, 1, "", this), new Among("s", - 1, 2, "", this), new Among("as", 21, 1, "", this), new Among("arnas", 22, 1, "", this), new Among("ernas", 22, 1, "", this), new Among("ornas", 22, 1, "", this), new Among("es", 21, 1, "", this), new Among("ades", 26,
  1, "", this), new Among("andes", 26, 1, "", this), new Among("ens", 21, 1, "", this), new Among("arens", 29, 1, "", this), new Among("hetens", 29, 1, "", this), new Among("erns", 21, 1, "", this), new Among("at", - 1, 1, "", this), new Among("andet", - 1, 1, "", this), new Among("het", - 1, 1, "", this), new Among("ast", - 1, 1, "", this)};
-			a_1 = new Among[]{new Among("dd", - 1, - 1, "", this), new Among("gd", - 1, - 1, "", this), new Among("nn", - 1, - 1, "", this), new Among("dt", - 1, - 1, "", this), new Among("gt", - 1, - 1, "", this), new Among("kt", - 1, - 1, "", this), new Among("tt", - 1, - 1, "", this)};
-			a_2 = new Among[]{new Among("ig", - 1, 1, "", this), new Among("lig", 0, 1, "", this), new Among("els", - 1, 1, "", this), new Among("fullt", - 1, 3, "", this), new Among("l\u00F6st", - 1, 2, "", this)};
-		}
-		
-		private Among[] a_0;
-		private Among[] a_1;
-		private Among[] a_2;
-		private static readonly char[] g_v = new char[]{(char) (17), (char) (65), (char) (16), (char) (1), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (24), (char) (0), (char) (32)};
-		private static readonly char[] g_s_ending = new char[]{(char) (119), (char) (127), (char) (149)};
-		
-		private int I_p1;
-		
-		protected internal virtual void  copy_from(SwedishStemmer other)
-		{
-			I_p1 = other.I_p1;
-			base.copy_from(other);
-		}
-		
-		private bool r_mark_regions()
-		{
-			int v_1;
-			// (, line 26
-			I_p1 = limit;
-			// goto, line 30
-			while (true)
-			{
-				v_1 = cursor;
-				do 
-				{
-					if (!(in_grouping(g_v, 97, 246)))
-					{
-						goto lab1_brk;
-					}
-					cursor = v_1;
-					goto golab0_brk;
-				}
-				while (false);
+    /// <summary> Generated class implementing code defined by a snowball script.</summary>
+    public class SwedishStemmer : SnowballProgram
+    {
+        public SwedishStemmer()
+        {
+            InitBlock();
+        }
+        private void  InitBlock()
+        {
+            a_0 = new Among[]{new Among("a", - 1, 1, "", this), new Among("arna", 0, 1, "", this), new Among("erna", 0, 1, "", this), new Among("heterna", 2, 1, "", this), new Among("orna", 0, 1, "", this), new Among("ad", - 1, 1, "", this), new Among("e", - 1, 1, "", this), new Among("ade", 6, 1, "", this), new Among("ande", 6, 1, "", this), new Among("arne", 6, 1, "", this), new Among("are", 6, 1, "", this), new Among("aste", 6, 1, "", this), new Among("en", - 1, 1, "", this), new Among("anden", 12, 1, "", this), new Among("aren", 12, 1, "", this), new Among("heten", 12, 1, "", this), new Among("ern", - 1, 1, "", this), new Among("ar", - 1, 1, "", this), new Among("er", - 1, 1, "", this), new Among("heter", 18, 1, "", this), new Among("or", - 1, 1, "", this), new Among("s", - 1, 2, "", this), new Among("as", 21, 1, "", this), new Among("arnas", 22, 1, "", this), new Among("ernas", 22, 1, "", this), new Among("ornas", 22, 1, "", this), new Among("es", 21, 1, "", this), new Among("a
 des", 26, 1, "", this), new Among("andes", 26, 1, "", this), new Among("ens", 21, 1, "", this), new Among("arens", 29, 1, "", this), new Among("hetens", 29, 1, "", this), new Among("erns", 21, 1, "", this), new Among("at", - 1, 1, "", this), new Among("andet", - 1, 1, "", this), new Among("het", - 1, 1, "", this), new Among("ast", - 1, 1, "", this)};
+            a_1 = new Among[]{new Among("dd", - 1, - 1, "", this), new Among("gd", - 1, - 1, "", this), new Among("nn", - 1, - 1, "", this), new Among("dt", - 1, - 1, "", this), new Among("gt", - 1, - 1, "", this), new Among("kt", - 1, - 1, "", this), new Among("tt", - 1, - 1, "", this)};
+            a_2 = new Among[]{new Among("ig", - 1, 1, "", this), new Among("lig", 0, 1, "", this), new Among("els", - 1, 1, "", this), new Among("fullt", - 1, 3, "", this), new Among("l\u00F6st", - 1, 2, "", this)};
+        }
+        
+        private Among[] a_0;
+        private Among[] a_1;
+        private Among[] a_2;
+        private static readonly char[] g_v = new char[]{(char) (17), (char) (65), (char) (16), (char) (1), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (0), (char) (24), (char) (0), (char) (32)};
+        private static readonly char[] g_s_ending = new char[]{(char) (119), (char) (127), (char) (149)};
+        
+        private int I_p1;
+        
+        protected internal virtual void  copy_from(SwedishStemmer other)
+        {
+            I_p1 = other.I_p1;
+            base.copy_from(other);
+        }
+        
+        private bool r_mark_regions()
+        {
+            int v_1;
+            // (, line 26
+            I_p1 = limit;
+            // goto, line 30
+            while (true)
+            {
+                v_1 = cursor;
+                do 
+                {
+                    if (!(in_grouping(g_v, 97, 246)))
+                    {
+                        goto lab1_brk;
+                    }
+                    cursor = v_1;
+                    goto golab0_brk;
+                }
+                while (false);
 
 lab1_brk: ;
-				
-				cursor = v_1;
-				if (cursor >= limit)
-				{
-					return false;
-				}
-				cursor++;
-			}
+                
+                cursor = v_1;
+                if (cursor >= limit)
+                {
+                    return false;
+                }
+                cursor++;
+            }
 
 golab0_brk: ;
-			
-			// gopast, line 30
-			while (true)
-			{
-				do 
-				{
-					if (!(out_grouping(g_v, 97, 246)))
-					{
-						goto lab3_brk;
-					}
-					goto golab2_brk;
-				}
-				while (false);
+            
+            // gopast, line 30
+            while (true)
+            {
+                do 
+                {
+                    if (!(out_grouping(g_v, 97, 246)))
+                    {
+                        goto lab3_brk;
+                    }
+                    goto golab2_brk;
+                }
+                while (false);
 
 lab3_brk: ;
-				
-				if (cursor >= limit)
-				{
-					return false;
-				}
-				cursor++;
-			}
+                
+                if (cursor >= limit)
+                {
+                    return false;
+                }
+                cursor++;
+            }
 
 golab2_brk: ;
-			
-			// setmark p1, line 30
-			I_p1 = cursor;
-			// try, line 31
-			do 
-			{
-				// (, line 31
-				if (!(I_p1 < 3))
-				{
-					goto lab4_brk;
-				}
-				I_p1 = 3;
-			}
-			while (false);
+            
+            // setmark p1, line 30
+            I_p1 = cursor;
+            // try, line 31
+            do 
+            {
+                // (, line 31
+                if (!(I_p1 < 3))
+                {
+                    goto lab4_brk;
+                }
+                I_p1 = 3;
+            }
+            while (false);
 
 lab4_brk: ;
-			
-			return true;
-		}
-		
-		private bool r_main_suffix()
-		{
-			int among_var;
-			int v_1;
-			int v_2;
-			// (, line 36
-			// setlimit, line 37
-			v_1 = limit - cursor;
-			// tomark, line 37
-			if (cursor < I_p1)
-			{
-				return false;
-			}
-			cursor = I_p1;
-			v_2 = limit_backward;
-			limit_backward = cursor;
-			cursor = limit - v_1;
-			// (, line 37
-			// [, line 37
-			ket = cursor;
-			// substring, line 37
-			among_var = find_among_b(a_0, 37);
-			if (among_var == 0)
-			{
-				limit_backward = v_2;
-				return false;
-			}
-			// ], line 37
-			bra = cursor;
-			limit_backward = v_2;
-			switch (among_var)
-			{
-				
-				case 0: 
-					return false;
-				
-				case 1: 
-					// (, line 44
-					// delete, line 44
-					slice_del();
-					break;
-				
-				case 2: 
-					// (, line 46
-					if (!(in_grouping_b(g_s_ending, 98, 121)))
-					{
-						return false;
-					}
-					// delete, line 46
-					slice_del();
-					break;
-				}
-			return true;
-		}
-		
-		private bool r_consonant_pair()
-		{
-			int v_1;
-			int v_2;
-			int v_3;
-			// setlimit, line 50
-			v_1 = limit - cursor;
-			// tomark, line 50
-			if (cursor < I_p1)
-			{
-				return false;
-			}
-			cursor = I_p1;
-			v_2 = limit_backward;
-			limit_backward = cursor;
-			cursor = limit - v_1;
-			// (, line 50
-			// and, line 52
-			v_3 = limit - cursor;
-			// among, line 51
-			if (find_among_b(a_1, 7) == 0)
-			{
-				limit_backward = v_2;
-				return false;
-			}
-			cursor = limit - v_3;
-			// (, line 52
-			// [, line 52
-			ket = cursor;
-			// next, line 52
-			if (cursor <= limit_backward)
-			{
-				limit_backward = v_2;
-				return false;
-			}
-			cursor--;
-			// ], line 52
-			bra = cursor;
-			// delete, line 52
-			slice_del();
-			limit_backward = v_2;
-			return true;
-		}
-		
-		private bool r_other_suffix()
-		{
-			int among_var;
-			int v_1;
-			int v_2;
-			// setlimit, line 55
-			v_1 = limit - cursor;
-			// tomark, line 55
-			if (cursor < I_p1)
-			{
-				return false;
-			}
-			cursor = I_p1;
-			v_2 = limit_backward;
-			limit_backward = cursor;
-			cursor = limit - v_1;
-			// (, line 55
-			// [, line 56
-			ket = cursor;
-			// substring, line 56
-			among_var = find_among_b(a_2, 5);
-			if (among_var == 0)
-			{
-				limit_backward = v_2;
-				return false;
-			}
-			// ], line 56
-			bra = cursor;
-			switch (among_var)
-			{
-				
-				case 0: 
-					limit_backward = v_2;
-					return false;
-				
-				case 1: 
-					// (, line 57
-					// delete, line 57
-					slice_del();
-					break;
-				
-				case 2: 
-					// (, line 58
-					// <-, line 58
-					slice_from("l\u00F6s");
-					break;
-				
-				case 3: 
-					// (, line 59
-					// <-, line 59
-					slice_from("full");
-					break;
-				}
-			limit_backward = v_2;
-			return true;
-		}
-		
-		public override bool Stem()
-		{
-			int v_1;
-			int v_2;
-			int v_3;
-			int v_4;
-			// (, line 64
-			// do, line 66
-			v_1 = cursor;
-			do 
-			{
-				// call mark_regions, line 66
-				if (!r_mark_regions())
-				{
-					goto lab0_brk;
-				}
-			}
-			while (false);
+            
+            return true;
+        }
+        
+        private bool r_main_suffix()
+        {
+            int among_var;
+            int v_1;
+            int v_2;
+            // (, line 36
+            // setlimit, line 37
+            v_1 = limit - cursor;
+            // tomark, line 37
+            if (cursor < I_p1)
+            {
+                return false;
+            }
+            cursor = I_p1;
+            v_2 = limit_backward;
+            limit_backward = cursor;
+            cursor = limit - v_1;
+            // (, line 37
+            // [, line 37
+            ket = cursor;
+            // substring, line 37
+            among_var = find_among_b(a_0, 37);
+            if (among_var == 0)
+            {
+                limit_backward = v_2;
+                return false;
+            }
+            // ], line 37
+            bra = cursor;
+            limit_backward = v_2;
+            switch (among_var)
+            {
+                
+                case 0: 
+                    return false;
+                
+                case 1: 
+                    // (, line 44
+                    // delete, line 44
+                    slice_del();
+                    break;
+                
+                case 2: 
+                    // (, line 46
+                    if (!(in_grouping_b(g_s_ending, 98, 121)))
+                    {
+                        return false;
+                    }
+                    // delete, line 46
+                    slice_del();
+                    break;
+                }
+            return true;
+        }
+        
+        private bool r_consonant_pair()
+        {
+            int v_1;
+            int v_2;
+            int v_3;
+            // setlimit, line 50
+            v_1 = limit - cursor;
+            // tomark, line 50
+            if (cursor < I_p1)
+            {
+                return false;
+            }
+            cursor = I_p1;
+            v_2 = limit_backward;
+            limit_backward = cursor;
+            cursor = limit - v_1;
+            // (, line 50
+            // and, line 52
+            v_3 = limit - cursor;
+            // among, line 51
+            if (find_among_b(a_1, 7) == 0)
+            {
+                limit_backward = v_2;
+                return false;
+            }
+            cursor = limit - v_3;
+            // (, line 52
+            // [, line 52
+            ket = cursor;
+            // next, line 52
+            if (cursor <= limit_backward)
+            {
+                limit_backward = v_2;
+                return false;
+            }
+            cursor--;
+            // ], line 52
+            bra = cursor;
+            // delete, line 52
+            slice_del();
+            limit_backward = v_2;
+            return true;
+        }
+        
+        private bool r_other_suffix()
+        {
+            int among_var;
+            int v_1;
+            int v_2;
+            // setlimit, line 55
+            v_1 = limit - cursor;
+            // tomark, line 55
+            if (cursor < I_p1)
+            {
+                return false;
+            }
+            cursor = I_p1;
+            v_2 = limit_backward;
+            limit_backward = cursor;
+            cursor = limit - v_1;
+            // (, line 55
+            // [, line 56
+            ket = cursor;
+            // substring, line 56
+            among_var = find_among_b(a_2, 5);
+            if (among_var == 0)
+            {
+                limit_backward = v_2;
+                return false;
+            }
+            // ], line 56
+            bra = cursor;
+            switch (among_var)
+            {
+                
+                case 0: 
+                    limit_backward = v_2;
+                    return false;
+                
+                case 1: 
+                    // (, line 57
+                    // delete, line 57
+                    slice_del();
+                    break;
+                
+                case 2: 
+                    // (, line 58
+                    // <-, line 58
+                    slice_from("l\u00F6s");
+                    break;
+                
+                case 3: 
+                    // (, line 59
+                    // <-, line 59
+                    slice_from("full");
+                    break;
+                }
+            limit_backward = v_2;
+            return true;
+        }
+        
+        public override bool Stem()
+        {
+            int v_1;
+            int v_2;
+            int v_3;
+            int v_4;
+            // (, line 64
+            // do, line 66
+            v_1 = cursor;
+            do 
+            {
+                // call mark_regions, line 66
+                if (!r_mark_regions())
+                {
+                    goto lab0_brk;
+                }
+            }
+            while (false);
 
 lab0_brk: ;
-			
-			cursor = v_1;
-			// backwards, line 67
-			limit_backward = cursor; cursor = limit;
-			// (, line 67
-			// do, line 68
-			v_2 = limit - cursor;
-			do 
-			{
-				// call main_suffix, line 68
-				if (!r_main_suffix())
-				{
-					goto lab1_brk;
-				}
-			}
-			while (false);
+            
+            cursor = v_1;
+            // backwards, line 67
+            limit_backward = cursor; cursor = limit;
+            // (, line 67
+            // do, line 68
+            v_2 = limit - cursor;
+            do 
+            {
+                // call main_suffix, line 68
+                if (!r_main_suffix())
+                {
+                    goto lab1_brk;
+                }
+            }
+            while (false);
 
 lab1_brk: ;
-			
-			cursor = limit - v_2;
-			// do, line 69
-			v_3 = limit - cursor;
-			do 
-			{
-				// call consonant_pair, line 69
-				if (!r_consonant_pair())
-				{
-					goto lab2_brk;
-				}
-			}
-			while (false);
+            
+            cursor = limit - v_2;
+            // do, line 69
+            v_3 = limit - cursor;
+            do 
+            {
+                // call consonant_pair, line 69
+                if (!r_consonant_pair())
+                {
+                    goto lab2_brk;
+                }
+            }
+            while (false);
 
 lab2_brk: ;
-			
-			cursor = limit - v_3;
-			// do, line 70
-			v_4 = limit - cursor;
-			do 
-			{
-				// call other_suffix, line 70
-				if (!r_other_suffix())
-				{
-					goto lab3_brk;
-				}
-			}
-			while (false);
+            
+            cursor = limit - v_3;
+            // do, line 70
+            v_4 = limit - cursor;
+            do 
+            {
+                // call other_suffix, line 70
+                if (!r_other_suffix())
+                {
+                    goto lab3_brk;
+                }
+            }
+            while (false);
 
 lab3_brk: ;
-			
-			cursor = limit - v_4;
-			cursor = limit_backward; return true;
-		}
-	}
+            
+            cursor = limit - v_4;
+            cursor = limit_backward; return true;
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Snowball/SF/Snowball/Ext/TurkishStemmer.cs
----------------------------------------------------------------------
diff --git a/src/contrib/Snowball/SF/Snowball/Ext/TurkishStemmer.cs b/src/contrib/Snowball/SF/Snowball/Ext/TurkishStemmer.cs
index 403647f..29a0d26 100644
--- a/src/contrib/Snowball/SF/Snowball/Ext/TurkishStemmer.cs
+++ b/src/contrib/Snowball/SF/Snowball/Ext/TurkishStemmer.cs
@@ -56,205 +56,205 @@ using Among = SF.Snowball.Among;
 using SnowballProgram = SF.Snowball.SnowballProgram;
 namespace SF.Snowball.Ext
 {
-    	/* Generated class implementing code defined by a snowball script.
-	*
-	*/
+        /* Generated class implementing code defined by a snowball script.
+    *
+    */
     public class TurkishStemmer : SnowballProgram
     {
 
         public TurkishStemmer()
         {
             a_0 = new Among[] {
-				new Among("m", -1, -1, "", null),
-				new Among("n", -1, -1, "", null),
-				new Among("miz", -1, -1, "", null),
-				new Among("niz", -1, -1, "", null),
-				new Among("muz", -1, -1, "", null),
-				new Among("nuz", -1, -1, "", null),
-				new Among("m\u00FCz", -1, -1, "", null),
-				new Among("n\u00FCz", -1, -1, "", null),
-				new Among("m\u0131z", -1, -1, "", null),
-				new Among("n\u0131z", -1, -1, "", null)
-			};
+                new Among("m", -1, -1, "", null),
+                new Among("n", -1, -1, "", null),
+                new Among("miz", -1, -1, "", null),
+                new Among("niz", -1, -1, "", null),
+                new Among("muz", -1, -1, "", null),
+                new Among("nuz", -1, -1, "", null),
+                new Among("m\u00FCz", -1, -1, "", null),
+                new Among("n\u00FCz", -1, -1, "", null),
+                new Among("m\u0131z", -1, -1, "", null),
+                new Among("n\u0131z", -1, -1, "", null)
+            };
 
             a_1 = new Among[] {
-				new Among("leri", -1, -1, "", null),
-				new Among("lar\u0131", -1, -1, "", null)
-			};
+                new Among("leri", -1, -1, "", null),
+                new Among("lar\u0131", -1, -1, "", null)
+            };
 
             a_2 = new Among[] {
-				new Among("ni", -1, -1, "", null),
-				new Among("nu", -1, -1, "", null),
-				new Among("n\u00FC", -1, -1, "", null),
-				new Among("n\u0131", -1, -1, "", null)
-			};
+                new Among("ni", -1, -1, "", null),
+                new Among("nu", -1, -1, "", null),
+                new Among("n\u00FC", -1, -1, "", null),
+                new Among("n\u0131", -1, -1, "", null)
+            };
 
             a_3 = new Among[] {
-				new Among("in", -1, -1, "", null),
-				new Among("un", -1, -1, "", null),
-				new Among("\u00FCn", -1, -1, "", null),
-				new Among("\u0131n", -1, -1, "", null)
-			};
+                new Among("in", -1, -1, "", null),
+                new Among("un", -1, -1, "", null),
+                new Among("\u00FCn", -1, -1, "", null),
+                new Among("\u0131n", -1, -1, "", null)
+            };
 
             a_4 = new Among[] {
-				new Among("a", -1, -1, "", null),
-				new Among("e", -1, -1, "", null)
-			};
+                new Among("a", -1, -1, "", null),
+                new Among("e", -1, -1, "", null)
+            };
 
             a_5 = new Among[] {
-				new Among("na", -1, -1, "", null),
-				new Among("ne", -1, -1, "", null)
-			};
+                new Among("na", -1, -1, "", null),
+                new Among("ne", -1, -1, "", null)
+            };
 
             a_6 = new Among[] {
-				new Among("da", -1, -1, "", null),
-				new Among("ta", -1, -1, "", null),
-				new Among("de", -1, -1, "", null),
-				new Among("te", -1, -1, "", null)
-			};
+                new Among("da", -1, -1, "", null),
+                new Among("ta", -1, -1, "", null),
+                new Among("de", -1, -1, "", null),
+                new Among("te", -1, -1, "", null)
+            };
 
             a_7 = new Among[] {
-				new Among("nda", -1, -1, "", null),
-				new Among("nde", -1, -1, "", null)
-			};
+                new Among("nda", -1, -1, "", null),
+                new Among("nde", -1, -1, "", null)
+            };
 
             a_8 = new Among[] {
-				new Among("dan", -1, -1, "", null),
-				new Among("tan", -1, -1, "", null),
-				new Among("den", -1, -1, "", null),
-				new Among("ten", -1, -1, "", null)
-			};
+                new Among("dan", -1, -1, "", null),
+                new Among("tan", -1, -1, "", null),
+                new Among("den", -1, -1, "", null),
+                new Among("ten", -1, -1, "", null)
+            };
 
             a_9 = new Among[] {
-				new Among("ndan", -1, -1, "", null),
-				new Among("nden", -1, -1, "", null)
-			};
+                new Among("ndan", -1, -1, "", null),
+                new Among("nden", -1, -1, "", null)
+            };
 
             a_10 = new Among[] {
-				new Among("la", -1, -1, "", null),
-				new Among("le", -1, -1, "", null)
-			};
+                new Among("la", -1, -1, "", null),
+                new Among("le", -1, -1, "", null)
+            };
 
             a_11 = new Among[] {
-				new Among("ca", -1, -1, "", null),
-				new Among("ce", -1, -1, "", null)
-			};
+                new Among("ca", -1, -1, "", null),
+                new Among("ce", -1, -1, "", null)
+            };
 
             a_12 = new Among[] {
-				new Among("im", -1, -1, "", null),
-				new Among("um", -1, -1, "", null),
-				new Among("\u00FCm", -1, -1, "", null),
-				new Among("\u0131m", -1, -1, "", null)
-			};
+                new Among("im", -1, -1, "", null),
+                new Among("um", -1, -1, "", null),
+                new Among("\u00FCm", -1, -1, "", null),
+                new Among("\u0131m", -1, -1, "", null)
+            };
 
             a_13 = new Among[] {
-				new Among("sin", -1, -1, "", null),
-				new Among("sun", -1, -1, "", null),
-				new Among("s\u00FCn", -1, -1, "", null),
-				new Among("s\u0131n", -1, -1, "", null)
-			};
+                new Among("sin", -1, -1, "", null),
+                new Among("sun", -1, -1, "", null),
+                new Among("s\u00FCn", -1, -1, "", null),
+                new Among("s\u0131n", -1, -1, "", null)
+            };
 
             a_14 = new Among[] {
-				new Among("iz", -1, -1, "", null),
-				new Among("uz", -1, -1, "", null),
-				new Among("\u00FCz", -1, -1, "", null),
-				new Among("\u0131z", -1, -1, "", null)
-			};
+                new Among("iz", -1, -1, "", null),
+                new Among("uz", -1, -1, "", null),
+                new Among("\u00FCz", -1, -1, "", null),
+                new Among("\u0131z", -1, -1, "", null)
+            };
 
             a_15 = new Among[] {
-				new Among("siniz", -1, -1, "", null),
-				new Among("sunuz", -1, -1, "", null),
-				new Among("s\u00FCn\u00FCz", -1, -1, "", null),
-				new Among("s\u0131n\u0131z", -1, -1, "", null)
-			};
+                new Among("siniz", -1, -1, "", null),
+                new Among("sunuz", -1, -1, "", null),
+                new Among("s\u00FCn\u00FCz", -1, -1, "", null),
+                new Among("s\u0131n\u0131z", -1, -1, "", null)
+            };
 
             a_16 = new Among[] {
-				new Among("lar", -1, -1, "", null),
-				new Among("ler", -1, -1, "", null)
-			};
+                new Among("lar", -1, -1, "", null),
+                new Among("ler", -1, -1, "", null)
+            };
 
             a_17 = new Among[] {
-				new Among("niz", -1, -1, "", null),
-				new Among("nuz", -1, -1, "", null),
-				new Among("n\u00FCz", -1, -1, "", null),
-				new Among("n\u0131z", -1, -1, "", null)
-			};
+                new Among("niz", -1, -1, "", null),
+                new Among("nuz", -1, -1, "", null),
+                new Among("n\u00FCz", -1, -1, "", null),
+                new Among("n\u0131z", -1, -1, "", null)
+            };
 
             a_18 = new Among[] {
-				new Among("dir", -1, -1, "", null),
-				new Among("tir", -1, -1, "", null),
-				new Among("dur", -1, -1, "", null),
-				new Among("tur", -1, -1, "", null),
-				new Among("d\u00FCr", -1, -1, "", null),
-				new Among("t\u00FCr", -1, -1, "", null),
-				new Among("d\u0131r", -1, -1, "", null),
-				new Among("t\u0131r", -1, -1, "", null)
-			};
+                new Among("dir", -1, -1, "", null),
+                new Among("tir", -1, -1, "", null),
+                new Among("dur", -1, -1, "", null),
+                new Among("tur", -1, -1, "", null),
+                new Among("d\u00FCr", -1, -1, "", null),
+                new Among("t\u00FCr", -1, -1, "", null),
+                new Among("d\u0131r", -1, -1, "", null),
+                new Among("t\u0131r", -1, -1, "", null)
+            };
 
             a_19 = new Among[] {
-				new Among("cas\u0131na", -1, -1, "", null),
-				new Among("cesine", -1, -1, "", null)
-			};
+                new Among("cas\u0131na", -1, -1, "", null),
+                new Among("cesine", -1, -1, "", null)
+            };
 
             a_20 = new Among[] {
-				new Among("di", -1, -1, "", null),
-				new Among("ti", -1, -1, "", null),
-				new Among("dik", -1, -1, "", null),
-				new Among("tik", -1, -1, "", null),
-				new Among("duk", -1, -1, "", null),
-				new Among("tuk", -1, -1, "", null),
-				new Among("d\u00FCk", -1, -1, "", null),
-				new Among("t\u00FCk", -1, -1, "", null),
-				new Among("d\u0131k", -1, -1, "", null),
-				new Among("t\u0131k", -1, -1, "", null),
-				new Among("dim", -1, -1, "", null),
-				new Among("tim", -1, -1, "", null),
-				new Among("dum", -1, -1, "", null),
-				new Among("tum", -1, -1, "", null),
-				new Among("d\u00FCm", -1, -1, "", null),
-				new Among("t\u00FCm", -1, -1, "", null),
-				new Among("d\u0131m", -1, -1, "", null),
-				new Among("t\u0131m", -1, -1, "", null),
-				new Among("din", -1, -1, "", null),
-				new Among("tin", -1, -1, "", null),
-				new Among("dun", -1, -1, "", null),
-				new Among("tun", -1, -1, "", null),
-				new Among("d\u00FCn", -1, -1, "", null),
-				new Among("t\u00FCn", -1, -1, "", null),
-				new Among("d\u0131n", -1, -1, "", null),
-				new Among("t\u0131n", -1, -1, "", null),
-				new Among("du", -1, -1, "", null),
-				new Among("tu", -1, -1, "", null),
-				new Among("d\u00FC", -1, -1, "", null),
-				new Among("t\u00FC", -1, -1, "", null),
-				new Among("d\u0131", -1, -1, "", null),
-				new Among("t\u0131", -1, -1, "", null)
-			};
+                new Among("di", -1, -1, "", null),
+                new Among("ti", -1, -1, "", null),
+                new Among("dik", -1, -1, "", null),
+                new Among("tik", -1, -1, "", null),
+                new Among("duk", -1, -1, "", null),
+                new Among("tuk", -1, -1, "", null),
+                new Among("d\u00FCk", -1, -1, "", null),
+                new Among("t\u00FCk", -1, -1, "", null),
+                new Among("d\u0131k", -1, -1, "", null),
+                new Among("t\u0131k", -1, -1, "", null),
+                new Among("dim", -1, -1, "", null),
+                new Among("tim", -1, -1, "", null),
+                new Among("dum", -1, -1, "", null),
+                new Among("tum", -1, -1, "", null),
+                new Among("d\u00FCm", -1, -1, "", null),
+                new Among("t\u00FCm", -1, -1, "", null),
+                new Among("d\u0131m", -1, -1, "", null),
+                new Among("t\u0131m", -1, -1, "", null),
+                new Among("din", -1, -1, "", null),
+                new Among("tin", -1, -1, "", null),
+                new Among("dun", -1, -1, "", null),
+                new Among("tun", -1, -1, "", null),
+                new Among("d\u00FCn", -1, -1, "", null),
+                new Among("t\u00FCn", -1, -1, "", null),
+                new Among("d\u0131n", -1, -1, "", null),
+                new Among("t\u0131n", -1, -1, "", null),
+                new Among("du", -1, -1, "", null),
+                new Among("tu", -1, -1, "", null),
+                new Among("d\u00FC", -1, -1, "", null),
+                new Among("t\u00FC", -1, -1, "", null),
+                new Among("d\u0131", -1, -1, "", null),
+                new Among("t\u0131", -1, -1, "", null)
+            };
 
             a_21 = new Among[] {
-				new Among("sa", -1, -1, "", null),
-				new Among("se", -1, -1, "", null),
-				new Among("sak", -1, -1, "", null),
-				new Among("sek", -1, -1, "", null),
-				new Among("sam", -1, -1, "", null),
-				new Among("sem", -1, -1, "", null),
-				new Among("san", -1, -1, "", null),
-				new Among("sen", -1, -1, "", null)
-			};
+                new Among("sa", -1, -1, "", null),
+                new Among("se", -1, -1, "", null),
+                new Among("sak", -1, -1, "", null),
+                new Among("sek", -1, -1, "", null),
+                new Among("sam", -1, -1, "", null),
+                new Among("sem", -1, -1, "", null),
+                new Among("san", -1, -1, "", null),
+                new Among("sen", -1, -1, "", null)
+            };
 
             a_22 = new Among[] {
-				new Among("mi\u015F", -1, -1, "", null),
-				new Among("mu\u015F", -1, -1, "", null),
-				new Among("m\u00FC\u015F", -1, -1, "", null),
-				new Among("m\u0131\u015F", -1, -1, "", null)
-			};
+                new Among("mi\u015F", -1, -1, "", null),
+                new Among("mu\u015F", -1, -1, "", null),
+                new Among("m\u00FC\u015F", -1, -1, "", null),
+                new Among("m\u0131\u015F", -1, -1, "", null)
+            };
 
             a_23 = new Among[] {
-				new Among("b", -1, 1, "", null),
-				new Among("c", -1, 2, "", null),
-				new Among("d", -1, 3, "", null),
-				new Among("\u011F", -1, 4, "", null)
-			};
+                new Among("b", -1, 1, "", null),
+                new Among("c", -1, 2, "", null),
+                new Among("d", -1, 3, "", null),
+                new Among("\u011F", -1, 4, "", null)
+            };
 
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Snowball/SF/Snowball/SnowballProgram.cs
----------------------------------------------------------------------
diff --git a/src/contrib/Snowball/SF/Snowball/SnowballProgram.cs b/src/contrib/Snowball/SF/Snowball/SnowballProgram.cs
index e3b7fa1..b181dde 100644
--- a/src/contrib/Snowball/SF/Snowball/SnowballProgram.cs
+++ b/src/contrib/Snowball/SF/Snowball/SnowballProgram.cs
@@ -19,33 +19,33 @@ using System.Text;
 
 namespace SF.Snowball
 {
-	/// <summary>
-	/// This is the rev 500 of the snowball SVN trunk,
-	/// but modified:
-	/// made abstract and introduced abstract method stem to avoid expensive reflection in filter class
-	/// </summary>
-	public abstract class SnowballProgram
-	{
-		protected internal SnowballProgram()
-		{
-			current = new System.Text.StringBuilder();
-			SetCurrent("");
-		}
+    /// <summary>
+    /// This is the rev 500 of the snowball SVN trunk,
+    /// but modified:
+    /// made abstract and introduced abstract method stem to avoid expensive reflection in filter class
+    /// </summary>
+    public abstract class SnowballProgram
+    {
+        protected internal SnowballProgram()
+        {
+            current = new System.Text.StringBuilder();
+            SetCurrent("");
+        }
 
-	    public abstract bool Stem();
+        public abstract bool Stem();
 
-		/// <summary> Set the current string.</summary>
-		public virtual void  SetCurrent(System.String value)
-		{
-			//// current.Replace(current.ToString(0, current.Length - 0), value_Renamed, 0, current.Length - 0);
+        /// <summary> Set the current string.</summary>
+        public virtual void  SetCurrent(System.String value)
+        {
+            //// current.Replace(current.ToString(0, current.Length - 0), value_Renamed, 0, current.Length - 0);
             current.Remove(0, current.Length);
             current.Append(value);
-			cursor = 0;
-			limit = current.Length;
-			limit_backward = 0;
-			bra = cursor;
-			ket = limit;
-		}
+            cursor = 0;
+            limit = current.Length;
+            limit_backward = 0;
+            bra = cursor;
+            ket = limit;
+        }
 
         /// <summary> Get the current string.</summary>
         virtual public System.String GetCurrent()
@@ -61,458 +61,458 @@ namespace SF.Snowball
             return result;
         }
 
-		// current string
-		protected internal System.Text.StringBuilder current;
-		
-		protected internal int cursor;
-		protected internal int limit;
-		protected internal int limit_backward;
-		protected internal int bra;
-		protected internal int ket;
-		
-		protected internal virtual void  copy_from(SnowballProgram other)
-		{
-			current = other.current;
-			cursor = other.cursor;
-			limit = other.limit;
-			limit_backward = other.limit_backward;
-			bra = other.bra;
-			ket = other.ket;
-		}
-		
-		protected internal virtual bool in_grouping(char[] s, int min, int max)
-		{
-			if (cursor >= limit)
-				return false;
-			char ch = current[cursor];
-			if (ch > max || ch < min)
-				return false;
-			ch -= (char) (min);
-			if ((s[ch >> 3] & (0x1 << (ch & 0x7))) == 0)
-				return false;
-			cursor++;
-			return true;
-		}
-		
-		protected internal virtual bool in_grouping_b(char[] s, int min, int max)
-		{
-			if (cursor <= limit_backward)
-				return false;
-			char ch = current[cursor - 1];
-			if (ch > max || ch < min)
-				return false;
-			ch -= (char) (min);
-			if ((s[ch >> 3] & (0x1 << (ch & 0x7))) == 0)
-				return false;
-			cursor--;
-			return true;
-		}
-		
-		protected internal virtual bool out_grouping(char[] s, int min, int max)
-		{
-			if (cursor >= limit)
-				return false;
-			char ch = current[cursor];
-			if (ch > max || ch < min)
-			{
-				cursor++;
-				return true;
-			}
-			ch -= (char) (min);
-			if ((s[ch >> 3] & (0x1 << (ch & 0x7))) == 0)
-			{
-				cursor++;
-				return true;
-			}
-			return false;
-		}
-		
-		protected internal virtual bool out_grouping_b(char[] s, int min, int max)
-		{
-			if (cursor <= limit_backward)
-				return false;
-			char ch = current[cursor - 1];
-			if (ch > max || ch < min)
-			{
-				cursor--;
-				return true;
-			}
-			ch -= (char) (min);
-			if ((s[ch >> 3] & (0x1 << (ch & 0x7))) == 0)
-			{
-				cursor--;
-				return true;
-			}
-			return false;
-		}
-		
-		protected internal virtual bool in_range(int min, int max)
-		{
-			if (cursor >= limit)
-				return false;
-			char ch = current[cursor];
-			if (ch > max || ch < min)
-				return false;
-			cursor++;
-			return true;
-		}
-		
-		protected internal virtual bool in_range_b(int min, int max)
-		{
-			if (cursor <= limit_backward)
-				return false;
-			char ch = current[cursor - 1];
-			if (ch > max || ch < min)
-				return false;
-			cursor--;
-			return true;
-		}
-		
-		protected internal virtual bool out_range(int min, int max)
-		{
-			if (cursor >= limit)
-				return false;
-			char ch = current[cursor];
-			if (!(ch > max || ch < min))
-				return false;
-			cursor++;
-			return true;
-		}
-		
-		protected internal virtual bool out_range_b(int min, int max)
-		{
-			if (cursor <= limit_backward)
-				return false;
-			char ch = current[cursor - 1];
-			if (!(ch > max || ch < min))
-				return false;
-			cursor--;
-			return true;
-		}
-		
-		protected internal virtual bool eq_s(int s_size, System.String s)
-		{
-			if (limit - cursor < s_size)
-				return false;
-			int i;
-			for (i = 0; i != s_size; i++)
-			{
-				if (current[cursor + i] != s[i])
-					return false;
-			}
-			cursor += s_size;
-			return true;
-		}
-		
-		protected internal virtual bool eq_s_b(int s_size, System.String s)
-		{
-			if (cursor - limit_backward < s_size)
-				return false;
-			int i;
-			for (i = 0; i != s_size; i++)
-			{
-				if (current[cursor - s_size + i] != s[i])
-					return false;
-			}
-			cursor -= s_size;
-			return true;
-		}
-		
-		protected internal virtual bool eq_v(System.Text.StringBuilder s)
-		{
-			return eq_s(s.Length, s.ToString());
-		}
-		
-		protected internal virtual bool eq_v_b(System.Text.StringBuilder s)
-		{
-			return eq_s_b(s.Length, s.ToString());
-		}
-		
-		protected internal virtual int find_among(Among[] v, int v_size)
-		{
-			int i = 0;
-			int j = v_size;
-			
-			int c = cursor;
-			int l = limit;
-			
-			int common_i = 0;
-			int common_j = 0;
-			
-			bool first_key_inspected = false;
-			
-			while (true)
-			{
-				int k = i + ((j - i) >> 1);
-				int diff = 0;
-				int common = common_i < common_j?common_i:common_j; // smaller
-				Among w = v[k];
-				int i2;
-				for (i2 = common; i2 < w.s_size; i2++)
-				{
-					if (c + common == l)
-					{
-						diff = - 1;
-						break;
-					}
-					diff = current[c + common] - w.s[i2];
-					if (diff != 0)
-						break;
-					common++;
-				}
-				if (diff < 0)
-				{
-					j = k;
-					common_j = common;
-				}
-				else
-				{
-					i = k;
-					common_i = common;
-				}
-				if (j - i <= 1)
-				{
-					if (i > 0)
-						break; // v->s has been inspected
-					if (j == i)
-						break; // only one item in v
-					
-					// - but now we need to go round once more to get
-					// v->s inspected. This looks messy, but is actually
-					// the optimal approach.
-					
-					if (first_key_inspected)
-						break;
-					first_key_inspected = true;
-				}
-			}
-			while (true)
-			{
-				Among w = v[i];
-				if (common_i >= w.s_size)
-				{
-					cursor = c + w.s_size;
-					if (w.method == null)
-						return w.result;
-					bool res;
-					try
-					{
-						System.Object resobj = w.method.Invoke(w.methodobject, (System.Object[]) new System.Object[0]);
-						// {{Aroush}} UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Object.toString' may return a different value. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1043_3"'
-						res = resobj.ToString().Equals("true");
-					}
-					catch (System.Reflection.TargetInvocationException)
-					{
-						res = false;
-						// FIXME - debug message
-					}
-					catch (System.UnauthorizedAccessException)
-					{
-						res = false;
-						// FIXME - debug message
-					}
-					cursor = c + w.s_size;
-					if (res)
-						return w.result;
-				}
-				i = w.substring_i;
-				if (i < 0)
-					return 0;
-			}
-		}
-		
-		// find_among_b is for backwards processing. Same comments apply
-		protected internal virtual int find_among_b(Among[] v, int v_size)
-		{
-			int i = 0;
-			int j = v_size;
-			
-			int c = cursor;
-			int lb = limit_backward;
-			
-			int common_i = 0;
-			int common_j = 0;
-			
-			bool first_key_inspected = false;
-			
-			while (true)
-			{
-				int k = i + ((j - i) >> 1);
-				int diff = 0;
-				int common = common_i < common_j?common_i:common_j;
-				Among w = v[k];
-				int i2;
-				for (i2 = w.s_size - 1 - common; i2 >= 0; i2--)
-				{
-					if (c - common == lb)
-					{
-						diff = - 1;
-						break;
-					}
-					diff = current[c - 1 - common] - w.s[i2];
-					if (diff != 0)
-						break;
-					common++;
-				}
-				if (diff < 0)
-				{
-					j = k;
-					common_j = common;
-				}
-				else
-				{
-					i = k;
-					common_i = common;
-				}
-				if (j - i <= 1)
-				{
-					if (i > 0)
-						break;
-					if (j == i)
-						break;
-					if (first_key_inspected)
-						break;
-					first_key_inspected = true;
-				}
-			}
-			while (true)
-			{
-				Among w = v[i];
-				if (common_i >= w.s_size)
-				{
-					cursor = c - w.s_size;
-					if (w.method == null)
-						return w.result;
-					
-					bool res;
-					try
-					{
-						System.Object resobj = w.method.Invoke(w.methodobject, (System.Object[]) new System.Object[0]);
-						// {{Aroush}} UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Object.toString' may return a different value. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1043_3"'
-						res = resobj.ToString().Equals("true");
-					}
-					catch (System.Reflection.TargetInvocationException)
-					{
-						res = false;
-						// FIXME - debug message
-					}
-					catch (System.UnauthorizedAccessException)
-					{
-						res = false;
-						// FIXME - debug message
-					}
-					cursor = c - w.s_size;
-					if (res)
-						return w.result;
-				}
-				i = w.substring_i;
-				if (i < 0)
-					return 0;
-			}
-		}
-		
-		/* to replace chars between c_bra and c_ket in current by the
-		* chars in s.
-		*/
-		protected internal virtual int replace_s(int c_bra, int c_ket, System.String s)
-		{
-			int adjustment = s.Length - (c_ket - c_bra);
+        // current string
+        protected internal System.Text.StringBuilder current;
+        
+        protected internal int cursor;
+        protected internal int limit;
+        protected internal int limit_backward;
+        protected internal int bra;
+        protected internal int ket;
+        
+        protected internal virtual void  copy_from(SnowballProgram other)
+        {
+            current = other.current;
+            cursor = other.cursor;
+            limit = other.limit;
+            limit_backward = other.limit_backward;
+            bra = other.bra;
+            ket = other.ket;
+        }
+        
+        protected internal virtual bool in_grouping(char[] s, int min, int max)
+        {
+            if (cursor >= limit)
+                return false;
+            char ch = current[cursor];
+            if (ch > max || ch < min)
+                return false;
+            ch -= (char) (min);
+            if ((s[ch >> 3] & (0x1 << (ch & 0x7))) == 0)
+                return false;
+            cursor++;
+            return true;
+        }
+        
+        protected internal virtual bool in_grouping_b(char[] s, int min, int max)
+        {
+            if (cursor <= limit_backward)
+                return false;
+            char ch = current[cursor - 1];
+            if (ch > max || ch < min)
+                return false;
+            ch -= (char) (min);
+            if ((s[ch >> 3] & (0x1 << (ch & 0x7))) == 0)
+                return false;
+            cursor--;
+            return true;
+        }
+        
+        protected internal virtual bool out_grouping(char[] s, int min, int max)
+        {
+            if (cursor >= limit)
+                return false;
+            char ch = current[cursor];
+            if (ch > max || ch < min)
+            {
+                cursor++;
+                return true;
+            }
+            ch -= (char) (min);
+            if ((s[ch >> 3] & (0x1 << (ch & 0x7))) == 0)
+            {
+                cursor++;
+                return true;
+            }
+            return false;
+        }
+        
+        protected internal virtual bool out_grouping_b(char[] s, int min, int max)
+        {
+            if (cursor <= limit_backward)
+                return false;
+            char ch = current[cursor - 1];
+            if (ch > max || ch < min)
+            {
+                cursor--;
+                return true;
+            }
+            ch -= (char) (min);
+            if ((s[ch >> 3] & (0x1 << (ch & 0x7))) == 0)
+            {
+                cursor--;
+                return true;
+            }
+            return false;
+        }
+        
+        protected internal virtual bool in_range(int min, int max)
+        {
+            if (cursor >= limit)
+                return false;
+            char ch = current[cursor];
+            if (ch > max || ch < min)
+                return false;
+            cursor++;
+            return true;
+        }
+        
+        protected internal virtual bool in_range_b(int min, int max)
+        {
+            if (cursor <= limit_backward)
+                return false;
+            char ch = current[cursor - 1];
+            if (ch > max || ch < min)
+                return false;
+            cursor--;
+            return true;
+        }
+        
+        protected internal virtual bool out_range(int min, int max)
+        {
+            if (cursor >= limit)
+                return false;
+            char ch = current[cursor];
+            if (!(ch > max || ch < min))
+                return false;
+            cursor++;
+            return true;
+        }
+        
+        protected internal virtual bool out_range_b(int min, int max)
+        {
+            if (cursor <= limit_backward)
+                return false;
+            char ch = current[cursor - 1];
+            if (!(ch > max || ch < min))
+                return false;
+            cursor--;
+            return true;
+        }
+        
+        protected internal virtual bool eq_s(int s_size, System.String s)
+        {
+            if (limit - cursor < s_size)
+                return false;
+            int i;
+            for (i = 0; i != s_size; i++)
+            {
+                if (current[cursor + i] != s[i])
+                    return false;
+            }
+            cursor += s_size;
+            return true;
+        }
+        
+        protected internal virtual bool eq_s_b(int s_size, System.String s)
+        {
+            if (cursor - limit_backward < s_size)
+                return false;
+            int i;
+            for (i = 0; i != s_size; i++)
+            {
+                if (current[cursor - s_size + i] != s[i])
+                    return false;
+            }
+            cursor -= s_size;
+            return true;
+        }
+        
+        protected internal virtual bool eq_v(System.Text.StringBuilder s)
+        {
+            return eq_s(s.Length, s.ToString());
+        }
+        
+        protected internal virtual bool eq_v_b(System.Text.StringBuilder s)
+        {
+            return eq_s_b(s.Length, s.ToString());
+        }
+        
+        protected internal virtual int find_among(Among[] v, int v_size)
+        {
+            int i = 0;
+            int j = v_size;
+            
+            int c = cursor;
+            int l = limit;
+            
+            int common_i = 0;
+            int common_j = 0;
+            
+            bool first_key_inspected = false;
+            
+            while (true)
+            {
+                int k = i + ((j - i) >> 1);
+                int diff = 0;
+                int common = common_i < common_j?common_i:common_j; // smaller
+                Among w = v[k];
+                int i2;
+                for (i2 = common; i2 < w.s_size; i2++)
+                {
+                    if (c + common == l)
+                    {
+                        diff = - 1;
+                        break;
+                    }
+                    diff = current[c + common] - w.s[i2];
+                    if (diff != 0)
+                        break;
+                    common++;
+                }
+                if (diff < 0)
+                {
+                    j = k;
+                    common_j = common;
+                }
+                else
+                {
+                    i = k;
+                    common_i = common;
+                }
+                if (j - i <= 1)
+                {
+                    if (i > 0)
+                        break; // v->s has been inspected
+                    if (j == i)
+                        break; // only one item in v
+                    
+                    // - but now we need to go round once more to get
+                    // v->s inspected. This looks messy, but is actually
+                    // the optimal approach.
+                    
+                    if (first_key_inspected)
+                        break;
+                    first_key_inspected = true;
+                }
+            }
+            while (true)
+            {
+                Among w = v[i];
+                if (common_i >= w.s_size)
+                {
+                    cursor = c + w.s_size;
+                    if (w.method == null)
+                        return w.result;
+                    bool res;
+                    try
+                    {
+                        System.Object resobj = w.method.Invoke(w.methodobject, (System.Object[]) new System.Object[0]);
+                        // {{Aroush}} UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Object.toString' may return a different value. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1043_3"'
+                        res = resobj.ToString().Equals("true");
+                    }
+                    catch (System.Reflection.TargetInvocationException)
+                    {
+                        res = false;
+                        // FIXME - debug message
+                    }
+                    catch (System.UnauthorizedAccessException)
+                    {
+                        res = false;
+                        // FIXME - debug message
+                    }
+                    cursor = c + w.s_size;
+                    if (res)
+                        return w.result;
+                }
+                i = w.substring_i;
+                if (i < 0)
+                    return 0;
+            }
+        }
+        
+        // find_among_b is for backwards processing. Same comments apply
+        protected internal virtual int find_among_b(Among[] v, int v_size)
+        {
+            int i = 0;
+            int j = v_size;
+            
+            int c = cursor;
+            int lb = limit_backward;
+            
+            int common_i = 0;
+            int common_j = 0;
+            
+            bool first_key_inspected = false;
+            
+            while (true)
+            {
+                int k = i + ((j - i) >> 1);
+                int diff = 0;
+                int common = common_i < common_j?common_i:common_j;
+                Among w = v[k];
+                int i2;
+                for (i2 = w.s_size - 1 - common; i2 >= 0; i2--)
+                {
+                    if (c - common == lb)
+                    {
+                        diff = - 1;
+                        break;
+                    }
+                    diff = current[c - 1 - common] - w.s[i2];
+                    if (diff != 0)
+                        break;
+                    common++;
+                }
+                if (diff < 0)
+                {
+                    j = k;
+                    common_j = common;
+                }
+                else
+                {
+                    i = k;
+                    common_i = common;
+                }
+                if (j - i <= 1)
+                {
+                    if (i > 0)
+                        break;
+                    if (j == i)
+                        break;
+                    if (first_key_inspected)
+                        break;
+                    first_key_inspected = true;
+                }
+            }
+            while (true)
+            {
+                Among w = v[i];
+                if (common_i >= w.s_size)
+                {
+                    cursor = c - w.s_size;
+                    if (w.method == null)
+                        return w.result;
+                    
+                    bool res;
+                    try
+                    {
+                        System.Object resobj = w.method.Invoke(w.methodobject, (System.Object[]) new System.Object[0]);
+                        // {{Aroush}} UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Object.toString' may return a different value. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1043_3"'
+                        res = resobj.ToString().Equals("true");
+                    }
+                    catch (System.Reflection.TargetInvocationException)
+                    {
+                        res = false;
+                        // FIXME - debug message
+                    }
+                    catch (System.UnauthorizedAccessException)
+                    {
+                        res = false;
+                        // FIXME - debug message
+                    }
+                    cursor = c - w.s_size;
+                    if (res)
+                        return w.result;
+                }
+                i = w.substring_i;
+                if (i < 0)
+                    return 0;
+            }
+        }
+        
+        /* to replace chars between c_bra and c_ket in current by the
+        * chars in s.
+        */
+        protected internal virtual int replace_s(int c_bra, int c_ket, System.String s)
+        {
+            int adjustment = s.Length - (c_ket - c_bra);
             if (current.Length > c_bra)
-    			current.Replace(current.ToString(c_bra, c_ket - c_bra), s, c_bra, c_ket - c_bra);
+                current.Replace(current.ToString(c_bra, c_ket - c_bra), s, c_bra, c_ket - c_bra);
             else
                 current.Append(s);
-			limit += adjustment;
-			if (cursor >= c_ket)
-				cursor += adjustment;
-			else if (cursor > c_bra)
-				cursor = c_bra;
-			return adjustment;
-		}
-		
-		protected internal virtual void  slice_check()
-		{
-			if (bra < 0 || bra > ket || ket > limit || limit > current.Length)
-			// this line could be removed
-			{
-				System.Console.Error.WriteLine("faulty slice operation");
-				// FIXME: report error somehow.
-				/*
-				fprintf(stderr, "faulty slice operation:\n");
-				debug(z, -1, 0);
-				exit(1);
-				*/
-			}
-		}
-		
-		protected internal virtual void  slice_from(System.String s)
-		{
-			slice_check();
-			replace_s(bra, ket, s);
-		}
-		
-		protected internal virtual void  slice_from(System.Text.StringBuilder s)
-		{
-			slice_from(s.ToString());
-		}
-		
-		protected internal virtual void  slice_del()
-		{
-			slice_from("");
-		}
-		
-		protected internal virtual void  insert(int c_bra, int c_ket, System.String s)
-		{
-			int adjustment = replace_s(c_bra, c_ket, s);
-			if (c_bra <= bra)
-				bra += adjustment;
-			if (c_bra <= ket)
-				ket += adjustment;
-		}
-		
-		protected internal virtual void  insert(int c_bra, int c_ket, System.Text.StringBuilder s)
-		{
-			insert(c_bra, c_ket, s.ToString());
-		}
-		
-		/* Copy the slice into the supplied StringBuffer */
-		protected internal virtual System.Text.StringBuilder slice_to(System.Text.StringBuilder s)
-		{
-			slice_check();
-			int len = ket - bra;
-			//// s.Replace(s.ToString(0, s.Length - 0), current.ToString(bra, ket), 0, s.Length - 0);
-			s.Remove(0, s.Length);
+            limit += adjustment;
+            if (cursor >= c_ket)
+                cursor += adjustment;
+            else if (cursor > c_bra)
+                cursor = c_bra;
+            return adjustment;
+        }
+        
+        protected internal virtual void  slice_check()
+        {
+            if (bra < 0 || bra > ket || ket > limit || limit > current.Length)
+            // this line could be removed
+            {
+                System.Console.Error.WriteLine("faulty slice operation");
+                // FIXME: report error somehow.
+                /*
+                fprintf(stderr, "faulty slice operation:\n");
+                debug(z, -1, 0);
+                exit(1);
+                */
+            }
+        }
+        
+        protected internal virtual void  slice_from(System.String s)
+        {
+            slice_check();
+            replace_s(bra, ket, s);
+        }
+        
+        protected internal virtual void  slice_from(System.Text.StringBuilder s)
+        {
+            slice_from(s.ToString());
+        }
+        
+        protected internal virtual void  slice_del()
+        {
+            slice_from("");
+        }
+        
+        protected internal virtual void  insert(int c_bra, int c_ket, System.String s)
+        {
+            int adjustment = replace_s(c_bra, c_ket, s);
+            if (c_bra <= bra)
+                bra += adjustment;
+            if (c_bra <= ket)
+                ket += adjustment;
+        }
+        
+        protected internal virtual void  insert(int c_bra, int c_ket, System.Text.StringBuilder s)
+        {
+            insert(c_bra, c_ket, s.ToString());
+        }
+        
+        /* Copy the slice into the supplied StringBuffer */
+        protected internal virtual System.Text.StringBuilder slice_to(System.Text.StringBuilder s)
+        {
+            slice_check();
+            int len = ket - bra;
+            //// s.Replace(s.ToString(0, s.Length - 0), current.ToString(bra, ket), 0, s.Length - 0);
+            s.Remove(0, s.Length);
             s.Append(current.ToString(bra, len));
-			return s;
-		}
-		
-		protected internal virtual System.Text.StringBuilder assign_to(System.Text.StringBuilder s)
-		{
-			//// s.Replace(s.ToString(0, s.Length - 0), current.ToString(0, limit), 0, s.Length - 0);
-			s.Remove(0, s.Length);
+            return s;
+        }
+        
+        protected internal virtual System.Text.StringBuilder assign_to(System.Text.StringBuilder s)
+        {
+            //// s.Replace(s.ToString(0, s.Length - 0), current.ToString(0, limit), 0, s.Length - 0);
+            s.Remove(0, s.Length);
             s.Append(current.ToString(0, limit));
-			return s;
-		}
-		
-		/*
-		extern void debug(struct SN_env * z, int number, int line_count)
-		{   int i;
-		int limit = SIZE(z->p);
-		//if (number >= 0) printf("%3d (line %4d): '", number, line_count);
-		if (number >= 0) printf("%3d (line %4d): [%d]'", number, line_count,limit);
-		for (i = 0; i <= limit; i++)
-		{   if (z->lb == i) printf("{");
-		if (z->bra == i) printf("[");
-		if (z->c == i) printf("|");
-		if (z->ket == i) printf("]");
-		if (z->l == i) printf("}");
-		if (i < limit)
-		{   int ch = z->p[i];
-		if (ch == 0) ch = '#';
-		printf("%c", ch);
-		}
-		}
-		printf("'\n");
-		}*/
-	}
-	
+            return s;
+        }
+        
+        /*
+        extern void debug(struct SN_env * z, int number, int line_count)
+        {   int i;
+        int limit = SIZE(z->p);
+        //if (number >= 0) printf("%3d (line %4d): '", number, line_count);
+        if (number >= 0) printf("%3d (line %4d): [%d]'", number, line_count,limit);
+        for (i = 0; i <= limit; i++)
+        {   if (z->lb == i) printf("{");
+        if (z->bra == i) printf("[");
+        if (z->c == i) printf("|");
+        if (z->ket == i) printf("]");
+        if (z->l == i) printf("}");
+        if (i < limit)
+        {   int ch = z->p[i];
+        if (ch == 0) ch = '#';
+        printf("%c", ch);
+        }
+        }
+        printf("'\n");
+        }*/
+    }
+    
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Snowball/SF/Snowball/TestApp.cs
----------------------------------------------------------------------
diff --git a/src/contrib/Snowball/SF/Snowball/TestApp.cs b/src/contrib/Snowball/SF/Snowball/TestApp.cs
index f757685..0977156 100644
--- a/src/contrib/Snowball/SF/Snowball/TestApp.cs
+++ b/src/contrib/Snowball/SF/Snowball/TestApp.cs
@@ -17,79 +17,79 @@
 using System;
 namespace SF.Snowball
 {
-	
-	public class TestApp
-	{
-		[STAThread]
-		public static void  Main(System.String[] args)
-		{
-			
-			if (args.Length < 2)
-			{
-				ExitWithUsage();
-			}
-			
-			System.Type stemClass = System.Type.GetType("SF.Snowball.Ext." + args[0] + "Stemmer");
-			SnowballProgram stemmer = (SnowballProgram) System.Activator.CreateInstance(stemClass);
-			System.Reflection.MethodInfo stemMethod = stemClass.GetMethod("stem", (new System.Type[0] == null)?new System.Type[0]:(System.Type[]) new System.Type[0]);
-			
-			System.IO.StreamReader reader;
-			reader = new System.IO.StreamReader(new System.IO.FileStream(args[1], System.IO.FileMode.Open, System.IO.FileAccess.Read), System.Text.Encoding.Default);
-			reader = new System.IO.StreamReader(reader.BaseStream, reader.CurrentEncoding);
-			
-			System.Text.StringBuilder input = new System.Text.StringBuilder();
-			
-			System.IO.Stream outstream = System.Console.OpenStandardOutput();
-			
-			if (args.Length > 2 && args[2].Equals("-o"))
-			{
-				outstream = new System.IO.FileStream(args[3], System.IO.FileMode.Create);
-			}
-			else if (args.Length > 2)
-			{
-				ExitWithUsage();
-			}
-			
-			System.IO.StreamWriter output = new System.IO.StreamWriter(outstream, System.Text.Encoding.Default);
-			output = new System.IO.StreamWriter(output.BaseStream, output.Encoding);
-			
-			int repeat = 1;
-			if (args.Length > 4)
-			{
-				repeat = System.Int32.Parse(args[4]);
-			}
-			
-			System.Object[] emptyArgs = new System.Object[0];
-			int character;
-			while ((character = reader.Read()) != - 1)
-			{
-				char ch = (char) character;
-				if (System.Char.IsWhiteSpace(ch))
-				{
-					if (input.Length > 0)
-					{
-						stemmer.SetCurrent(input.ToString());
-						for (int i = repeat; i != 0; i--)
-						{
-							stemMethod.Invoke(stemmer, (System.Object[]) emptyArgs);
-						}
-						output.Write(stemmer.GetCurrent());
-						output.Write('\n');
-						input.Remove(0, input.Length - 0);
-					}
-				}
-				else
-				{
-					input.Append(System.Char.ToLower(ch));
-				}
-			}
-			output.Flush();
-		}
-		
-		private static void  ExitWithUsage()
-		{
-			System.Console.Error.WriteLine("Usage: TestApp <stemmer name> <input file> [-o <output file>]");
-			System.Environment.Exit(1);
-		}
-	}
+    
+    public class TestApp
+    {
+        [STAThread]
+        public static void  Main(System.String[] args)
+        {
+            
+            if (args.Length < 2)
+            {
+                ExitWithUsage();
+            }
+            
+            System.Type stemClass = System.Type.GetType("SF.Snowball.Ext." + args[0] + "Stemmer");
+            SnowballProgram stemmer = (SnowballProgram) System.Activator.CreateInstance(stemClass);
+            System.Reflection.MethodInfo stemMethod = stemClass.GetMethod("stem", (new System.Type[0] == null)?new System.Type[0]:(System.Type[]) new System.Type[0]);
+            
+            System.IO.StreamReader reader;
+            reader = new System.IO.StreamReader(new System.IO.FileStream(args[1], System.IO.FileMode.Open, System.IO.FileAccess.Read), System.Text.Encoding.Default);
+            reader = new System.IO.StreamReader(reader.BaseStream, reader.CurrentEncoding);
+            
+            System.Text.StringBuilder input = new System.Text.StringBuilder();
+            
+            System.IO.Stream outstream = System.Console.OpenStandardOutput();
+            
+            if (args.Length > 2 && args[2].Equals("-o"))
+            {
+                outstream = new System.IO.FileStream(args[3], System.IO.FileMode.Create);
+            }
+            else if (args.Length > 2)
+            {
+                ExitWithUsage();
+            }
+            
+            System.IO.StreamWriter output = new System.IO.StreamWriter(outstream, System.Text.Encoding.Default);
+            output = new System.IO.StreamWriter(output.BaseStream, output.Encoding);
+            
+            int repeat = 1;
+            if (args.Length > 4)
+            {
+                repeat = System.Int32.Parse(args[4]);
+            }
+            
+            System.Object[] emptyArgs = new System.Object[0];
+            int character;
+            while ((character = reader.Read()) != - 1)
+            {
+                char ch = (char) character;
+                if (System.Char.IsWhiteSpace(ch))
+                {
+                    if (input.Length > 0)
+                    {
+                        stemmer.SetCurrent(input.ToString());
+                        for (int i = repeat; i != 0; i--)
+                        {
+                            stemMethod.Invoke(stemmer, (System.Object[]) emptyArgs);
+                        }
+                        output.Write(stemmer.GetCurrent());
+                        output.Write('\n');
+                        input.Remove(0, input.Length - 0);
+                    }
+                }
+                else
+                {
+                    input.Append(System.Char.ToLower(ch));
+                }
+            }
+            output.Flush();
+        }
+        
+        private static void  ExitWithUsage()
+        {
+            System.Console.Error.WriteLine("Usage: TestApp <stemmer name> <input file> [-o <output file>]");
+            System.Environment.Exit(1);
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Spatial/BBox/AreaSimilarity.cs
----------------------------------------------------------------------
diff --git a/src/contrib/Spatial/BBox/AreaSimilarity.cs b/src/contrib/Spatial/BBox/AreaSimilarity.cs
index a4e25d8..2fd3314 100644
--- a/src/contrib/Spatial/BBox/AreaSimilarity.cs
+++ b/src/contrib/Spatial/BBox/AreaSimilarity.cs
@@ -1,4 +1,4 @@
-/*
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -22,7 +22,7 @@ using Spatial4n.Core.Shapes;
 
 namespace Lucene.Net.Spatial.BBox
 {
-	/// <summary>
+    /// <summary>
     /// The algorithm is implemented as envelope on envelope overlays rather than
     /// complex polygon on complex polygon overlays.
     /// <p/>
@@ -46,186 +46,186 @@ namespace Lucene.Net.Spatial.BBox
     ///   SpatialRankingValueSource</a>.
     ///
     /// @lucene.experimental
-	/// </summary>
-	public class AreaSimilarity : BBoxSimilarity
-	{
-	   /*
-		* Properties associated with the query envelope
-		*/
-		private readonly Rectangle queryExtent;
-		private readonly double queryArea;
-
-		private readonly double targetPower;
-		private readonly double queryPower;
-
-		public AreaSimilarity(Rectangle queryExtent, double queryPower, double targetPower)
-		{
-			this.queryExtent = queryExtent;
-			this.queryArea = queryExtent.GetArea(null);
-
-			this.queryPower = queryPower;
-			this.targetPower = targetPower;
-
-			//  if (this.qryMinX > queryExtent.getMaxX()) {
-			//    this.qryCrossedDateline = true;
-			//    this.qryArea = Math.abs(qryMaxX + 360.0 - qryMinX) * Math.abs(qryMaxY - qryMinY);
-			//  } else {
-			//    this.qryArea = Math.abs(qryMaxX - qryMinX) * Math.abs(qryMaxY - qryMinY);
-			//  }
-		}
-
-		public AreaSimilarity(Rectangle queryExtent)
-			: this(queryExtent, 2.0, 0.5)
-		{
-		}
-
-		public String GetDelimiterQueryParameters()
-		{
-			return queryExtent + ";" + queryPower + ";" + targetPower;
-		}
-
-		public double Score(Rectangle target, Explanation exp)
-		{
-			if (target == null || queryArea <= 0)
-			{
-				return 0;
-			}
-			double targetArea = target.GetArea(null);
-			if (targetArea <= 0)
-			{
-				return 0;
-			}
-			double score = 0;
-
-			double top = Math.Min(queryExtent.GetMaxY(), target.GetMaxY());
-			double bottom = Math.Max(queryExtent.GetMinY(), target.GetMinY());
-			double height = top - bottom;
-			double width = 0;
-
-			// queries that cross the date line
-			if (queryExtent.GetCrossesDateLine())
-			{
-				// documents that cross the date line
-				if (target.GetCrossesDateLine())
-				{
-					double left = Math.Max(queryExtent.GetMinX(), target.GetMinX());
-					double right = Math.Min(queryExtent.GetMaxX(), target.GetMaxX());
-					width = right + 360.0 - left;
-				}
-				else
-				{
-					double qryWestLeft = Math.Max(queryExtent.GetMinX(), target.GetMaxX());
-					double qryWestRight = Math.Min(target.GetMaxX(), 180.0);
-					double qryWestWidth = qryWestRight - qryWestLeft;
-					if (qryWestWidth > 0)
-					{
-						width = qryWestWidth;
-					}
-					else
-					{
-						double qryEastLeft = Math.Max(target.GetMaxX(), -180.0);
-						double qryEastRight = Math.Min(queryExtent.GetMaxX(), target.GetMaxX());
-						double qryEastWidth = qryEastRight - qryEastLeft;
-						if (qryEastWidth > 0)
-						{
-							width = qryEastWidth;
-						}
-					}
-				}
-			}
-			else
-			{ // queries that do not cross the date line
-
-				if (target.GetCrossesDateLine())
-				{
-					double tgtWestLeft = Math.Max(queryExtent.GetMinX(), target.GetMinX());
-					double tgtWestRight = Math.Min(queryExtent.GetMaxX(), 180.0);
-					double tgtWestWidth = tgtWestRight - tgtWestLeft;
-					if (tgtWestWidth > 0)
-					{
-						width = tgtWestWidth;
-					}
-					else
-					{
-						double tgtEastLeft = Math.Max(queryExtent.GetMinX(), -180.0);
-						double tgtEastRight = Math.Min(queryExtent.GetMaxX(), target.GetMaxX());
-						double tgtEastWidth = tgtEastRight - tgtEastLeft;
-						if (tgtEastWidth > 0)
-						{
-							width = tgtEastWidth;
-						}
-					}
-				}
-				else
-				{
-					double left = Math.Max(queryExtent.GetMinX(), target.GetMinX());
-					double right = Math.Min(queryExtent.GetMaxX(), target.GetMaxX());
-					width = right - left;
-				}
-			}
-
-
-			// calculate the score
-			if ((width > 0) && (height > 0))
-			{
-				double intersectionArea = width * height;
-				double queryRatio = intersectionArea / queryArea;
-				double targetRatio = intersectionArea / targetArea;
-				double queryFactor = Math.Pow(queryRatio, queryPower);
-				double targetFactor = Math.Pow(targetRatio, targetPower);
-				score = queryFactor * targetFactor * 10000.0;
-
-				if (exp != null)
-				{
-					//        StringBuilder sb = new StringBuilder();
-					//        sb.append("\nscore=").append(score);
-					//        sb.append("\n  query=").append();
-					//        sb.append("\n  target=").append(target.toString());
-					//        sb.append("\n  intersectionArea=").append(intersectionArea);
-					//        
-					//        sb.append(" queryArea=").append(queryArea).append(" targetArea=").append(targetArea);
-					//        sb.append("\n  queryRatio=").append(queryRatio).append(" targetRatio=").append(targetRatio);
-					//        sb.append("\n  queryFactor=").append(queryFactor).append(" targetFactor=").append(targetFactor);
-					//        sb.append(" (queryPower=").append(queryPower).append(" targetPower=").append(targetPower).append(")");
-
-					exp.Value = (float) score;
-					exp.Description = GetType().Name;
-
-					Explanation e = null;
-
-					exp.AddDetail(e = new Explanation((float)intersectionArea, "IntersectionArea"));
-					e.AddDetail(new Explanation((float)width, "width; Query: " + queryExtent));
-					e.AddDetail(new Explanation((float)height, "height; Target: " + target));
-
-					exp.AddDetail(e = new Explanation((float)queryFactor, "Query"));
-					e.AddDetail(new Explanation((float)queryArea, "area"));
-					e.AddDetail(new Explanation((float)queryRatio, "ratio"));
-					e.AddDetail(new Explanation((float)queryPower, "power"));
-
-					exp.AddDetail(e = new Explanation((float)targetFactor, "Target"));
-					e.AddDetail(new Explanation((float)targetArea, "area"));
-					e.AddDetail(new Explanation((float)targetRatio, "ratio"));
-					e.AddDetail(new Explanation((float)targetPower, "power"));
-				}
-			}
-			else if (exp != null)
-			{
-				exp.Value = 0;
-				exp.Description = "Shape does not intersect";
-			}
-			return score;
-		}
-
-		public override bool Equals(object obj)
-		{
-			var other = obj as AreaSimilarity;
-			if (other == null) return false;
-			return GetDelimiterQueryParameters().Equals(other.GetDelimiterQueryParameters());
-		}
-
-		public override int GetHashCode()
-		{
-			return GetDelimiterQueryParameters().GetHashCode();
-		} 
-	}
+    /// </summary>
+    public class AreaSimilarity : BBoxSimilarity
+    {
+       /*
+        * Properties associated with the query envelope
+        */
+        private readonly Rectangle queryExtent;
+        private readonly double queryArea;
+
+        private readonly double targetPower;
+        private readonly double queryPower;
+
+        public AreaSimilarity(Rectangle queryExtent, double queryPower, double targetPower)
+        {
+            this.queryExtent = queryExtent;
+            this.queryArea = queryExtent.GetArea(null);
+
+            this.queryPower = queryPower;
+            this.targetPower = targetPower;
+
+            //  if (this.qryMinX > queryExtent.getMaxX()) {
+            //    this.qryCrossedDateline = true;
+            //    this.qryArea = Math.abs(qryMaxX + 360.0 - qryMinX) * Math.abs(qryMaxY - qryMinY);
+            //  } else {
+            //    this.qryArea = Math.abs(qryMaxX - qryMinX) * Math.abs(qryMaxY - qryMinY);
+            //  }
+        }
+
+        public AreaSimilarity(Rectangle queryExtent)
+            : this(queryExtent, 2.0, 0.5)
+        {
+        }
+
+        public String GetDelimiterQueryParameters()
+        {
+            return queryExtent + ";" + queryPower + ";" + targetPower;
+        }
+
+        public double Score(Rectangle target, Explanation exp)
+        {
+            if (target == null || queryArea <= 0)
+            {
+                return 0;
+            }
+            double targetArea = target.GetArea(null);
+            if (targetArea <= 0)
+            {
+                return 0;
+            }
+            double score = 0;
+
+            double top = Math.Min(queryExtent.GetMaxY(), target.GetMaxY());
+            double bottom = Math.Max(queryExtent.GetMinY(), target.GetMinY());
+            double height = top - bottom;
+            double width = 0;
+
+            // queries that cross the date line
+            if (queryExtent.GetCrossesDateLine())
+            {
+                // documents that cross the date line
+                if (target.GetCrossesDateLine())
+                {
+                    double left = Math.Max(queryExtent.GetMinX(), target.GetMinX());
+                    double right = Math.Min(queryExtent.GetMaxX(), target.GetMaxX());
+                    width = right + 360.0 - left;
+                }
+                else
+                {
+                    double qryWestLeft = Math.Max(queryExtent.GetMinX(), target.GetMaxX());
+                    double qryWestRight = Math.Min(target.GetMaxX(), 180.0);
+                    double qryWestWidth = qryWestRight - qryWestLeft;
+                    if (qryWestWidth > 0)
+                    {
+                        width = qryWestWidth;
+                    }
+                    else
+                    {
+                        double qryEastLeft = Math.Max(target.GetMaxX(), -180.0);
+                        double qryEastRight = Math.Min(queryExtent.GetMaxX(), target.GetMaxX());
+                        double qryEastWidth = qryEastRight - qryEastLeft;
+                        if (qryEastWidth > 0)
+                        {
+                            width = qryEastWidth;
+                        }
+                    }
+                }
+            }
+            else
+            { // queries that do not cross the date line
+
+                if (target.GetCrossesDateLine())
+                {
+                    double tgtWestLeft = Math.Max(queryExtent.GetMinX(), target.GetMinX());
+                    double tgtWestRight = Math.Min(queryExtent.GetMaxX(), 180.0);
+                    double tgtWestWidth = tgtWestRight - tgtWestLeft;
+                    if (tgtWestWidth > 0)
+                    {
+                        width = tgtWestWidth;
+                    }
+                    else
+                    {
+                        double tgtEastLeft = Math.Max(queryExtent.GetMinX(), -180.0);
+                        double tgtEastRight = Math.Min(queryExtent.GetMaxX(), target.GetMaxX());
+                        double tgtEastWidth = tgtEastRight - tgtEastLeft;
+                        if (tgtEastWidth > 0)
+                        {
+                            width = tgtEastWidth;
+                        }
+                    }
+                }
+                else
+                {
+                    double left = Math.Max(queryExtent.GetMinX(), target.GetMinX());
+                    double right = Math.Min(queryExtent.GetMaxX(), target.GetMaxX());
+                    width = right - left;
+                }
+            }
+
+
+            // calculate the score
+            if ((width > 0) && (height > 0))
+            {
+                double intersectionArea = width * height;
+                double queryRatio = intersectionArea / queryArea;
+                double targetRatio = intersectionArea / targetArea;
+                double queryFactor = Math.Pow(queryRatio, queryPower);
+                double targetFactor = Math.Pow(targetRatio, targetPower);
+                score = queryFactor * targetFactor * 10000.0;
+
+                if (exp != null)
+                {
+                    //        StringBuilder sb = new StringBuilder();
+                    //        sb.append("\nscore=").append(score);
+                    //        sb.append("\n  query=").append();
+                    //        sb.append("\n  target=").append(target.toString());
+                    //        sb.append("\n  intersectionArea=").append(intersectionArea);
+                    //        
+                    //        sb.append(" queryArea=").append(queryArea).append(" targetArea=").append(targetArea);
+                    //        sb.append("\n  queryRatio=").append(queryRatio).append(" targetRatio=").append(targetRatio);
+                    //        sb.append("\n  queryFactor=").append(queryFactor).append(" targetFactor=").append(targetFactor);
+                    //        sb.append(" (queryPower=").append(queryPower).append(" targetPower=").append(targetPower).append(")");
+
+                    exp.Value = (float) score;
+                    exp.Description = GetType().Name;
+
+                    Explanation e = null;
+
+                    exp.AddDetail(e = new Explanation((float)intersectionArea, "IntersectionArea"));
+                    e.AddDetail(new Explanation((float)width, "width; Query: " + queryExtent));
+                    e.AddDetail(new Explanation((float)height, "height; Target: " + target));
+
+                    exp.AddDetail(e = new Explanation((float)queryFactor, "Query"));
+                    e.AddDetail(new Explanation((float)queryArea, "area"));
+                    e.AddDetail(new Explanation((float)queryRatio, "ratio"));
+                    e.AddDetail(new Explanation((float)queryPower, "power"));
+
+                    exp.AddDetail(e = new Explanation((float)targetFactor, "Target"));
+                    e.AddDetail(new Explanation((float)targetArea, "area"));
+                    e.AddDetail(new Explanation((float)targetRatio, "ratio"));
+                    e.AddDetail(new Explanation((float)targetPower, "power"));
+                }
+            }
+            else if (exp != null)
+            {
+                exp.Value = 0;
+                exp.Description = "Shape does not intersect";
+            }
+            return score;
+        }
+
+        public override bool Equals(object obj)
+        {
+            var other = obj as AreaSimilarity;
+            if (other == null) return false;
+            return GetDelimiterQueryParameters().Equals(other.GetDelimiterQueryParameters());
+        }
+
+        public override int GetHashCode()
+        {
+            return GetDelimiterQueryParameters().GetHashCode();
+        } 
+    }
 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Spatial/BBox/BBoxSimilarity.cs
----------------------------------------------------------------------
diff --git a/src/contrib/Spatial/BBox/BBoxSimilarity.cs b/src/contrib/Spatial/BBox/BBoxSimilarity.cs
index 2f347c8..a18baa4 100644
--- a/src/contrib/Spatial/BBox/BBoxSimilarity.cs
+++ b/src/contrib/Spatial/BBox/BBoxSimilarity.cs
@@ -1,4 +1,4 @@
-/*
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -23,8 +23,8 @@ namespace Lucene.Net.Spatial.BBox
     /// <summary>
     /// Abstraction of the calculation used to determine how similar two Bounding Boxes are.
     /// </summary>
-	public interface BBoxSimilarity
-	{
-		double Score(Rectangle extent, Explanation exp);
-	}
+    public interface BBoxSimilarity
+    {
+        double Score(Rectangle extent, Explanation exp);
+    }
 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Spatial/BBox/BBoxSimilarityValueSource.cs
----------------------------------------------------------------------
diff --git a/src/contrib/Spatial/BBox/BBoxSimilarityValueSource.cs b/src/contrib/Spatial/BBox/BBoxSimilarityValueSource.cs
index 093482b..6939274 100644
--- a/src/contrib/Spatial/BBox/BBoxSimilarityValueSource.cs
+++ b/src/contrib/Spatial/BBox/BBoxSimilarityValueSource.cs
@@ -1,4 +1,4 @@
-/*
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -24,41 +24,41 @@ using Spatial4n.Core.Shapes.Impl;
 
 namespace Lucene.Net.Spatial.BBox
 {
-	public class BBoxSimilarityValueSource : ValueSource
-	{
-		private readonly BBoxStrategy strategy;
-		private readonly BBoxSimilarity similarity;
+    public class BBoxSimilarityValueSource : ValueSource
+    {
+        private readonly BBoxStrategy strategy;
+        private readonly BBoxSimilarity similarity;
 
-		public BBoxSimilarityValueSource(BBoxStrategy strategy, BBoxSimilarity similarity)
-		{
-			this.strategy = strategy;
-			this.similarity = similarity;
-		}
+        public BBoxSimilarityValueSource(BBoxStrategy strategy, BBoxSimilarity similarity)
+        {
+            this.strategy = strategy;
+            this.similarity = similarity;
+        }
 
-		private class BBoxSimilarityValueSourceDocValues : DocValues
-		{
-			private readonly BBoxSimilarityValueSource _enclosingInstance;
-		    private readonly Rectangle rect;
-		    private readonly double[] minX;
-			private readonly double[] minY;
-			private readonly double[] maxX;
-			private readonly double[] maxY;
+        private class BBoxSimilarityValueSourceDocValues : DocValues
+        {
+            private readonly BBoxSimilarityValueSource _enclosingInstance;
+            private readonly Rectangle rect;
+            private readonly double[] minX;
+            private readonly double[] minY;
+            private readonly double[] maxX;
+            private readonly double[] maxY;
 
-			private readonly IBits validMinX, validMaxX;
+            private readonly IBits validMinX, validMaxX;
 
-			public BBoxSimilarityValueSourceDocValues(IndexReader reader, BBoxSimilarityValueSource enclosingInstance)
-			{
-				_enclosingInstance = enclosingInstance;
+            public BBoxSimilarityValueSourceDocValues(IndexReader reader, BBoxSimilarityValueSource enclosingInstance)
+            {
+                _enclosingInstance = enclosingInstance;
                 rect = _enclosingInstance.strategy.GetSpatialContext().MakeRectangle(0, 0, 0, 0); //reused
 
-			    minX = FieldCache_Fields.DEFAULT.GetDoubles(reader, enclosingInstance.strategy.field_minX/*, true*/);
-				minY = FieldCache_Fields.DEFAULT.GetDoubles(reader, enclosingInstance.strategy.field_minY/*, true*/);
-				maxX = FieldCache_Fields.DEFAULT.GetDoubles(reader, enclosingInstance.strategy.field_maxX/*, true*/);
-				maxY = FieldCache_Fields.DEFAULT.GetDoubles(reader, enclosingInstance.strategy.field_maxY/*, true*/);
+                minX = FieldCache_Fields.DEFAULT.GetDoubles(reader, enclosingInstance.strategy.field_minX/*, true*/);
+                minY = FieldCache_Fields.DEFAULT.GetDoubles(reader, enclosingInstance.strategy.field_minY/*, true*/);
+                maxX = FieldCache_Fields.DEFAULT.GetDoubles(reader, enclosingInstance.strategy.field_maxX/*, true*/);
+                maxY = FieldCache_Fields.DEFAULT.GetDoubles(reader, enclosingInstance.strategy.field_maxY/*, true*/);
 
-				validMinX = FieldCache_Fields.DEFAULT.GetDocsWithField(reader, enclosingInstance.strategy.field_minX);
-				validMaxX = FieldCache_Fields.DEFAULT.GetDocsWithField(reader, enclosingInstance.strategy.field_maxX);
-			}
+                validMinX = FieldCache_Fields.DEFAULT.GetDocsWithField(reader, enclosingInstance.strategy.field_minX);
+                validMaxX = FieldCache_Fields.DEFAULT.GetDocsWithField(reader, enclosingInstance.strategy.field_maxX);
+            }
 
             public override float FloatVal(int doc)
             {
@@ -76,47 +76,47 @@ namespace Lucene.Net.Spatial.BBox
                 }
             }
 
-		    public override Explanation Explain(int doc)
-			{
-				// make sure it has minX and area
-				if (validMinX.Get(doc) && validMaxX.Get(doc))
-				{
-					rect.Reset(
-						minX[doc], maxX[doc],
-						minY[doc], maxY[doc]);
-					var exp = new Explanation();
-					_enclosingInstance.similarity.Score(rect, exp);
-					return exp;
-				}
-				return new Explanation(0, "No BBox");
-			}
+            public override Explanation Explain(int doc)
+            {
+                // make sure it has minX and area
+                if (validMinX.Get(doc) && validMaxX.Get(doc))
+                {
+                    rect.Reset(
+                        minX[doc], maxX[doc],
+                        minY[doc], maxY[doc]);
+                    var exp = new Explanation();
+                    _enclosingInstance.similarity.Score(rect, exp);
+                    return exp;
+                }
+                return new Explanation(0, "No BBox");
+            }
 
-			public override string ToString(int doc)
-			{
-				return _enclosingInstance.Description() + "=" + FloatVal(doc);
-			}
-		}
+            public override string ToString(int doc)
+            {
+                return _enclosingInstance.Description() + "=" + FloatVal(doc);
+            }
+        }
 
-		public override DocValues GetValues(IndexReader reader)
-		{
-			return new BBoxSimilarityValueSourceDocValues(reader, this);
-		}
+        public override DocValues GetValues(IndexReader reader)
+        {
+            return new BBoxSimilarityValueSourceDocValues(reader, this);
+        }
 
-		public override string Description()
-		{
-			return "BBoxSimilarityValueSource(" + similarity + ")";
-		}
+        public override string Description()
+        {
+            return "BBoxSimilarityValueSource(" + similarity + ")";
+        }
 
-		public override bool Equals(object o)
-		{
-			var other = o as BBoxSimilarityValueSource;
-			if (other == null) return false;
-			return similarity.Equals(other.similarity);
-		}
+        public override bool Equals(object o)
+        {
+            var other = o as BBoxSimilarityValueSource;
+            if (other == null) return false;
+            return similarity.Equals(other.similarity);
+        }
 
-		public override int GetHashCode()
-		{
-			return typeof(BBoxSimilarityValueSource).GetHashCode() + similarity.GetHashCode();
-		}
-	}
+        public override int GetHashCode()
+        {
+            return typeof(BBoxSimilarityValueSource).GetHashCode() + similarity.GetHashCode();
+        }
+    }
 }


Mime
View raw message