addProperty dans engine

This commit is contained in:
trochas
2024-11-25 17:45:18 +01:00
parent 76e14bf7e0
commit d9e14bdd9f
2 changed files with 18 additions and 0 deletions

View File

@@ -1,5 +1,7 @@
package src.fr.impl.Parts;
import java.util.HashMap;
import src.fr.impl.CategoryImpl;
import src.fr.impl.PartImpl;
import src.fr.impl.PartTypeImpl;
@@ -7,5 +9,19 @@ import src.fr.impl.PartTypeImpl;
public class Engine extends PartImpl {
public Engine(String name, CategoryImpl category){
super(new PartTypeImpl(name,Engine.class, category));
//init_prix();
//this.addProperty("prix", () -> Integer.toString(getPrix()), null, getPropertyNames());
}
private HashMap<String,Integer> table_prix;
private void init_prix(){
table_prix.put("EG100",100);
}
public int getPrix(){
return table_prix.get(this.getName());
}
}

View File

@@ -22,6 +22,8 @@ public class test {
PartType EG100PartType = new PartTypeImpl("EG100",Engine.class,engine);
Engine EG100 = new Engine("EG100",engine);
Engine EG133 = new Engine("EG133",engine);
Engine EG210= new Engine("EG210", engine);