1 /* 2 * Copyright 2001-2004 The Apache Software Foundation 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.apache.commons.collections; 17 18 /** 19 * Defines a collection for priority queues, which can insert, peek and pop. 20 * <p> 21 * This interface is now replaced by the <code>Buffer</code> interface. 22 * 23 * @deprecated Replaced by the Buffer interface and implementations in buffer subpackage. 24 * Due to be removed in v4.0. 25 * @since Commons Collections 1.0 26 * @version $Revision: 1.14 $ $Date: 2004/02/18 01:15:42 $ 27 * 28 * @author Peter Donald 29 */ 30 public interface PriorityQueue { 31 32 /** 33 * Clear all elements from queue. 34 */ 35 void clear(); 36 37 /** 38 * Test if queue is empty. 39 * 40 * @return true if queue is empty else false. 41 */ 42 boolean isEmpty(); 43 44 /** 45 * Insert an element into queue. 46 * 47 * @param element the element to be inserted 48 * 49 * @throws ClassCastException if the specified <code>element</code>'s 50 * type prevents it from being compared to other items in the queue to 51 * determine its relative priority. 52 */ 53 void insert(Object element); 54 55 /** 56 * Return element on top of heap but don't remove it. 57 * 58 * @return the element at top of heap 59 * @throws java.util.NoSuchElementException if <code>isEmpty() == true</code> 60 */ 61 Object peek(); 62 63 /** 64 * Return element on top of heap and remove it. 65 * 66 * @return the element at top of heap 67 * @throws java.util.NoSuchElementException if <code>isEmpty() == true</code> 68 */ 69 Object pop(); 70 71 } 72