/// <summary>
        ///     Converts the rule text in to a PhoneticRule class
        /// </summary>
        /// <param name="ruleText" type="string">
        ///     <para>
        ///         The text to convert
        ///     </para>
        /// </param>
        /// <param name="rule" type="ref NetSpell.SpellChecker.Dictionary.Phonetic.PhoneticRule">
        ///     <para>
        ///         The object that will hold the conversion data
        ///     </para>
        /// </param>
        public static void EncodeRule(string ruleText, ref PhoneticRule rule)
        {
            // clear the conditions array
            for (int i = 0; i < rule.Condition.Length; i++)
            {
                rule.Condition[i] = 0;
            }

            bool group = false;             /* group indicator */
            bool end   = false;             /* end condition indicator */

            char [] memberChars = new char[200];
            int     numMember   = 0;         /* number of member in group */

            foreach (char cond in ruleText)
            {
                switch (cond)
                {
                case '(':
                    group = true;
                    break;

                case ')':
                    end = true;
                    break;

                case '^':
                    rule.BeginningOnly = true;
                    break;

                case '$':
                    rule.EndOnly = true;
                    break;

                case '-':
                    rule.ConsumeCount++;
                    break;

                case '<':
                    rule.ReplaceMode = true;
                    break;

                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':
                    rule.Priority = int.Parse(cond.ToString(CultureInfo.CurrentUICulture));
                    break;

                default:
                    if (group)
                    {
                        // add chars to group
                        memberChars[numMember] = cond;
                        numMember++;
                    }
                    else
                    {
                        end = true;
                    }
                    break;
                }                 // switch

                if (end)
                {
                    if (group)
                    {
                        // turn on chars in member group
                        for (int j = 0; j < numMember; j++)
                        {
                            int charCode = (int)memberChars[j];
                            rule.Condition[charCode] = rule.Condition[charCode] | (1 << rule.ConditionCount);
                        }

                        group     = false;
                        numMember = 0;
                    }
                    else
                    {
                        // turn on char
                        int charCode = (int)cond;
                        rule.Condition[charCode] = rule.Condition[charCode] | (1 << rule.ConditionCount);
                    }
                    end = false;
                    rule.ConditionCount++;
                }         // if end
            }             // for each
        }
 /// <summary>
 ///     Adds a 'PhoneticRule' item with the specified value to the 'PhoneticRuleCollection'
 /// </summary>
 /// <param name='value'>
 ///     The 'PhoneticRule' to add.
 /// </param>
 /// <returns>
 ///     The index at which the new element was inserted.
 /// </returns>
 public int Add(PhoneticRule value)
 {
     return(List.Add(value));
 }
 /// <summary>
 ///     Removes a specific item from the 'PhoneticRuleCollection'.
 /// </summary>
 /// <param name='value'>
 ///     The item to remove from the 'PhoneticRuleCollection'.
 /// </param>
 public void Remove(PhoneticRule value)
 {
     List.Remove(value);
 }
 /// <summary>
 ///     Inserts an existing 'PhoneticRule' into the collection at the specified index.
 /// </summary>
 /// <param name='index'>
 ///     The zero-based index where the new item should be inserted.
 /// </param>
 /// <param name='value'>
 ///     The item to insert.
 /// </param>
 public void Insert(int index, PhoneticRule value)
 {
     List.Insert(index, value);
 }
 /// <summary>
 ///     Returns the index of a 'PhoneticRule' object in the collection.
 /// </summary>
 /// <param name='value'>
 ///     The 'PhoneticRule' object whose index will be retrieved.
 /// </param>
 /// <returns>
 ///     If found, the index of the value; otherwise, -1.
 /// </returns>
 public int IndexOf(PhoneticRule value)
 {
     return(List.IndexOf(value));
 }
 /// <summary>
 ///     Gets a value indicating whether the 'PhoneticRuleCollection' contains the specified value.
 /// </summary>
 /// <param name='value'>
 ///     The item to locate.
 /// </param>
 /// <returns>
 ///     True if the item exists in the collection; false otherwise.
 /// </returns>
 public bool Contains(PhoneticRule value)
 {
     return(List.Contains(value));
 }