Ejemplo n.º 1
0
 /// <summary>
 /// resizes the collection
 /// </summary>
 /// <param name="size">new size</param>
 public void Resize(int size)
 {
     System.Diagnostics.Debug.Assert(size >= filled);
     BoneArray[] newArray = new BoneArray[size];
     Array.Copy(array, newArray, filled);
     array = newArray;
 }
Ejemplo n.º 2
0
        //---------------------------------------------------------------
        #endregion
        //---------------------------------------------------------------

        //---------------------------------------------------------------
        #region Methods
        //---------------------------------------------------------------
        /// <summary>
        /// adds a BoneArray to the list
        /// </summary>
        /// <param name="boneArray">boneArray to add</param>
        public void Add(BoneArray boneArray)
        {
            if (array == null)
            {
                array = new BoneArray[2];
            }
            else if (array.Length <= filled)
            {
                Resize(array.Length * 2);
            }
            array[filled] = boneArray;
            filled++;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// remove a boneArray from the list
        /// remove doesn't preserves the order right now
        /// </summary>
        /// <param name="boneArray">boneArray to remove</param>
        public void Remove(BoneArray boneArray)
        {
            int i = 0;

            while (i < filled)
            {
                if (array[i] == boneArray)
                {
                    array[i] = array[filled - 1];
                    filled--;
                    return;
                }
                i++;
            }
        }