public bool is_parent_of(HierarchicalData <T> tree) { foreach (var node in childrens) { if (node == tree || node.is_parent_of(tree)) { return(true); } } return(false); }
public void addChild(HierarchicalData <T> child_data) { childrens.Add(child_data); child_data.parent = this; }
public HierarchicalData(T value, HierarchicalData <T> parent_value) { this.data = value; this.parent = parent_value; }