toArray() public method

public toArray ( int i, DirCacheEntry dst, int off, int cnt ) : void
i int
dst DirCacheEntry
off int
cnt int
return void
Example #1
0
        ///	<summary>
        /// Add a range of existing entries from the destination cache.
        /// <para />
        /// The entries are placed at the end of the entry list, preserving their
        /// current order. The caller is responsible for making sure the final table
        /// is correctly sorted.
        /// <para />
        /// This method copies from the destination cache, which has not yet been
        /// updated with this editor's new table. So all offsets into the destination
        /// cache are not affected by any updates that may be currently taking place
        /// in this editor.
        /// <para />
        /// The <seealso cref="Entries"/> table is automatically expanded if there is
        /// insufficient space for the new additions.
        /// </summary>
        /// <param name="pos">First entry to copy from the destination cache. </param>
        /// <param name="cnt">Number of entries to copy.</param>
        protected void FastKeep(int pos, int cnt)
        {
            if (_entryCnt + cnt > _entries.Length)
            {
                int m1 = (_entryCnt + 16) * 3 / 2;
                int m2 = _entryCnt + cnt;
                var n  = new DirCacheEntry[Math.Max(m1, m2)];
                Array.Copy(_entries, 0, n, 0, _entryCnt);
                _entries = n;
            }

            _cache.toArray(pos, _entries, _entryCnt, cnt);
            _entryCnt += cnt;
        }