43 lines
1.0 KiB
Java
43 lines
1.0 KiB
Java
package src.fr.impl.Parts;
|
|
|
|
import java.util.HashSet;
|
|
import java.util.Optional;
|
|
import java.util.Set;
|
|
|
|
import src.fr.impl.CategoryImpl;
|
|
import src.fr.impl.PartImpl;
|
|
import src.fr.impl.PartTypeImpl;
|
|
|
|
public class Exterior extends PartImpl {
|
|
|
|
private static final Set<String> colorSet;
|
|
static {
|
|
colorSet = new HashSet<>();
|
|
colorSet.add("white");
|
|
colorSet.add("green");
|
|
colorSet.add("red");
|
|
colorSet.add("blue");
|
|
colorSet.add("green");
|
|
colorSet.add("gray");
|
|
}
|
|
|
|
private String color;
|
|
|
|
public Exterior(String name, CategoryImpl category, int price){
|
|
super(new PartTypeImpl(name,Engine.class, category),price);
|
|
|
|
Set<String> l = new HashSet<String>();
|
|
l.add("red");
|
|
this.addProperty("color", () -> getColor(), c -> setColor(c), colorSet);
|
|
}
|
|
|
|
|
|
public String getColor(){
|
|
return this.color;
|
|
}
|
|
|
|
public void setColor(String newColor){
|
|
this.color = newColor;
|
|
}
|
|
}
|