Пример #1
0
 ///<summary>
 ///Creates a XArrayHelper and copies the values from a XArrayHelper.
 ///</summary>
 ///<param name="table">The source XArrayHelper to be copied.</param>
 public void LoadRows(XArrayHelper table)
 {
     this.RedimXArray(new int[] { table.GetUpperBound(0), table.GetUpperBound(1) }, new int[] { table.GetLowerBound(0), table.GetLowerBound(1) });
     for (int row = table.GetLowerBound(0); row <= table.GetUpperBound(0); row++)
     {
         for (int col = table.GetLowerBound(1); col <= table.GetUpperBound(1); col++)
         {
             this.SetValue(table.GetValue(row, col), row, col);
         }
     }
 }
Пример #2
0
        ///<summary>
        ///Clears a range of elements in the XArrayHelper.
        ///</summary>
        ///<param name="arr">XArrayHelper whose elements need to be cleared.</param>
        ///<param name="index">The starting index of the range of elements.</param>
        ///<param name="length">The number of elements to be cleared.</param>
        public static void Clear(XArrayHelper arr, int index, int length)
        {
            int realIndexi = arr.GetLowerBound(0);
            int realIndexj = arr.GetLowerBound(1);

            index = index - arr.GetLowerBound(0);

            while (index > 0)
            {
                if (index > arr.GetUpperBound(1))
                {
                    realIndexi = realIndexi + 1;
                    index      = index - arr.GetLength(1);
                }
                else
                {
                    realIndexj = realIndexj + index;
                    index      = 0;
                }
            }

            for (int j = realIndexj; j <= arr.GetUpperBound(1); j++)
            {
                if (length < 0)
                {
                    return;
                }
                arr[realIndexi, j] = null;
                length             = length - 1;
            }

            realIndexi = realIndexi + 1;

            for (int i = realIndexi; i <= arr.GetUpperBound(0); i++)
            {
                for (int j = arr.GetLowerBound(1); j <= arr.GetUpperBound(1); j++)
                {
                    if (length < 1)
                    {
                        return;
                    }
                    arr[i, j] = null;
                    length    = length - 1;
                }
            }
        }
Пример #3
0
        ///<summary>
        ///Clears a range of elements in the XArrayHelper.
        ///</summary>
        ///<param name="arr">XArrayHelper whose elements need to be cleared.</param>
        ///<param name="index">The starting index of the range of elements.</param>
        ///<param name="length">The number of elements to be cleared.</param>
        public static void Clear(XArrayHelper arr, int index, int length)
        {
            int realIndexi = arr.GetLowerBound(0);
            int realIndexj = arr.GetLowerBound(1);

            index = index - arr.GetLowerBound(0);

            while (index > 0)
            {
                if (index > arr.GetUpperBound(1))
                {
                    realIndexi = realIndexi + 1;
                    index = index - arr.GetLength(1);
                }
                else
                {
                    realIndexj = realIndexj + index;
                    index = 0;
                }
            }

            for (int j = realIndexj; j <= arr.GetUpperBound(1); j++)
            {
                if (length < 0) return;
                arr[realIndexi, j] = null;
                length = length - 1;
            }

            realIndexi = realIndexi + 1;

            for (int i = realIndexi; i <= arr.GetUpperBound(0); i++)
            {
                for (int j = arr.GetLowerBound(1); j <= arr.GetUpperBound(1); j++)
                {
                    if (length < 1) return;
                    arr[i, j] = null;
                    length = length - 1;
                }
            }
        }
Пример #4
0
 ///<summary>
 ///Creates a XArrayHelper and copies the values from a XArrayHelper.
 ///</summary>
 ///<param name="table">The source XArrayHelper to be copied.</param>
 public void LoadRows(XArrayHelper table)
 {
     this.RedimXArray(new int[] { table.GetUpperBound(0), table.GetUpperBound(1) }, new int[] { table.GetLowerBound(0), table.GetLowerBound(1) });
     for (int row = table.GetLowerBound(0); row <= table.GetUpperBound(0); row++)
     {
         for (int col = table.GetLowerBound(1); col <= table.GetUpperBound(1); col++)
         {
             this.SetValue(table.GetValue(row, col), row, col);
         }
     }
 }