예제 #1
0
 public bool Match(Generated <T> CompareTo, int Index)
 {
     for (int i = -StartIndex; i + StartIndex < _Sets.Count; ++i)
     {
         if (Index + i < -1)
         {
             return(false);
         }
         else if (Index + i > CompareTo.Length)
         {
             return(false);
         }
         else if (Index + i == -1 && _Sets[i + StartIndex] != StartGenerated)
         {
             return(false);
         }
         else if (Index + i == CompareTo.Length && _Sets[i + StartIndex] != EndGenerated)
         {
             return(false);
         }
         else if (Index + i > -1 && Index + i < CompareTo.Length && !_Sets[i + StartIndex].Contains(CompareTo[Index + i]))
         {
             return(false);
         }
     }
     return(true);
 }
예제 #2
0
 public void Combine(Generated <T> Word)
 {
     if (Word != null)
     {
         foreach (T S in Word._Sounds)
         {
             _Sounds.Add(S);
         }
     }
 }
예제 #3
0
 public void Replace(Random Random, Generated <T> ReplaceIn, int Index)
 {
     if (_Match.Match(ReplaceIn, Index))
     {
         ReplaceIn.Remove(Index, _Match.Length);
         List <T>      New = new List <T>();
         Generated <T> R   = _Replacement.Generate(Random);
         foreach (T S in R)
         {
             New.Add(S);
         }
         ReplaceIn.Insert(Index, New);
     }
 }
예제 #4
0
        public Generated <T> Generate(Random Random)
        {
            Generated <T> Word = new Generated <T>();

            for (int i = 0; i < _Generators.Length; ++i)
            {
                Generated <T> w = _Generators[i].Generate(Random);
                if (w != null)
                {
                    Word.Combine(w);
                }
            }
            return(Word);
        }
예제 #5
0
 public bool Match(Generated <T> MatchIn, int Index)
 {
     return(_Match.Match(MatchIn, Index));
 }