1 /* 2 * Copyright 2017 The Netty Project 3 * 4 * The Netty Project licenses this file to you under the Apache License, 5 * version 2.0 (the "License"); you may not use this file except in compliance 6 * with the License. You may obtain a copy of the License at: 7 * 8 * https://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, WITHOUT 12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 * License for the specific language governing permissions and limitations 14 * under the License. 15 */ 16 package io.netty5.util.internal; 17 18 import java.util.Queue; 19 20 public interface PriorityQueue<T> extends Queue<T> { 21 /** 22 * Same as {@link #remove(Object)} but typed using generics. 23 */ 24 boolean removeTyped(T node); 25 26 /** 27 * Same as {@link #contains(Object)} but typed using generics. 28 */ 29 boolean containsTyped(T node); 30 31 /** 32 * Notify the queue that the priority for {@code node} has changed. The queue will adjust to ensure the priority 33 * queue properties are maintained. 34 * @param node An object which is in this queue and the priority may have changed. 35 */ 36 void priorityChanged(T node); 37 38 /** 39 * Removes all of the elements from this {@link PriorityQueue} without calling 40 * {@link PriorityQueueNode#priorityQueueIndex(DefaultPriorityQueue)} or explicitly removing references to them to 41 * allow them to be garbage collected. This should only be used when it is certain that the nodes will not be 42 * re-inserted into this or any other {@link PriorityQueue} and it is known that the {@link PriorityQueue} itself 43 * will be garbage collected after this call. 44 */ 45 void clearIgnoringIndexes(); 46 }