Ejemplo n.º 1
0
            public BucketCircularArray(int size)
            {
                AtomicReferenceArray <Bucket> buckets = new AtomicReferenceArray <Bucket>(size + 1); // + 1 as extra room for the add/remove;

                state      = new AtomicReference <ListState>(new ListState(this, buckets, 0, 0));
                dataLength = buckets.Length;
                numBuckets = size;
            }
 public ListState(BucketCircularArray cb, AtomicReferenceArray <Bucket> data, int head, int tail)
 {
     this.cb   = cb;
     this.head = head;
     this.tail = tail;
     if (head == 0 && tail == 0)
     {
         size = 0;
     }
     else
     {
         this.size = (tail + cb.dataLength - head) % cb.dataLength;
     }
     this.data = data;
 }
Ejemplo n.º 3
0
                public ListState(BucketCircularArray ca, AtomicReferenceArray <Bucket> data, int head, int tail)
                {
                    this._ca   = ca;
                    this._head = head;
                    this._tail = tail;
                    if (head == 0 && tail == 0)
                    {
                        _size = 0;
                    }
                    else
                    {
                        this._size = (tail + ca.dataLength - head) % ca.dataLength;
                    }

                    this._data = data;
                }
                public ListState(BucketCircularArray cb, AtomicReferenceArray <Bucket> data, int head, int tail)
                {
                    _cb         = cb;
                    _head       = head;
                    _buckettail = tail;
                    if (head == 0 && tail == 0)
                    {
                        _size = 0;
                    }
                    else
                    {
                        _size = (tail + cb._dataLength - head) % cb._dataLength;
                    }

                    _data = data;
                }