|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjsim.queue.Queue
public abstract class Queue
Class Queue is an abstract class which pure virtual functions must be implemented in subclasses.
| Field Summary | |
|---|---|
protected int |
capacity
Maximum number of elements allowed |
protected Q_Node |
root
Root (front) of queue |
protected int |
size
Current number of elements |
| Constructor Summary | |
|---|---|
Queue()
|
|
| Method Summary | |
|---|---|
void |
add(int index,
java.lang.Object element)
|
boolean |
add(java.lang.Object item)
Insert an element into the queue. |
boolean |
addAll(java.util.Collection c)
|
boolean |
addAll(int index,
java.util.Collection c)
|
abstract Q_Node |
addAt(java.lang.Object item)
Insert an element into the queue and return holding node. |
void |
cancel(Q_Node node)
Cancel (remove) node from the queue. |
void |
clear()
Remove all elements from the queue. |
boolean |
contains(java.lang.Object o)
Methods in List interface that are not implemented. |
boolean |
containsAll(java.util.Collection c)
|
Q_Node |
first()
Return the first element in the queue without removing it. |
java.lang.Object |
get(int index)
|
int |
indexOf(java.lang.Object o)
|
boolean |
isEmpty()
Return whether the queue is empty (true for empty, false for nonempty). |
boolean |
isFull()
Return whether the queue is full (true for full, false for not full). |
java.util.Iterator |
iterator()
|
int |
lastIndexOf(java.lang.Object o)
|
java.util.ListIterator |
listIterator()
|
java.util.ListIterator |
listIterator(int index)
|
Q_Node |
remove()
Remove and return the first element in the queue. |
java.lang.Object |
remove(int index)
Remove the node containing the minimum/first element from the queue. |
boolean |
remove(java.lang.Object o)
|
boolean |
removeAll(java.util.Collection c)
|
protected void |
removeMin()
Remove the node containing the minimum/first element from the queue. |
boolean |
retainAll(java.util.Collection c)
|
java.lang.Object |
set(int index,
java.lang.Object element)
|
int |
size()
Return the number of elements in the queue. |
java.util.List |
subList(int fromIndex,
int toIndex)
|
java.lang.Object[] |
toArray()
|
java.lang.Object[] |
toArray(java.lang.Object[] a)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.List |
|---|
equals, hashCode |
| Field Detail |
|---|
protected Q_Node root
protected int size
protected int capacity
| Constructor Detail |
|---|
public Queue()
| Method Detail |
|---|
public boolean isEmpty()
isEmpty in interface java.util.CollectionisEmpty in interface java.util.Listpublic boolean isFull()
public int size()
size in interface java.util.Collectionsize in interface java.util.List
public Q_Node first()
throws java.util.NoSuchElementException
java.util.NoSuchElementException - if the queue is empty.public void cancel(Q_Node node)
node - node to be cancelled
public Q_Node remove()
throws java.util.NoSuchElementException
java.util.NoSuchElementException - if the queue is empty.public java.lang.Object remove(int index)
remove in interface java.util.Listindex - list position (must be 0)protected void removeMin()
public void clear()
clear in interface java.util.Collectionclear in interface java.util.Listpublic boolean add(java.lang.Object item)
add in interface java.util.Collectionadd in interface java.util.Listitem - new item to be added
public abstract Q_Node addAt(java.lang.Object item)
throws FullQueueException
item - new item to be added
FullQueueException - if the queue is full.public boolean contains(java.lang.Object o)
contains in interface java.util.Collectioncontains in interface java.util.Listpublic boolean containsAll(java.util.Collection c)
containsAll in interface java.util.CollectioncontainsAll in interface java.util.Listpublic boolean addAll(java.util.Collection c)
addAll in interface java.util.CollectionaddAll in interface java.util.List
public boolean addAll(int index,
java.util.Collection c)
addAll in interface java.util.Listpublic boolean remove(java.lang.Object o)
remove in interface java.util.Collectionremove in interface java.util.Listpublic boolean removeAll(java.util.Collection c)
removeAll in interface java.util.CollectionremoveAll in interface java.util.Listpublic boolean retainAll(java.util.Collection c)
retainAll in interface java.util.CollectionretainAll in interface java.util.Listpublic int indexOf(java.lang.Object o)
indexOf in interface java.util.Listpublic int lastIndexOf(java.lang.Object o)
lastIndexOf in interface java.util.Listpublic java.util.Iterator iterator()
iterator in interface java.lang.Iterableiterator in interface java.util.Collectioniterator in interface java.util.List
public java.util.List subList(int fromIndex,
int toIndex)
subList in interface java.util.Listpublic java.util.ListIterator listIterator()
listIterator in interface java.util.Listpublic java.util.ListIterator listIterator(int index)
listIterator in interface java.util.Listpublic java.lang.Object get(int index)
get in interface java.util.List
public java.lang.Object set(int index,
java.lang.Object element)
set in interface java.util.Listpublic java.lang.Object[] toArray()
toArray in interface java.util.CollectiontoArray in interface java.util.Listpublic java.lang.Object[] toArray(java.lang.Object[] a)
toArray in interface java.util.CollectiontoArray in interface java.util.List
public void add(int index,
java.lang.Object element)
add in interface java.util.List
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||