|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectm865.datastructures.AbstractQueue
Abstract class for the queue data structure. It implements the enqueue, dequeue and convenience methods. The optional methods of the Collections interface, which would allow the queue integrity to be violated are not implemented and throw an UnsupportedOperation exception.
Field Summary | |
protected int |
hash
The cached value of the hash code for the queue. |
Constructor Summary | |
AbstractQueue()
|
Method Summary | |
boolean |
add(java.lang.Object obj)
Enqueues an object onto the end of the queue. |
boolean |
addAll(java.util.Collection c)
Enqueues each object of the specified collection onto the queue. |
boolean |
contains(java.lang.Object obj)
Determines if the specified object is in the 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 at the beginning of the queue. |
protected void |
downdateHashCode(java.lang.Object obj)
Downdates the hash code for this queue |
abstract void |
enqueue(java.lang.Object obj)
Appends an object to the end of the queue.. |
boolean |
equals(java.lang.Object obj)
The test for equality. |
int |
hashCode()
Returns the value of the hash code for this queue. |
boolean |
isEmpty()
Determines whether the queue is empty. |
abstract java.lang.Object |
peek()
Returns the object on the beginning of the queue. |
boolean |
remove(java.lang.Object obj)
This is an optional method of the Collection Interface. |
boolean |
removeAll(java.util.Collection c)
This is an optional method of the Collection Interface. |
boolean |
retainAll(java.util.Collection c)
This is an optional method of the Collection Interface. |
java.lang.Object[] |
toArray()
Creates an array containing the objects in this queue. |
java.lang.Object[] |
toArray(java.lang.Object[] a)
Creates an array containing the objects in this 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, size |
Field Detail |
protected int hash
Constructor Detail |
public AbstractQueue()
Method Detail |
public abstract void enqueue(java.lang.Object obj)
obj
- the object to be appended to the end of the queue.public abstract java.lang.Object dequeue()
public abstract java.lang.Object peek()
public boolean add(java.lang.Object obj)
add
in interface java.util.Collection
obj
- the object to be placed at the end of the queue.
public boolean addAll(java.util.Collection c)
addAll
in interface java.util.Collection
c
- the collection of objects to be added to the queue.
public boolean contains(java.lang.Object obj)
contains
in interface java.util.Collection
obj
- the object to be found in the 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
obj
- the object which may be equal to this queue.
public int hashCode()
hashCode
in interface java.util.Collection
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 remove(java.lang.Object obj)
remove
in interface java.util.Collection
obj
- the object to be removed.
public boolean removeAll(java.util.Collection c)
removeAll
in interface java.util.Collection
c
- the collection of objects to be removed.
public boolean retainAll(java.util.Collection c)
retainAll
in interface java.util.Collection
c
- the collection of objects to be retained.
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()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |