internal static int CountNodes(GreenNode green) { int n = 0; for (int i = 0, s = green.SlotCount; i < s; i++) { var child = green.GetSlot(i); if (child != null) { if (!child.IsList) { n++; } else { n += child.SlotCount; } } } return(n); }
/// <summary> /// get the green node at the given slot /// </summary> private static GreenNode GetGreenNodeAt(GreenNode node, int i) { Debug.Assert(node.IsList || (i == 0 && !node.IsList)); return(node.IsList ? node.GetSlot(i) : node); }