Package com.ibm.wala.util.collections
Class Heap<T>
- java.lang.Object
-
- com.ibm.wala.util.collections.Heap<T>
-
- Direct Known Subclasses:
Worklist
public abstract class Heap<T> extends java.lang.Object
Simple Heap data structure.
-
-
Constructor Summary
Constructors Constructor Description Heap(int initialCapacity)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract boolean
compareElements(T elt1, T elt2)
void
insert(T elt)
boolean
isEmpty()
int
size()
T
take()
java.lang.String
toString()
-
-
-
Method Detail
-
compareElements
protected abstract boolean compareElements(T elt1, T elt2)
- Returns:
- true iff elt1 is considered < elt2
-
size
public int size()
- Returns:
- number of elements in this heap
-
isEmpty
public final boolean isEmpty()
- Returns:
- true iff this heap is non-empty
-
insert
public void insert(T elt)
-
take
public T take() throws java.util.NoSuchElementException
- Returns:
- the first object in the priority queue
- Throws:
java.util.NoSuchElementException
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-