|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.homeunix.thecave.moss.data.HeapSet<Type>
public class HeapSet<Type extends java.lang.Comparable<Type>>
A fairly robust Heap implementation using Java 5 generics. Allows for either Min or Max heap. Does not allow for duplicate entries (since it implements the Set interface).
| Nested Class Summary | |
|---|---|
static class |
HeapSet.HeapType
|
| Field Summary | |
|---|---|
static long |
serialVersionUID
|
| Constructor Summary | |
|---|---|
HeapSet()
Creates a new min heap. |
|
HeapSet(java.util.Collection<Type> arg0)
Creates a new min heap containing the specified items |
|
HeapSet(java.util.Collection<Type> arg0,
HeapSet.HeapType arg1)
Creates a new heap containing the specified items, with the specified heap type. |
|
HeapSet(HeapSet.HeapType arg0)
Creates a new heap of the specified heap type. |
|
| Method Summary | ||
|---|---|---|
boolean |
add(Type arg0)
Adds an object to the heap |
|
boolean |
addAll(java.util.Collection<? extends Type> arg0)
Add all the objects in the collection to the heap |
|
void |
clear()
|
|
boolean |
contains(java.lang.Object arg0)
|
|
boolean |
containsAll(java.util.Collection<?> arg0)
|
|
Type |
dequeue()
Removes and returns the top element in the heap |
|
boolean |
enqueue(Type arg0)
Adds the specified element to the heap. |
|
Type |
get(int i)
Allows for random access of the heap data. |
|
java.util.Collection<Type> |
getAll()
Get all of the items in the set. |
|
Type |
getTop()
Returns the top element in the heap without removing it. |
|
boolean |
isEmpty()
|
|
java.util.Iterator<Type> |
iterator()
|
|
boolean |
remove(java.lang.Object arg0)
|
|
boolean |
removeAll(java.util.Collection<?> arg0)
|
|
boolean |
retainAll(java.util.Collection<?> arg0)
|
|
int |
size()
|
|
java.lang.Object[] |
toArray()
|
|
|
toArray(T[] arg0)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.Set |
|---|
equals, hashCode |
| Field Detail |
|---|
public static final long serialVersionUID
| Constructor Detail |
|---|
public HeapSet()
public HeapSet(java.util.Collection<Type> arg0)
arg0 - public HeapSet(HeapSet.HeapType arg0)
arg0 -
public HeapSet(java.util.Collection<Type> arg0,
HeapSet.HeapType arg1)
arg0 - arg1 - | Method Detail |
|---|
public boolean add(Type arg0)
add in interface java.util.Collection<Type extends java.lang.Comparable<Type>>add in interface java.util.Set<Type extends java.lang.Comparable<Type>>arg0 -
public boolean addAll(java.util.Collection<? extends Type> arg0)
addAll in interface java.util.Collection<Type extends java.lang.Comparable<Type>>addAll in interface java.util.Set<Type extends java.lang.Comparable<Type>>arg0 -
public void clear()
clear in interface java.util.Collection<Type extends java.lang.Comparable<Type>>clear in interface java.util.Set<Type extends java.lang.Comparable<Type>>public boolean contains(java.lang.Object arg0)
contains in interface java.util.Collection<Type extends java.lang.Comparable<Type>>contains in interface java.util.Set<Type extends java.lang.Comparable<Type>>public boolean containsAll(java.util.Collection<?> arg0)
containsAll in interface java.util.Collection<Type extends java.lang.Comparable<Type>>containsAll in interface java.util.Set<Type extends java.lang.Comparable<Type>>public Type dequeue()
public boolean enqueue(Type arg0)
arg0 - The element to add.
true if the heap changed as a result of this add.public Type getTop()
public Type get(int i)
i -
public boolean isEmpty()
isEmpty in interface java.util.Collection<Type extends java.lang.Comparable<Type>>isEmpty in interface java.util.Set<Type extends java.lang.Comparable<Type>>public java.util.Iterator<Type> iterator()
iterator in interface java.lang.Iterable<Type extends java.lang.Comparable<Type>>iterator in interface java.util.Collection<Type extends java.lang.Comparable<Type>>iterator in interface java.util.Set<Type extends java.lang.Comparable<Type>>public boolean remove(java.lang.Object arg0)
remove in interface java.util.Collection<Type extends java.lang.Comparable<Type>>remove in interface java.util.Set<Type extends java.lang.Comparable<Type>>public boolean removeAll(java.util.Collection<?> arg0)
removeAll in interface java.util.Collection<Type extends java.lang.Comparable<Type>>removeAll in interface java.util.Set<Type extends java.lang.Comparable<Type>>public boolean retainAll(java.util.Collection<?> arg0)
retainAll in interface java.util.Collection<Type extends java.lang.Comparable<Type>>retainAll in interface java.util.Set<Type extends java.lang.Comparable<Type>>public int size()
size in interface java.util.Collection<Type extends java.lang.Comparable<Type>>size in interface java.util.Set<Type extends java.lang.Comparable<Type>>public java.lang.Object[] toArray()
toArray in interface java.util.Collection<Type extends java.lang.Comparable<Type>>toArray in interface java.util.Set<Type extends java.lang.Comparable<Type>>public <T> T[] toArray(T[] arg0)
toArray in interface java.util.Collection<Type extends java.lang.Comparable<Type>>toArray in interface java.util.Set<Type extends java.lang.Comparable<Type>>public java.util.Collection<Type> getAll()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||