dtypes
Class PSStack

java.lang.Object
  extended bydtypes.PSStack
Direct Known Subclasses:
PSPath

public class PSStack
extends java.lang.Object

The Stack ADT definition. Every newly created object has specific bevarious declared. This ADT offers all the functions needed to create and operate PSStack.


Constructor Summary
PSStack()
          Creates a new PSStack.
 
Method Summary
 int getSize()
          Returns the size of the stack.
 boolean isEmpty()
          Removes all elements from stack.
 java.lang.Class peek(int n)
          Retrieves the type of peek
Precondition :
Postcondition : The size of the stack is returned.
 java.lang.Object pop()
          Returns the size of the stack.
 void push(java.lang.Object element)
          Pushes an element on top of the stack.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PSStack

public PSStack()
Creates a new PSStack.
Precondition : There must be enough memory in the heap.
Postcondition : A new stack will be created.

Method Detail

push

public void push(java.lang.Object element)
Pushes an element on top of the stack.
Precondition : There is enough memory in the heap.
Postcondition : The element is pushed into the stack.

Parameters:
element - The element to be pushed.

isEmpty

public boolean isEmpty()
Removes all elements from stack.
Precondition : A valid instance of PSStack must be created.
Postcondition : Everything is erased. public void clear() { v.clear(); return; } /////////////////// ACCESSOR ////////////////////// // boolean_isEmpty // Observer /** Checks whether the stack is empty.
Precondition : A valid instance of PSStack must be created.
Postcondition : A response to whether the stack is empty.

Returns:
True if the stack is empty, false otherwise.

getSize

public int getSize()
Returns the size of the stack.
Precondition : A valid instance of PSStack must be created.
Postcondition : The size of the stack is returned.

Returns:
The size of the stack.

pop

public java.lang.Object pop()
Returns the size of the stack.
Precondition : A valid instance of PSStack must be created.
Postcondition : The element is returned.

Returns:
The element on top of the stack.

peek

public java.lang.Class peek(int n)
Retrieves the type of peek
Precondition :
Postcondition : The size of the stack is returned.

Returns:
The type of an object