1 package net.sf.openrocket.preset;
3 import java.util.HashMap;
6 import net.sf.openrocket.material.Material;
7 import net.sf.openrocket.rocketcomponent.ExternalComponent.Finish;
11 * A model for a preset component.
13 * A preset component contains a component class type, manufacturer information,
14 * part information, and a method that returns a prototype of the preset component.
16 * @author Sampo Niskanen <sampo.niskanen@iki.fi>
18 public class ComponentPreset extends TypedPropertyMap {
20 // TODO - Implement clone.
21 // Implement "freezing" so the object cannot be modified.
28 public final static TypedKey<Double> LENGTH = new TypedKey<Double>("Length", Double.class);
29 public final static TypedKey<Double> INNER_DIAMETER = new TypedKey<Double>("InnerDiameter", Double.class);
30 public final static TypedKey<Double> OUTER_DIAMETER = new TypedKey<Double>("OuterDiameter", Double.class);
31 public final static TypedKey<Material> MATERIAL = new TypedKey<Material>("Material", Material.class);
32 public final static TypedKey<Finish> FINISH = new TypedKey<Finish>("Finish",Finish.class);
33 public final static TypedKey<Double> THICKNESS = new TypedKey<Double>("Thickness", Double.class);
34 public final static TypedKey<Boolean> FILLED = new TypedKey<Boolean>("Filled",Boolean.class);
35 public final static TypedKey<Double> MASS = new TypedKey<Double>("Mass", Double.class);
37 public final static Map<String,TypedKey<?>> keyMap = new HashMap<String,TypedKey<?>>();
39 keyMap.put(LENGTH.getName(), LENGTH);
40 keyMap.put(INNER_DIAMETER.getName(), INNER_DIAMETER);
41 keyMap.put(OUTER_DIAMETER.getName(), OUTER_DIAMETER);
42 keyMap.put(MATERIAL.getName(), MATERIAL);
43 keyMap.put(FINISH.getName(), FINISH);
44 keyMap.put(THICKNESS.getName(), THICKNESS);
45 keyMap.put(FILLED.getName(), FILLED);
46 keyMap.put(MASS.getName(), MASS);
49 private String manufacturer;
50 private String partNo;
51 private String partDescription;
54 public ComponentPreset() {
58 public String getManufacturer() {
62 public void setManufacturer(String manufacturer) {
63 this.manufacturer = manufacturer;
66 public String getPartNo() {
70 public void setPartNo(String partNo) {
74 public String getPartDescription() {
75 return partDescription;
78 public void setPartDescription(String partDescription) {
79 this.partDescription = partDescription;
82 public Type getType() {
86 public void setType(Type type) {