|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectm865.datastructures.AbstractQueue<T>
public abstract class AbstractQueue<T>
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. Version 3 incorporates generics
Field Summary | |
---|---|
protected int |
hash
The cached value of the hash code for the queue. |
Constructor Summary | |
---|---|
AbstractQueue()
|
Method Summary | ||
---|---|---|
boolean |
add(T x)
Enqueues an object onto the end of the queue. |
|
boolean |
addAll(java.util.Collection<? extends T> 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 T |
dequeue()
Removes and returns the type T object at the beginning of the queue. |
|
protected void |
downdateHashCode(java.lang.Object obj)
Downdates the hash code for this queue |
|
abstract void |
enqueue(T x)
Appends a T object onto 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 T |
peek()
Returns the type T 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. |
|
|
toArray(T[] 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(T x)
x
- the type T object to be appended to the end of the queue.public abstract T dequeue()
public abstract T peek()
public boolean add(T x)
add
in interface java.util.Collection<T>
x
- the type T object to be placed at the end of the queue.
public boolean addAll(java.util.Collection<? extends T> c)
addAll
in interface java.util.Collection<T>
c
- the collection of objects to be added to the queue.
public boolean contains(java.lang.Object obj)
contains
in interface java.util.Collection<T>
obj
- the object to be found in the queue.
public boolean containsAll(java.util.Collection<?> c)
containsAll
in interface java.util.Collection<T>
c
- the collection of objects to be found in the queue.
public boolean equals(java.lang.Object obj)
equals
in interface java.util.Collection<T>
equals
in class java.lang.Object
obj
- the object which may be equal to this queue.
public int hashCode()
hashCode
in interface java.util.Collection<T>
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<T>
public boolean remove(java.lang.Object obj)
remove
in interface java.util.Collection<T>
obj
- the object to be removed.
public boolean removeAll(java.util.Collection<?> c)
removeAll
in interface java.util.Collection<T>
c
- the collection of objects to be removed.
public boolean retainAll(java.util.Collection<?> c)
retainAll
in interface java.util.Collection<T>
c
- the collection of objects to be retained.
public java.lang.Object[] toArray()
toArray
in interface java.util.Collection<T>
public <T> T[] toArray(T[] a)
toArray
in interface java.util.Collection<T>
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 |