public void RemoveChild(TopicNode child) { var children = ChildNodes.ToList(); children.Remove(child); child._parent = null; child._previous = null; child._next = null; if (!children.Any()) { _firstChild = null; return; } _firstChild = children.First(); _firstChild._parent = this; _firstChild._previous = null; children.Last()._next = null; for (int i = 1; i < children.Count; i++) { children[i]._previous = children[i - 1]; } for (int i = 0; i < children.Count - 1; i++) { children[i]._next = children[i + 1]; } }
public void PrependChild(TopicNode node) { if (_firstChild != null) { _firstChild._previous = node; node._next = _firstChild; } FirstChild = node; }
public void InsertAfter(TopicNode node) { if (_next != null) { _next._previous = node; node._next = _next; } node._previous = this; _next = node; }
public void AppendChild(TopicNode node) { var last = LastChild; if (last == null) { FirstChild = node; } else { last.InsertAfter(node); } }
public void InsertBefore(TopicNode node) { if (_previous == null) { if (_parent != null) { _parent.PrependChild(node); } else { node._next = this; _previous = node; } } else { _previous._next = node; node._previous = _previous; node._next = this; _previous = node; } }
public TopicExpression(TopicNode parent, TopicGraph graph) { _parent = parent; _graph = graph; }
protected bool Equals(TopicNode other) { return(Equals(_topicType, other._topicType)); }