1 package org.apache.lucene.facet.search;
4 * Licensed to the Apache Software Foundation (ASF) under one or more
5 * contributor license agreements. See the NOTICE file distributed with
6 * this work for additional information regarding copyright ownership.
7 * The ASF licenses this file to You under the Apache License, Version 2.0
8 * (the "License"); you may not use this file except in compliance with
9 * the License. You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 * Declares an interface for heap (and heap alike) structures,
22 * handling a given type T
24 * @lucene.experimental
26 public interface Heap<T> {
28 * Get and remove the top of the Heap <BR>
29 * NOTE: Once {@link #pop()} is called no other {@link #add(Object)} or
30 * {@link #insertWithOverflow(Object)} should be called.
34 /** Get (But not remove) the top of the Heap */
38 * Insert a new value, returning the overflowen object <br>
39 * NOTE: This method should not be called after invoking {@link #pop()}
41 public T insertWithOverflow(T value);
44 * Add a new value to the heap, return the new top(). <br>
45 * Some implementations may choose to not implement this functionality.
46 * In such a case <code>null</code> should be returned. <BR>
47 * NOTE: This method should not be called after invoking {@link #pop()}
54 /** Return the amount of objects currently in the heap */