pylucene 3.5.0-3
[pylucene.git] / lucene-java-3.5.0 / lucene / contrib / facet / src / java / org / apache / lucene / facet / search / Heap.java
1 package org.apache.lucene.facet.search;
2
3 /**
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
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  */
19
20 /** 
21  * Declares an interface for heap (and heap alike) structures, 
22  * handling a given type T
23  * 
24  * @lucene.experimental
25  */
26 public interface Heap<T> {
27   /**
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.
31    */
32   public T pop();
33   
34   /** Get (But not remove) the top of the Heap */ 
35   public T top();
36   
37   /**
38    * Insert a new value, returning the overflowen object <br>
39    * NOTE: This method should not be called after invoking {@link #pop()}
40    */
41   public T insertWithOverflow(T value);
42   
43   /** 
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()}
48    */
49   public T add(T frn);
50   
51   /** Clear the heap */ 
52   public void clear();
53   
54   /** Return the amount of objects currently in the heap */
55   public int size();
56 }