Exemplo n.º 1
0
        private void Init(int capacity)
        {
            if (capacity < 0)
            {
                capacity = 0;
            }

            this.count     = 0;
            this.size      = 0;
            this.capacity  = -1;
            this.fromIndex = 0;
            if (this.freePeek == null)
            {
                this.freePeek = PoolQueueCopyable <int> .Spawn(capacity);
            }
            this.freePeek.Clear();
            if (this.free == null)
            {
                this.free = PoolHashSetCopyable <int> .Spawn(capacity);
            }
            this.free.Clear();
            if (this.freePrepared == null)
            {
                this.freePrepared = PoolHashSetCopyable <int> .Spawn(capacity);
            }
            this.freePrepared.Clear();
            this.Resize_INTERNAL(capacity);
        }
Exemplo n.º 2
0
        public void CopyFrom(RefList <T> other)
        {
            ArrayUtils.Copy(in other.arr, ref this.arr);

            if (this.freePrepared != null)
            {
                PoolHashSetCopyable <int> .Recycle(ref this.freePrepared);
            }
            this.freePrepared = PoolHashSetCopyable <int> .Spawn(other.freePrepared.Count);

            this.freePrepared.CopyFrom(other.freePrepared);

            if (this.freePeek != null)
            {
                PoolQueueCopyable <int> .Recycle(ref this.freePeek);
            }
            this.freePeek = PoolQueueCopyable <int> .Spawn(other.freePeek.Count);

            this.freePeek.CopyFrom(other.freePeek);

            if (this.free != null)
            {
                PoolHashSetCopyable <int> .Recycle(ref this.free);
            }
            this.free = PoolHashSetCopyable <int> .Spawn(other.free.Count);

            this.free.CopyFrom(other.free);

            this.size         = other.size;
            this.capacity     = other.capacity;
            this.count        = other.count;
            this.fromIndex    = other.fromIndex;
            this.initCapacity = other.initCapacity;
        }
Exemplo n.º 3
0
        void IPoolableRecycle.OnRecycle()
        {
            PoolArray <T> .Recycle(ref this.arr);

            PoolQueueCopyable <int> .Recycle(ref this.freePeek);

            PoolHashSetCopyable <int> .Recycle(ref this.free);

            PoolHashSetCopyable <int> .Recycle(ref this.freePrepared);
        }