//Adapted from: https://stackoverflow.com/a/8567550 protected void PrintNode(UnbalancedTreeNode <T> other, bool last, Log log, string indent = "") { log.Write(LogLevel.Debug, indent + "+- " + string.Format("[{0}]", other.Value)); indent += last ? " " : "| "; for (int i = 0; i < other.Children.Count; i++) { PrintNode(other.Children[i], i == other.Children.Count - 1, log, indent); } }
public bool Equals(UnbalancedTreeNode <T> other) { return(this.Value.Equals(other.Value)); }
public void AddChild(UnbalancedTreeNode <T> child) { child.Parent = this; this.Children.Add(child); }
public void RemoveChild(UnbalancedTreeNode <T> child) { this.Children.Remove(child); child.Parent = null; }
public UnbalancedTreeNode(T value, UnbalancedTreeNode <T> parent) { this.Value = value; this.Children = new List <UnbalancedTreeNode <T> >(); this.Parent = parent; }