Ejemplo n.º 1
0
 public IEnumerable <FormattedString> Permute()
 {
     if (!NextParts.Any())
     {
         yield return(ThisPart);
     }
     else
     {
         foreach (var commandPart in NextParts.SelectMany(o => o.Permute()))
         {
             yield return($"{ThisPart} {commandPart}");
         }
     }
 }
Ejemplo n.º 2
0
 public IEnumerable <CommandPart> PermuteCommands()
 {
     if (!NextParts.Any())
     {
         yield return(this);
     }
     else
     {
         foreach (var commandPart in NextParts.SelectMany(o => o.PermuteCommands()))
         {
             yield return(new CommandPart(ThisPart, commandPart));
         }
     }
 }
Ejemplo n.º 3
0
 public IEnumerable <FormattedString> GetLevel(int level)
 {
     if (level == 0)
     {
         yield return(ThisPart);
     }
     else
     {
         foreach (var commandPart in NextParts.SelectMany(o => o.GetLevel(level - 1)))
         {
             yield return(commandPart);
         }
     }
 }