示例#1
0
 public void pushFront(T val)
 {
     Contract.Assert(size < capacity);
     head_  = head_ - 1;
     size_ += 1;
     buff_ [head_.value] = val;
 }
示例#2
0
 public CircularBuffer(int capacity)
 {
     capacity_ = capacity;
     head_     = new ModularInt(0, capacity_);
     size_     = 0;
     buff_     = new T[capacity_];
 }
示例#3
0
        public T popFront()
        {
            Contract.Assert(size > 0);
            var index = head_;

            head_  = head_ + 1;
            size_ -= 1;
            return(buff_ [index.value]);
        }