anouarattn

recopie

Dec 10th, 2012
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.21 KB | None | 0 0
  1.  
  2.  
  3.  
  4.  
  5. // f la class SELEMENT
  6.  public void copy(SELEMENT selement){
  7.     selement.auteur=this.auteur;
  8.     selement.titre=this.auteur;
  9.     selement.nombre=this.nombre;
  10.     }
  11.  
  12.  
  13. // f class ELEMENT
  14. public ELEMENT copy()
  15.     {
  16.        ELEMENT element=new ELEMENT();
  17.        element.editeur=this.editeur;
  18.     CHAINON chainonOFthis=this.tete,chainonOFelement=element.tete;
  19.    
  20.     while(chainonOFthis.next!=null){
  21.         SELEMENT e=new SELEMENT();
  22.         ((SELEMENT)chainonOFthis.next.info).copy(e);
  23.         CHAINON k=new CHAINON(e,null);
  24.         chainonOFelement.next=k;
  25.         chainonOFthis=chainonOFthis.next;chainonOFelement=chainonOFelement.next;
  26.     }
  27.     return element;
  28.     }
  29.  
  30.  
  31.  
  32. //f la class CATALOGUE
  33.  
  34. public CATALOGUE copy(){
  35.        
  36.        CATALOGUE catalogue=new CATALOGUE();
  37.        CHAINON chainonOFthis=this.tete,chainonOFcatalogue=catalogue.tete;
  38.        while(chainonOFthis.next!=null)
  39.        {
  40.            ELEMENT e=((ELEMENT)chainonOFthis.next.info).copy();
  41.            CHAINON temp=new CHAINON(e,null);
  42.            chainonOFcatalogue.next=temp;
  43.            chainonOFcatalogue=chainonOFcatalogue.next;
  44.            chainonOFthis=chainonOFthis.next;
  45.        }
  46.        return catalogue;
  47.        }
Advertisement
Add Comment
Please, Sign In to add comment