public virtual void AddNode(FastTreeNode node) { if (node.Parent != this) { childs.Add(node); } SetParent(this); }
protected virtual void SetParent(FastTreeNode value) { if (parent != null && parent != value) { parent.childs.Remove(this); } parent = value; }
public FastTreeNode GetParent(Predicate <object> tagCondition) { var parent = Parent; while (parent != null && !tagCondition(parent)) { parent = parent.parent; } return(parent); }
public virtual void InsertNodeBefore(FastTreeNode existsNode, FastTreeNode node) { var i = childs.IndexOf(existsNode); if (i < 0) { i = 0; } InsertNode(i, node); }
public virtual void InsertNodeBefore(FastTreeNode existsNode, IEnumerable <FastTreeNode> nodes) { var i = childs.IndexOf(existsNode); if (i < 0) { i = 0; } InsertNode(i, nodes); }
public virtual void InsertNodeAfter(FastTreeNode existsNode, FastTreeNode node) { var i = childs.IndexOf(existsNode) + 1; InsertNode(i, node); }
public virtual void InsertNode(int index, FastTreeNode node) { childs.Insert(index, node); SetParent(this); }
public virtual void RemoveNode(FastTreeNode node) { childs.Remove(node); SetParent(null); }
public int IndexOf(FastTreeNode node) { return(childs.IndexOf(node)); }
public virtual void InsertNodeAfter(FastTreeNode existsNode, IEnumerable <FastTreeNode> nodes) { var i = childs.IndexOf(existsNode) + 1; InsertNode(i, nodes); }