|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--y.util.BoundedStack
This class represents an efficient stack of bounded size.
Constructor Summary | |
BoundedStack(int capacity)
Creates a new instance of BoundedStack. |
Method Summary | |
int |
capacity()
Returns the maximal number of elements that this stack can hold. |
void |
clear()
Removes all elements from this stack; |
boolean |
isEmpty()
Returns true if this stack is empty. |
Object |
pop()
Returns the element that has been pushed last on this stack and removes it from this stack. |
void |
push(Object o)
Pushes a new element on this stack. |
int |
size()
Returns the number of elements in this stack. |
Object |
top()
Returns the element that has been pushed last on this stack. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public BoundedStack(int capacity)
capacity
- the maximum capacity of this queue.Method Detail |
public Object top()
Precondition:!isEmpty()
public Object pop()
Precondition:!isEmpty()
public void push(Object o)
public void clear()
public int size()
public int capacity()
public boolean isEmpty()
|
© Copyright 2000-2003, yWorks GmbH. All rights reserved. 2003 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |