|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkodkod.util.collections.Stack<T>
kodkod.util.collections.LinkedStack<T>
public final class LinkedStack<T>
A Stack implementation based on a singly linked list.
Constructor Summary | |
---|---|
LinkedStack()
Constructs an empty stack. |
Method Summary | |
---|---|
boolean |
empty()
Returns true if the stack is empty; otherwise returns false. |
java.util.Iterator<T> |
iterator()
Iterates over the items in this LinkedStack, starting at the top of the stack and working its way down. |
T |
peek()
Looks at the object at the top of this stack without removing it from the stack. |
T |
pop()
Removes the object at the top of this stack and returns that object as the value of this function. |
T |
push(T item)
Pushes an item onto the top of this stack and returns it. |
int |
search(java.lang.Object o)
Returns the 1-based position where an object is on this stack. |
int |
size()
Returns the size of this stack. |
Methods inherited from class kodkod.util.collections.Stack |
---|
equals, hashCode, toString |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public LinkedStack()
no this.elems' |
Method Detail |
---|
public int size()
Stack
size
in class Stack<T>
Stack.size()
public T push(T item)
push
in class Stack<T>
this.size' = this.size + 1 && this.elems'[0] = item &&
all i: [0..this.size) | this.elems'[i+1] = this.elems[i] |
public T pop()
pop
in class Stack<T>
java.util.EmptyStackException
- - no this.elemsthis.size' = this.size - 1 &&
all i: [1..this.size) | this.elems'[i-1] = this.elems[i] |
public T peek()
peek
in class Stack<T>
java.util.EmptyStackException
- - no this.elemspublic int search(java.lang.Object o)
search
in class Stack<T>
public boolean empty()
empty
in class Stack<T>
public java.util.Iterator<T> iterator()
iterator
in interface java.lang.Iterable<T>
iterator
in class Stack<T>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |