public void InsertAfter (TypedSegment segment, TreeNode newSegment) { var newNode = new RedBlackTree<TreeNode>.RedBlackTreeNode (newSegment); RedBlackTree<TreeNode>.RedBlackTreeIterator iter = segment != null ? segment.Iter : null; if (iter == null) { tree.Root = newNode; newSegment.treeNode = tree.Root; tree.Count = 1; return; } if (iter.Node.Right == null) { tree.Insert (iter.Node, newNode, false); } else { tree.Insert (iter.Node.Right.OuterLeft, newNode, true); } newSegment.treeNode = newNode; UpdateNode (newNode); }
public void ChangeLength (TypedSegment segment, int newLength) { segment.Length = newLength; UpdateNode (segment.treeNode); }