private int Depth(int cdepth) { if (!NextParts.Any()) { return(cdepth); } return(cdepth + NextParts.Max(o => o.Depth(cdepth + 1))); }
public void Extend(FormattedString[] pre, CommandPart p) { if (pre.Length > 0 && NextParts.Any(o => o.ThisPart == pre[0])) { NextParts.First(o => o.ThisPart.Equals(pre[0])).Extend(pre.Skip(1).ToArray(), p); } else if (CType == CommandType.StaticList) { _staticList.Add(p); } }
public void Extend(params FormattedString[] p) { if (NextParts.Any(o => o.ThisPart == p[0])) { NextParts.First(o => o.ThisPart.Equals(p[0])).Extend(p.Skip(1).ToArray()); } else if (CType == CommandType.StaticList) { _staticList.Add(FromArray(p)); } }
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)); } } }
public IEnumerable <FormattedString> Permute() { if (!NextParts.Any()) { yield return(ThisPart); } else { foreach (var commandPart in NextParts.SelectMany(o => o.Permute())) { yield return($"{ThisPart} {commandPart}"); } } }