IsEmpty

From TRCCompSci - AQA Computer Science
Jump to: navigation, search
            public bool IsEmpty()
            {
                if (this.Rear == -1)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }

This section of code checks to see if the last position in the queue is empty, to determine if the queue is full or not, and thus whether more data can be added. If the position is free, the method returns true. If it is not free, the method returns false.