Ejemplo n.º 1
0
 // <summary>Copies this object's data to a new array.</summary>
 // <param name='array'>A T[] object.</param>
 // <param name='arrayIndex'>Starting index to copy to.</param>
 public void CopyTo(T[] array, int arrayIndex)
 {
     if (array == null)
     {
         throw new ArgumentNullException("array");
     }
     if (arrayIndex < 0)
     {
         throw new ArgumentException("arrayIndex (" + arrayIndex +
                                     ") is less than 0");
     }
     if (this.treeValue != null)
     {
         RBCell t = this.treeValue.leftmost();
         while (t != null && arrayIndex < array.Length)
         {
             T v = t.element();
             if (arrayIndex >= 0 && arrayIndex < array.Length)
             {
                 array[arrayIndex] = v;
             }
             ++arrayIndex;
             t = t.successor();
         }
     }
 }
Ejemplo n.º 2
0
        private IEnumerable <T> Iterator()
        {
            if (this.treeValue != null)
            {
                RBCell t = this.treeValue.leftmost();
                while (t != null)
                {
                    T v = t.element();
                    yield return(v);

                    t = t.successor();
                }
            }
        }