addProperty dans engine
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
package src.fr.impl.Parts;
|
package src.fr.impl.Parts;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
import src.fr.impl.CategoryImpl;
|
import src.fr.impl.CategoryImpl;
|
||||||
import src.fr.impl.PartImpl;
|
import src.fr.impl.PartImpl;
|
||||||
import src.fr.impl.PartTypeImpl;
|
import src.fr.impl.PartTypeImpl;
|
||||||
@@ -7,5 +9,19 @@ import src.fr.impl.PartTypeImpl;
|
|||||||
public class Engine extends PartImpl {
|
public class Engine extends PartImpl {
|
||||||
public Engine(String name, CategoryImpl category){
|
public Engine(String name, CategoryImpl category){
|
||||||
super(new PartTypeImpl(name,Engine.class, 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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ public class test {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PartType EG100PartType = new PartTypeImpl("EG100",Engine.class,engine);
|
||||||
|
|
||||||
Engine EG100 = new Engine("EG100",engine);
|
Engine EG100 = new Engine("EG100",engine);
|
||||||
Engine EG133 = new Engine("EG133",engine);
|
Engine EG133 = new Engine("EG133",engine);
|
||||||
Engine EG210= new Engine("EG210", engine);
|
Engine EG210= new Engine("EG210", engine);
|
||||||
|
|||||||
Reference in New Issue
Block a user