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.


Field Summary
protected  int numberElem
           
protected  java.util.Vector v
           
 
Constructor Summary
PSStack()
          Creates a new PSStack.
 
Method Summary
 void clear()
          Removes all elements from stack.
 java.lang.Object get(int n)
           
 int getSize()
          Returns the size of the stack.
 boolean isEmpty()
          Checks whether the stack is empty.
 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

v

protected java.util.Vector v

numberElem

protected int numberElem
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.

clear

public void clear()
Removes all elements from stack.
Precondition : A valid instance of PSStack must be created.
Postcondition : Everything is erased.


isEmpty

public boolean isEmpty()
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

get

public java.lang.Object get(int n)