コード例 #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;
 }
コード例 #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++;
        }
コード例 #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++;
            }
        }