Beispiel #1
0
        /// <summary>
        /// Adds the elements of the specified collection to the end of the List
        /// </summary>
        /// <param name="collection">The collection whose elements should be added to the end of the List. The collection itself cannot be null.</param>
        public unsafe void AddRange(doubleListAccessor collection)
        {
            if (collection == null)
            {
                throw new ArgumentNullException("collection is null.");
            }
            int delta = collection.length;

            if (collection.CellID != CellID)
            {
                CellPtr = ResizeFunction(CellPtr - 4, *(int *)(CellPtr - 4) + 4, delta);
                Memory.Copy(collection.CellPtr, CellPtr + *(int *)CellPtr + 4, delta);
                *(int *)CellPtr += delta;
            }
            else
            {
                byte[] tmpcell = new byte[delta];
                fixed(byte *tmpcellptr = tmpcell)
                {
                    Memory.Copy(collection.CellPtr, tmpcellptr, delta);
                    CellPtr = ResizeFunction(CellPtr - 4, *(int *)(CellPtr - 4) + 4, delta);
                    Memory.Copy(tmpcellptr, CellPtr + *(int *)CellPtr + 4, delta);
                    *(int *)CellPtr += delta;
                }
            }
            this.CellPtr += 4;
        }
Beispiel #2
0
        /// <summary>
        /// Adds the elements of the specified collection to the end of the List
        /// </summary>
        /// <param name="collection">The collection whose elements should be added to the end of the List. The collection itself cannot be null.</param>
        public unsafe void AddRange(List <double> collection)
        {
            if (collection == null)
            {
                throw new ArgumentNullException("collection is null.");
            }
            doubleListAccessor tcollection = collection;
            int delta = tcollection.length;

            CellPtr = ResizeFunction(CellPtr - 4, *(int *)(CellPtr - 4) + 4, delta);
            Memory.Copy(tcollection.CellPtr, CellPtr + *(int *)CellPtr + 4, delta);
            *(int *)CellPtr += delta;
            this.CellPtr    += 4;
        }
Beispiel #3
0
        /// <summary>
        /// Inserts the elements of a collection into the List at the specified index.
        /// </summary>
        /// <param name="index">The zero-based index at which the new elements should be inserted.</param>
        /// <param name="collection">The collection whose elements should be inserted into the List. The collection itself cannot be null, but it can contain elements that are null, if type T is a reference type.</param>
        public unsafe void InsertRange(int index, List <double> collection)
        {
            if (collection == null)
            {
                throw new ArgumentNullException("collection is null.");
            }
            if (index < 0)
            {
                throw new ArgumentOutOfRangeException("index is less than 0.");
            }
            if (index > Count)
            {
                throw new ArgumentOutOfRangeException("index is greater than Count.");
            }
            doubleListAccessor tmpAccessor = collection;
            byte *targetPtr = CellPtr + (index << 3);
            int   offset    = (int)(targetPtr - CellPtr);

            CellPtr = ResizeFunction(CellPtr - 4, offset + 4, tmpAccessor.length);
            Memory.Copy(tmpAccessor.CellPtr, CellPtr + offset + 4, tmpAccessor.length);
            *(int *)CellPtr += tmpAccessor.length;
            this.CellPtr    += 4;
        }
Beispiel #4
0
 internal _iterator(doubleListAccessor target)
 {
     targetPtr = target.CellPtr;
     endPtr    = target.CellPtr + target.length;
 }