diff --git a/queue.go b/queue.go index 56218bb..20ee6aa 100644 --- a/queue.go +++ b/queue.go @@ -11,17 +11,18 @@ const minQueueLen = 16 +// Queue represents a single instance of the queue data structure. type Queue struct { buf []interface{} head, tail, count int } -// New constructs and returns a new Queue +// New constructs and returns a new Queue. func New() *Queue { return &Queue{buf: make([]interface{}, minQueueLen)} } -// Length returns the number of elements currently stored in the queue +// Length returns the number of elements currently stored in the queue. func (q *Queue) Length() int { return q.count } @@ -41,7 +42,7 @@ q.buf = newBuf } -// Add puts an element on the end of the queue +// Add puts an element on the end of the queue. func (q *Queue) Add(elem interface{}) { if q.count == len(q.buf) { q.resize()