gepper code example

Example 1: gepper

+Libro(in src: Libro)

/*TOSTRING*/
public String toString(){
  // sezione dichiarativa
  String s;
 /* variabili visibili
   x (attributo)
   s (variabile locale)
  */
  s = ""+x;
  
  return s;
 } // toString
 
 /*Copy*/
 public Copy(Copy src){
 /* variabili visibili
 x (attributo)
 src (parametro)
 */
 if(src!=null){
  x=src.getVal();
}else{
  val=0;
}

 /*equals*/
 public boolean equals( Object obj ){
  // sezione dichiarativa
  boolean ris;
  /*
    variabili visibili:
    x (attributo)
    ris (variabile locale)
    obj (parametro formale)
  */
  if( obj!=null && obj  instanceof Bit &&
      x == ((Bit)obj).getVal()){
     ris=true;
   }else{
     ris=false;
   }
   return ris;
 }//equals

Example 2: gepper

00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

Tags:

Misc Example