|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gnu.iou.queue
A linked- list queue (or stack).
Inner Class Summary | |
static class |
queue.Enqueued
List node can be subclassed, eg, for a soft queue. |
Field Summary | |
static java.lang.Class |
DefaultEnqueuedClass
|
protected java.lang.Class |
q_t
Queue type set by `this()' constructor and replaceable by subclasses' constructors. |
Constructor Summary | |
queue()
Create a new FIFO queue (not LIFO stack). |
|
queue(boolean use_stack)
|
Method Summary | |
void |
clear()
|
queue |
cloneQueue()
|
boolean |
contains(java.lang.Object obj)
|
queue |
copy()
Clone without depth of queue -- with only the top element of the queue/ stack. |
java.util.Enumeration |
elements()
|
boolean |
equals(java.lang.Object ano)
|
boolean |
hasMoreElements()
Returns true if the enumeration contains more elements; false if its empty. |
boolean |
isEmpty(java.lang.Object usr)
|
boolean |
isNotEmpty(java.lang.Object usr)
|
lck |
locker()
|
java.lang.Object |
nextElement()
Returns the next element of the enumeration. |
java.lang.Object |
peek(java.lang.Object usr)
Look at the next "pop" element without popping it (removing it) from the queue/stack. |
java.lang.Object |
pop(java.lang.Object usr)
Return and remove the next element from the queue or stack. |
java.lang.String |
popall_String(java.lang.Object usr)
Pop all elements into a string. |
java.lang.String |
popall_String(java.lang.Object usr,
char sep)
Pop all elements into a string. |
void |
push(java.lang.Object usr,
java.lang.Object o)
User interface for stack or queue "push", depending on constructor. |
void |
push(java.lang.Object usr,
java.lang.Object o,
boolean use_stack_fifo)
User interface for stack or queue, depending on constructor, with override option for FIFO or LIFO behavior in stack or queue. |
java.lang.Object |
remove(java.lang.Object usr,
java.lang.Object obj)
|
boolean |
size_gt_1()
Size greater than one. |
int |
size(java.lang.Object usr)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.Class DefaultEnqueuedClass
protected java.lang.Class q_t
Constructor Detail |
public queue()
public queue(boolean use_stack)
use_stack
- If true, this is a stack (LIFO), otherwise
it's a queue (FIFO).Method Detail |
public lck locker()
public void clear()
public boolean contains(java.lang.Object obj)
public void push(java.lang.Object usr, java.lang.Object o)
usr
- The queue user is the object with a field for the
queue. For `lck.LckDesc'. For example, locks used by
the `Context' or its fields use the `Context'
(instance) object for their `usr'.o
- Object for queue/stacklck.LckDesc(java.lang.Object, java.lang.String)
public void push(java.lang.Object usr, java.lang.Object o, boolean use_stack_fifo)
This interface should be used only when needing to change
the behavior of the stack or queue, for exampe using an
enumeration or queue with a "pushback" of the last popped
element. Otherwise use the regular `push(Object)'
method.
usr
- The queue user is the object with a field for the
queue. For `lck.LckDesc'. For example, locks used by
the `Context' or its fields use the `Context'
(instance) object for their `usr'.o
- Object to pushuse_stack_fifo
- If true uses stack behavior (FIFO),
otherwise false uses queue behavior (LIFO).lck.LckDesc(java.lang.Object, java.lang.String)
public java.lang.Object peek(java.lang.Object usr)
usr
- The queue user is the object with a field for the
queue. For `lck.LckDesc'. For example, locks used by
the `Context' or its fields use the `Context'
(instance) object for their `usr'.lck.LckDesc(java.lang.Object, java.lang.String)
public java.lang.Object pop(java.lang.Object usr)
usr
- The queue user is the object with a field for the
queue. For `lck.LckDesc'. For example, locks used by
the `Context' or its fields use the `Context'
(instance) object for their `usr'.lck.LckDesc(java.lang.Object, java.lang.String)
public boolean isEmpty(java.lang.Object usr)
public boolean isNotEmpty(java.lang.Object usr)
public int size(java.lang.Object usr)
usr
- The queue user is the object with a field for the
queue. For `lck.LckDesc'. For example, locks used by
the `Context' or its fields use the `Context'
(instance) object for their `usr'.lck.LckDesc(java.lang.Object, java.lang.String)
public java.lang.Object remove(java.lang.Object usr, java.lang.Object obj)
usr
- The queue user is the object with a field for the
queue. For `lck.LckDesc'. For example, locks used by
the `Context' or its fields use the `Context'
(instance) object for their `usr'.obj
- Target to removelck.LckDesc(java.lang.Object, java.lang.String)
public boolean size_gt_1()
This can be used for maintaining a default element at the bottom of the stack without counting the whole stack.
If a peek reveals the default element, and the stack size is not greater than one, then the stack position is at this bottom default element which would not be popped.
A `queue' subclass should redefine this `Enqueued' optimized method for its requirements.
public java.lang.String popall_String(java.lang.Object usr)
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object ano)
equals
in class java.lang.Object
public queue cloneQueue()
public queue copy()
public java.lang.String popall_String(java.lang.Object usr, char sep)
public boolean hasMoreElements()
hasMoreElements
in interface java.util.Enumeration
Enumeration
public java.lang.Object nextElement()
nextElement
in interface java.util.Enumeration
java.util.NoSuchElementException
- If no more elements exist.Enumeration
public java.util.Enumeration elements()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |