|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectm865.datastructures.AbstractPriorityQueue
public abstract class AbstractPriorityQueue
Abstract class for the priority queue data structure. It implements enqueue, dequeue, peek, and all the methods of the Collections interface including the optional methods. Version 3.0 eliminated Cloneable to bring it in line with the java.util conventions.
Field Summary | |
---|---|
protected int |
hash
The cached value of the hash code for the queue. |
Constructor Summary | |
---|---|
AbstractPriorityQueue()
|
Method Summary | |
---|---|
boolean |
add(java.lang.Object obj)
Adds a Prioritizeable object to the priority queue. |
boolean |
addAll(java.util.Collection c)
Adds each object of the specified collection to the priority queue. |
abstract void |
adjustPriority(Prioritizeable obj,
java.lang.Comparable priority)
Finds the object and adjusts its priority. |
boolean |
contains(java.lang.Object obj)
Determines if the specified object is in the priority queue. |
boolean |
containsAll(java.util.Collection c)
Determines if the specified collection is contained in the queue. |
abstract java.lang.Object |
dequeue()
Removes and returns the object with the highest priority in the priority queue. |
protected void |
downdateHashCode(java.lang.Object obj)
Downdates the hash code for this queue |
abstract void |
enqueue(Prioritizeable p)
Adds a Prioritizeable to the priority queue. |
boolean |
equals(java.lang.Object obj)
The test for equality. |
int |
hashCode()
Returns the value of the hash code for this priority queue. |
boolean |
isEmpty()
Determines whether the queue is empty. |
abstract java.lang.Object |
peek()
Returns the object with the highest priority in the priority queue. |
boolean |
removeAll(java.util.Collection c)
Insures that each element of the specified collection is removed from the the priority queue. |
boolean |
retainAll(java.util.Collection c)
Removes all the elements of the priority queue that are not contained in the specified collection. |
java.lang.Object[] |
toArray()
Creates an array containing the objects in this priority queue. |
java.lang.Object[] |
toArray(java.lang.Object[] a)
Creates an array containing the objects in this priority queue. |
java.lang.String |
toString()
List the objects in the queue |
protected void |
updateHashCode(java.lang.Object obj)
Updates the hash code for this queue |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Collection |
---|
clear, iterator, remove, size |
Field Detail |
---|
protected int hash
Constructor Detail |
---|
public AbstractPriorityQueue()
Method Detail |
---|
public abstract void enqueue(Prioritizeable p)
p
- the Prioritizeable object to be added to the priority queue.public abstract java.lang.Object dequeue()
public abstract java.lang.Object peek()
public abstract void adjustPriority(Prioritizeable obj, java.lang.Comparable priority)
obj
- the object whose priority is to be changedpriority
- the new priority for the objectpublic boolean add(java.lang.Object obj)
add
in interface java.util.Collection
obj
- the object to be added to the priority queue. A ClassCastException
will be thrown if the object is not an instance of a Prioritizable.
public boolean addAll(java.util.Collection c)
addAll
in interface java.util.Collection
c
- the collection of objects to be added to the priority queue.
A ClassCastException will be thrown if any object in the collection is
not an instance of a Prioritizable.
public boolean contains(java.lang.Object obj)
contains
in interface java.util.Collection
obj
- the object to be found in the priority queue.
public boolean containsAll(java.util.Collection c)
containsAll
in interface java.util.Collection
c
- the collection of objects to be found in the queue.
public boolean equals(java.lang.Object obj)
equals
in interface java.util.Collection
equals
in class java.lang.Object
obj
- the object which may be equal to this priority queue.
public int hashCode()
hashCode
in interface java.util.Collection
hashCode
in class java.lang.Object
protected void updateHashCode(java.lang.Object obj)
obj
- the object being added to the queueprotected void downdateHashCode(java.lang.Object obj)
obj
- the object being removeed from the queuepublic boolean isEmpty()
isEmpty
in interface java.util.Collection
public boolean removeAll(java.util.Collection c)
removeAll
in interface java.util.Collection
c
- the specified collection
public boolean retainAll(java.util.Collection c)
retainAll
in interface java.util.Collection
c
- the specified collection
public java.lang.Object[] toArray()
toArray
in interface java.util.Collection
public java.lang.Object[] toArray(java.lang.Object[] a)
toArray
in interface java.util.Collection
a
- an array of objects whose run type is compatible with all the
objects in the queue.
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |