import com.objy.db.app.*;
import java.util.Date;
import java.util.Vector;
import java.util.Enumeration;

public class Bakelite extends ooObj implements IObject {
    
	int id; 
	String codice; 
	double dato1;
	double dato2; 
	double dato3; 

    public Bakelite() {}

    public Bakelite (int id, String codice, double dato1, double dato2, 
			    		double dato3 ) {
	this.id = id;
	this.codice = codice;
	this.dato1 = dato1;
	this.dato2 = dato2;
	this.dato3 = dato3; }

    /* local methods */

    public void setcodice(String codice) {
	markModified();
	this.codice = codice;
    }
   
    public String getcodice() {
	fetch();
	return codice;
    }

    public void setid(int id) {
	markModified();
	this.id = id;
    }

    public int getid() {
	fetch();
	return id;
    }

    public void setdato1(double dato1) {
	markModified();
	this.dato1 = dato1;
    }

    public void setdato2(double dato2) {
	markModified();
	this.dato2 = dato2;
    }

    public void setdato3(double dato3) {
	markModified();
	this.dato3 = dato3;
    }

   public double getdato1() {
	fetch();
	return dato1;
   }

   public double getdato2() {
	fetch();
	return dato2;
   }

   public double getdato3() {
	fetch();
	return dato3;
   }


    public String toString() {
	fetch();
	return "Bakelite " + this.id;
    }						

    /* remote methods */

    public String asString() { return toString(); }

 
      public Vector getPathInfo() {
	Wheel cont = (Wheel) getContainer();
	String contName = cont.getName();
	char[] wheelChars = contName.toCharArray();
	int wheel = wheelChars[contName.length()-1] - 48;
	if (wheelChars[contName.length()-2] == '-')
	    wheel = -wheel;
	String bak_type = getcodice();
	int type = bak_type.toCharArray()[bak_type.length()-1] - 48;
	int bakelite = getid();
	Vector result = new Vector(3);
	result.addElement (new Integer(wheel + 2));
	result.addElement (new Integer(type - 1));
	result.addElement (new Integer(bakelite - 1));
	return result;
    }

    public Record getAttrs() {
	return new BakeliteData(this);
    }

    public void setAttrs(Record r) {
	if (r instanceof BakeliteData) {
	    BakeliteData data = (BakeliteData) r;
	    setid(data.id);
	    setcodice(data.codice);
	    setdato1(data.dato1);
	    setdato2(data.dato2);
	    setdato3(data.dato3);


	 }
    }
}
