Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 /// <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);
 }