コード例 #1
0
 public IEnumerable <VariableLetterGroup> AnalyzedUniquePermutations <T>(GraphemeSet <T> graphemes)
     where T : Grapheme, new()
 {
     foreach (VariableLetterGroup vlg in this.UniquePermutations())
     {
         if (vlg.IsValidAccordingToGraphemeSet <T>(graphemes))
         {
             yield return(vlg);
         }
     }
 }
コード例 #2
0
        public bool IsValidAccordingToGraphemeSet <T>(GraphemeSet <T> graphemes)
            where T : Grapheme, new()
        {
            int  letters_length            = _letters.Count;
            int  grapheme_length           = graphemes.GetGraphemeLength();
            int  last_index_index_to_check = letters_length - grapheme_length;
            bool permutation_is_valid      = true;
            int  i = 0;

            do
            {
                T grapheme = new T();
                grapheme.SetGrapheme(StringInRange(this.ToString(), i, grapheme_length));

                if (!graphemes.Exists(grapheme))
                {
                    permutation_is_valid = false;
                }

                i++;
            }while (i <= last_index_index_to_check && permutation_is_valid);

            return(permutation_is_valid);
        }
コード例 #3
0
        // PERMUTATIONS


        public IEnumerable <VariableLetterGroup> SortedAndAnalyzedUniquePermutations <T>(GraphemeSet <T> graphemes)
            where T : Grapheme, new()
        {
            var sorted = from element in AnalyzedUniquePermutations(graphemes)
                         orderby element.ToString()
                         select element;

            foreach (VariableLetterGroup vlg in sorted)
            {
                yield return(vlg);
            }
        }