|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.limegroup.gnutella.util.BucketQueue
A discrete-case priority queue. Designed to be a replacement for BinaryHeap for the special case when there are only a small number of positive priorities, where larger numbers are higher priority. Unless otherwise noted, all methods have the same specifications as BinaryHeap. This also has a few additional methods not found in BinaryHeap. This class is not synchronized.
Constructor Summary | |
BucketQueue(BucketQueue other)
"Copy constructor": constructs a a new shallow copy of other. |
|
BucketQueue(int[] capacities)
|
|
BucketQueue(int priorities,
int capacityPerPriority)
|
Method Summary | |
void |
clear()
Removes all elements from the queue. |
java.lang.Object |
clone()
Returns a shallow copy of this, of type BucketQueue |
java.lang.Object |
extractMax()
|
java.lang.Object |
getMax()
|
java.lang.Object |
insert(java.lang.Object o,
int priority)
|
boolean |
isEmpty()
|
java.util.Iterator |
iterator()
|
java.util.Iterator |
iterator(int startPriority,
int n)
|
boolean |
removeAll(java.lang.Object o)
|
int |
size()
|
int |
size(int priority)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public BucketQueue(int priorities, int capacityPerPriority) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- priorities or capacityPerPriority
is non-positive.public BucketQueue(int[] capacities) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- capacities.length<=0 or
capacities[i]<=0 for any ipublic BucketQueue(BucketQueue other)
Method Detail |
public void clear()
public java.lang.Object insert(java.lang.Object o, int priority)
java.lang.IllegalArgumentException
- priority is not a legal priority,
as determined by this' constructorpublic boolean removeAll(java.lang.Object o)
public java.lang.Object extractMax() throws java.util.NoSuchElementException
java.util.NoSuchElementException
public java.lang.Object getMax() throws java.util.NoSuchElementException
java.util.NoSuchElementException
public int size()
public int size(int priority) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- priority is not a legal priority,
as determined by this' constructorpublic boolean isEmpty()
public java.util.Iterator iterator()
public java.util.Iterator iterator(int startPriority, int n) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- startPriority is not a legal priority
as determined by this' constructorpublic java.lang.Object clone()
public java.lang.String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |