2008-11-12 Atsushi Enomoto <atsushi@ximian.com>
[mono.git] / mcs / class / System.Data.Linq / src / DbLinq / Language / Implementation / AbstractEndPluralWords.cs
index 7f464aed0a8657963ae36b06de23158bbb3464e6..6f0b721adeb4776441912853b918429463f64fdb 100644 (file)
 // \r
 #endregion\r
 \r
-using DbLinq.Language.Implementation;\r
-\r
 namespace DbLinq.Language.Implementation\r
 {\r
+    /// <summary>\r
+    /// Words with singular/plural capacity, changed in the end\r
+    /// </summary>\r
 #if MONO_STRICT\r
     internal\r
 #else\r
@@ -35,12 +36,25 @@ namespace DbLinq.Language.Implementation
 #endif\r
     abstract class AbstractEndPluralWords : AbstractWords\r
     {\r
+        /// <summary>\r
+        /// Corresponding singular and plural endings\r
+        /// </summary>\r
         protected class SingularPlural\r
         {\r
+            /// <summary>\r
+            /// Singular ending\r
+            /// </summary>\r
             public string Singular;\r
+            /// <summary>\r
+            /// Plural ending\r
+            /// </summary>\r
             public string Plural;\r
         }\r
 \r
+        /// <summary>\r
+        /// Singulars and plurals ends\r
+        /// </summary>\r
+        /// <value>The singulars plurals.</value>\r
         protected abstract SingularPlural[] SingularsPlurals { get; }\r
 \r
         /// <summary>\r
@@ -53,6 +67,7 @@ namespace DbLinq.Language.Implementation
             if (plural.Length < 2)\r
                 return plural;\r
 \r
+            // we run on every possible singular/plural\r
             foreach (SingularPlural sp in SingularsPlurals)\r
             {\r
                 string newWord = Try(plural, sp.Plural, sp.Singular);\r
@@ -82,11 +97,21 @@ namespace DbLinq.Language.Implementation
             return singular;\r
         }\r
 \r
+        /// <summary>\r
+        /// Tries the specified word for singular/plural.\r
+        /// </summary>\r
+        /// <param name="word">The word.</param>\r
+        /// <param name="ending">The ending.</param>\r
+        /// <param name="newEnding">The new ending.</param>\r
+        /// <returns></returns>\r
         protected string Try(string word, string ending, string newEnding)\r
         {\r
+            // if the word ends with tested end\r
             if (word.ToLower().EndsWith(ending))\r
             {\r
+                // then substitute old end by new end ...\r
                 string newWord = word.Substring(0, word.Length - ending.Length) + newEnding;\r
+                // ... and if the word exists, we have the right one\r
                 if (Exists(newWord))\r
                     return newWord;\r
             }\r