Example #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);
        }
Example #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;
        }
Example #3
0
 public void CopyFrom(QueueCopyable <T> other)
 {
     ArrayUtils.Copy(other.innerArray, ref this.innerArray);
     this.head     = other.head;
     this.tail     = other.tail;
     this.Count    = other.Count;
     this.Capacity = other.Capacity;
 }
Example #4
0
        public void CopyFrom(QueueCopyable <T> other)
        {
            if (this.array.arr != null)
            {
                PoolArray <T> .Recycle(ref this.array);
            }
            this.array = PoolArray <T> .Spawn(other.array.Length);

            System.Array.Copy(other.array.arr, this.array.arr, other.array.Length);

            this.head     = other.head;
            this.tail     = other.tail;
            this.size     = other.size;
            this.version  = other.version;
            this.capacity = other.capacity;
        }
Example #5
0
 internal Enumerator(QueueCopyable <T> q)
 {
     this._q             = q;
     this.index          = -1;
     this.currentElement = default(T);
 }