public TestTreePart(TestTreePart parent, string value) { this.Parent = parent; this.Value = value; this.Children = new ReadOnlyCollection <TestTreePart>(m_children); if (this.Parent != null) { this.Parent.m_children.Add(this); } }
public void Setup() { /* * root * / | \ * a b c * /|\ | * / | \ | * aa ab ac ca * /|\ |\ * / | \ | \ * aba abb abc caa cab * */ root = new TestTreePart("root"); var a = new TestTreePart(root, "a"); b = new TestTreePart(root, "b"); var c = new TestTreePart(root, "c"); var a_a = new DerivedTreePart(a, "a.a"); var a_b = new TestTreePart(a, "a.b"); a_c = new DerivedTreePart(a, "a.c"); a_b_a = new DerivedTreePart(a_b, "a.b.a"); a_b_b = new TestTreePart(a_b, "a.b.b"); a_b_c = new TestTreePart(a_b, "a.b.c"); var c_a = new TestTreePart(c, "c.a"); c_a_a = new TestTreePart(c_a, "c.a.a"); end = new TestTreePart(c_a, "c.a.b"); m_tree = new TreeTraverser <TestTreePart>(root); Logger.Enable(); Logger.SetFlushAfterEachLog(true); }
public DerivedTreePart(TestTreePart parent, string value) : base(parent, value) { }
public static TestTreePart GetParent(TestTreePart treePart) { return(treePart?.Parent); }
public static IEnumerable <TestTreePart> GetChildren(TestTreePart treePart) { return(treePart.Children); }