
  /*
  ** package de structure de données
  ** nice le 14/08/2002
  ** auteur:ibowili henri
  */
  

  /*
  **pile 
  */
function Stack(elem){
 this.top=elem
 this.bottom=elem
 this.pop=pop
 this.push=push
 this.isEmpty=isEmpty
 this.getReverse=getReverse
}
function pop(){
  var result=null;
  var inter=this.top;
  if(inter!=null)result=typeof(inter.next)!="undefined"?inter.next:null;
  this.top=result;
  return inter;
}
function push(elem){
   if(this.top!=null){
    if(this.top.equals(this.bottom))this.top.next=null;
      elem.next=this.top;
   }
   else{
     this.bottom=elem;
	 this.bottom.next=null;
   }
   this.top=elem;
}
function isEmpty(){
  return this.top==null;
}

function getReverse(){
  var inv=new Stack(null);
  while(this.top!=null){
    inv.push(this.pop());
  }
  this.top=inv.top;
  this.bottom=inv.bottom;
}
//dans pop if(inter!=null || this.top.equals(this.bottom))result=typeof(inter.next)!="undefined"?inter.next:null;
