IsEmpty

From TRCCompSci - AQA Computer Science
Revision as of 13:31, 14 November 2017 by QuantumFluctuator (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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.