private IInflection CreateEnglishComposite(IInflection anglicized,
                                            IInflection classical, PluralFormPreference pref, string description = null)
 {
     return(new CompositeInflection(
                pl => new EnglishPluralForm(pl[0].Value, pl[1].Value, pref, description),
                anglicized, classical));
 }
        private void AddSuffixCategory(string suffix, string anglicizedEnding,
                                       string classicalEnding, string[] words,
                                       PluralFormPreference pref = PluralFormPreference.Classical)
        {
            foreach (var word in words)
            {
                if (!word.EndsWith(suffix))
                {
                    throw new ArgumentException(String.Format(
                                                    "Word {0} must end with the suffix {1}. " +
                                                    "Are you adding it to the wrong category?",
                                                    word, suffix));
                }
                var substr = word.Substring(0, word.Length - suffix.Length);
                var angl   = !String.IsNullOrEmpty(anglicizedEnding)
                    ? substr + anglicizedEnding
                    : null;
                var clas = !String.IsNullOrEmpty(classicalEnding)
                    ? substr + classicalEnding
                    : null;

                SingularCategorySuffix.Add(word, new EnglishPluralForm(
                                               angl, clas, pref,
                                               String.Format("{0} -> " +
                                                             angl != null && clas != null
                            ? "{1}/{2}"
                            : angl != null
                                ? "{1}"
                                : "{2}"  // classical must not be null
                                                             , word, angl, clas)));
            }
        }
        public EnglishPluralForm(string anglicized, string classical, 
            PluralFormPreference preference = PluralFormPreference.Classical,
            string description = null)
        {
            Anglicized = anglicized;
            Classical = classical;
            Preference = preference;
            Description = description;

            switch(Preference)
            {
                case PluralFormPreference.Classical:
                    Value = Classical ?? Anglicized;
                    break;
                case PluralFormPreference.Anglicized:
                    Value = Anglicized ?? Classical;
                    break;
            }
        }
        public EnglishPluralForm(string anglicized, string classical,
                                 PluralFormPreference preference = PluralFormPreference.Classical,
                                 string description = null)
        {
            Anglicized  = anglicized;
            Classical   = classical;
            Preference  = preference;
            Description = description;

            switch (Preference)
            {
            case PluralFormPreference.Classical:
                Value = Classical ?? Anglicized;
                break;

            case PluralFormPreference.Anglicized:
                Value = Anglicized ?? Classical;
                break;
            }
        }
 private IInflection CreateEnglishComposite(IInflection anglicized, 
     IInflection classical, PluralFormPreference pref, string description = null)
 {
     return new CompositeInflection(
         pl => new EnglishPluralForm(pl[0].Value, pl[1].Value, pref, description),
         anglicized, classical);
 }
        private void AddSuffixCategory(string suffix, string anglicizedEnding,
                                        string classicalEnding, string[] words, 
                                        PluralFormPreference pref = PluralFormPreference.Classical)
        {
            foreach (var word in words)
            {
                if(!word.EndsWith(suffix))
                {
                    throw new ArgumentException(String.Format(
                        "Word {0} must end with the suffix {1}. " +
                        "Are you adding it to the wrong category?",
                        word, suffix));
                }
                var substr = word.Substring(0, word.Length - suffix.Length);
                var angl = !String.IsNullOrEmpty(anglicizedEnding)
                    ? substr + anglicizedEnding
                    : null;
                var clas = !String.IsNullOrEmpty(classicalEnding)
                    ? substr + classicalEnding
                    : null;

                SingularCategorySuffix.Add(word, new EnglishPluralForm(
                    angl, clas, pref,
                    String.Format("{0} -> " +
                        angl != null && clas != null
                            ? "{1}/{2}"
                            : angl != null
                                ? "{1}"
                                : "{2}"  // classical must not be null
                              , word, angl, clas)));
            }
        }