// Token: 0x060035C7 RID: 13767 RVA: 0x000F4680 File Offset: 0x000F2880 internal static SplayTreeNode Join(SplayTreeNode leftSubTree, SplayTreeNode rightSubTree) { Invariant.Assert(leftSubTree == null || leftSubTree.ParentNode == null); Invariant.Assert(rightSubTree == null || rightSubTree.ParentNode == null); SplayTreeNode splayTreeNode; if (leftSubTree != null) { splayTreeNode = leftSubTree.GetMaxSibling(); splayTreeNode.Splay(); Invariant.Assert(splayTreeNode.Role == SplayTreeNodeRole.LocalRoot); Invariant.Assert(splayTreeNode.RightChildNode == null); splayTreeNode.RightChildNode = rightSubTree; if (rightSubTree != null) { rightSubTree.ParentNode = splayTreeNode; } } else if (rightSubTree != null) { splayTreeNode = rightSubTree; Invariant.Assert(splayTreeNode.Role == SplayTreeNodeRole.LocalRoot); } else { splayTreeNode = null; } return(splayTreeNode); }
// Token: 0x060035BD RID: 13757 RVA: 0x000F42F0 File Offset: 0x000F24F0 internal SplayTreeNode GetLastContainedNode() { SplayTreeNode containedNode = this.ContainedNode; if (containedNode == null) { return(null); } return(containedNode.GetMaxSibling()); }
// Combines two trees. Every node in leftSubTree will precede every node // in rightSubTree. // leftSubTree and/or rightSubTree may be null, returns null if both // trees are null. internal static SplayTreeNode Join(SplayTreeNode leftSubTree, SplayTreeNode rightSubTree) { SplayTreeNode maxNode; Invariant.Assert(leftSubTree == null || leftSubTree.ParentNode == null); Invariant.Assert(rightSubTree == null || rightSubTree.ParentNode == null); if (leftSubTree != null) { // Get max of leftSubTree, and splay it. maxNode = leftSubTree.GetMaxSibling(); maxNode.Splay(); Invariant.Assert(maxNode.Role == SplayTreeNodeRole.LocalRoot); Invariant.Assert(maxNode.RightChildNode == null); // Then merge the two trees. // No change to any LeftSymbolCounts. maxNode.RightChildNode = rightSubTree; if (rightSubTree != null) { rightSubTree.ParentNode = maxNode; } } else if (rightSubTree != null) { maxNode = rightSubTree; Invariant.Assert(maxNode.Role == SplayTreeNodeRole.LocalRoot); } else { maxNode = null; } return(maxNode); }
// Combines two trees. Every node in leftSubTree will precede every node // in rightSubTree. // leftSubTree and/or rightSubTree may be null, returns null if both // trees are null. internal static SplayTreeNode Join(SplayTreeNode leftSubTree, SplayTreeNode rightSubTree) { SplayTreeNode maxNode; Invariant.Assert(leftSubTree == null || leftSubTree.ParentNode == null); Invariant.Assert(rightSubTree == null || rightSubTree.ParentNode == null); if (leftSubTree != null) { // Get max of leftSubTree, and splay it. maxNode = leftSubTree.GetMaxSibling(); maxNode.Splay(); Invariant.Assert(maxNode.Role == SplayTreeNodeRole.LocalRoot); Invariant.Assert(maxNode.RightChildNode == null); // Then merge the two trees. // No change to any LeftSymbolCounts. maxNode.RightChildNode = rightSubTree; if (rightSubTree != null) { rightSubTree.ParentNode = maxNode; } } else if (rightSubTree != null) { maxNode = rightSubTree; Invariant.Assert(maxNode.Role == SplayTreeNodeRole.LocalRoot); } else { maxNode = null; } return maxNode; }