public void AddCombo(ComboAction[] combo) { List<CTMBranch> current = branches; bool found = true; foreach (ComboAction c in combo) { if (found) { found = false; foreach (CTMBranch b in current) { if (c == b.Key) { current = b.Branches; found = true; break; } } } if (!found) { CTMBranch b = new CTMBranch(c); current.Add(b); current = b.Branches; } } if (combo.Length > longest) longest = combo.Length; }
//recursive portion of finalize private CTBranch fillBranch(CTMBranch from) { if(from.Branches.Count == 0) return new CTBranch(from.Key, null); CTBranch[] branches = new CTBranch[from.Branches.Count]; for (int i = 0; i < from.Branches.Count; i++) branches[i] = fillBranch(from.Branches[i]); return new CTBranch(from.Key, branches); }
//recursive portion of finalize private CTBranch fillBranch(CTMBranch from) { if (from.Branches.Count == 0) { return(new CTBranch(from.Key, null)); } CTBranch[] branches = new CTBranch[from.Branches.Count]; for (int i = 0; i < from.Branches.Count; i++) { branches[i] = fillBranch(from.Branches[i]); } return(new CTBranch(from.Key, branches)); }
public void AddCombo(ComboAction[] combo) { List <CTMBranch> current = branches; bool found = true; foreach (ComboAction c in combo) { if (found) { found = false; foreach (CTMBranch b in current) { if (c == b.Key) { current = b.Branches; found = true; break; } } } if (!found) { CTMBranch b = new CTMBranch(c); current.Add(b); current = b.Branches; } } if (combo.Length > longest) { longest = combo.Length; } }