// Enqueue adds a new pagenumber to the queue
Enqueue adds a new pagenumber to the queue
// Enqueue adds a new pagenumber to the queue
func (q *Queue) Enqueue(h *Hash, pageNumber int) {
	if q.IsQueueFull() {
		h.Array[q.Rear.PageNumber] = nil
		q.DeQueue()
	}
	node := NewNode(pageNumber)
	node.Next = q.Front
	if q.IsQueueEmpty() {
		q.Front = node
		q.Rear = node
	} else {
		q.Front.Previous = node
		q.Front = node
	}
	h.Array[pageNumber] = node
	q.NoOfFilledPages++
}
func ( q * Queue ) Enqueue ( h * Hash , pageNumber int ) { if q . IsQueueFull ( ) { h . Array [ q . Rear . PageNumber ] = nil q . DeQueue ( ) } node := NewNode ( pageNumber ) node . Next = q . Front if q . IsQueueEmpty ( ) { q . Front = node q . Rear = node } else { q . Front . Previous = node q . Front = node } h . Array [ pageNumber ] = node q . NoOfFilledPages ++ }
Enqueue adds a new pagenumber to the queue
Enqueue adds a new pagenumber to the queue
// If the queue is full, remove the one at the back