Exemple #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);
        }
Exemple #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;
        }
Exemple #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);
        }
Exemple #4
0
 public void Initialize()
 {
     if (this.values == null)
     {
         this.values = PoolDictionaryCopyable <long, float> .Spawn(10);
     }
     if (this.indexes == null)
     {
         this.indexes = PoolHashSetCopyable <int> .Spawn();
     }
 }
Exemple #5
0
        public void Dispose()
        {
            PoolDictionaryCopyable <long, float> .Recycle(ref this.values);

            PoolHashSetCopyable <int> .Recycle(ref this.indexes);
        }
Exemple #6
0
        void IPoolableRecycle.OnRecycle()
        {
            PoolArray <T> .Recycle(ref this.arr);

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