public void add(T i) { var ap = (i as Project)?.Name; if (c.ContainsKey(i)) { var r = c[i]; //parent of refTree containing the i RefTree <T> tr = r.subOf(i); //refTree containing the i Debug.Assert(tr != null, "Value suppose to contain i"); subs.Add(tr); if (r.d > d) { return; //do steal parent if it is deeper in tree. } //r.subs.Remove(tr); //tr.d = d + 1; tr.setLevel(d + 1); c[i] = this; return; } c.Add(i, this); var nr = new RefTree <T>(i, this, t, d + 1); subs.Add(nr); }
private RefTree(T i, RefTree <T> r, Func <T, IEnumerable <T> > t, int d) { this.i = i; this.t = t; this.d = d; this.all = r.all; c = r.c; all.Add(this); add(t(i)); }
public static RefTree <Project> getProjectReferences(string name) { var p = getProject(name); if (p == null) { if (ide != null) { WriteLine($@"Couldn't find project named ""{name}"" in ""{solutionName}"" solution."); } return(null); } RefTree <Project> .toString = (r) => r.i.Name; var rt = new RefTree <Project>(p, i => i.projectReferences()); return(rt); }