|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
~mohammad/public_html/classes/csc241/Stack/Stack.java This is an ADT for stack. A Stack holds objects. There is no code, private variables, or constructors designed for Stack as it is an Interface. We are postponing the implementation, so that we could have an array version and a linked list version. Notice that there is no constructor and instead of {} for the methods with simply have ';'.
Method Summary | |
boolean |
empty()
return true if stack is empty, otherwise, return false |
boolean |
full()
return true if stack is full, otherwise, return false |
csc241.samples.Stack.Stack |
pop()
remove an element from the top of the stack. |
csc241.samples.Stack.Stack |
push(java.lang.Object x)
add an element to the top of the stack. |
java.lang.Object |
top()
return the element on top of the stack; return null if empty. |
Method Detail |
public boolean empty()
public boolean full()
public csc241.samples.Stack.Stack push(java.lang.Object x) throws stackException
-
- Exception if stack is full
stackException
public csc241.samples.Stack.Stack pop() throws stackException
-
- Exception if stack is empty.
stackException
public java.lang.Object top()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |