Initial XML generating code for .orc format.
[debian/openrocket] / core / src / net / sf / openrocket / preset / xml / CenteringRingDTO.java
1
2 package net.sf.openrocket.preset.xml;
3
4 import net.sf.openrocket.preset.ComponentPreset;
5
6 import javax.xml.bind.annotation.XmlAccessType;
7 import javax.xml.bind.annotation.XmlAccessorType;
8 import javax.xml.bind.annotation.XmlElement;
9 import javax.xml.bind.annotation.XmlRootElement;
10
11 /**
12  * Centering ring preset XML handler.
13  */
14 @XmlRootElement(name = "CenteringRing")
15 @XmlAccessorType(XmlAccessType.FIELD)
16 public class CenteringRingDTO extends BaseComponentDTO {
17
18     @XmlElement(name = "InsideDiameter")
19     private double insideDiameter;
20     @XmlElement(name = "OutsideDiameter")
21     private double outsideDiameter;
22     @XmlElement(name = "Length")
23     private double length;
24
25     /**
26      * Default constructor.
27      */
28     public CenteringRingDTO() {
29     }
30
31     /**
32      * Most-useful constructor that maps a CenteringRing preset to a CenteringRingDTO.
33      *
34      * @param thePreset  the preset
35      *
36      * @throws net.sf.openrocket.util.BugException thrown if the expected centering ring keys are not in the preset
37      */
38     public CenteringRingDTO(final ComponentPreset thePreset) {
39         super(thePreset);
40         setInsideDiameter(thePreset.get(ComponentPreset.INNER_DIAMETER));
41         setOutsideDiameter(thePreset.get(ComponentPreset.OUTER_DIAMETER));
42         setLength(thePreset.get(ComponentPreset.LENGTH));
43     }
44
45     public double getInsideDiameter() {
46         return insideDiameter;
47     }
48
49     public void setInsideDiameter(final double theInsideDiameter) {
50         insideDiameter = theInsideDiameter;
51     }
52
53     public double getOutsideDiameter() {
54         return outsideDiameter;
55     }
56
57     public void setOutsideDiameter(final double theOutsideDiameter) {
58         outsideDiameter = theOutsideDiameter;
59     }
60
61     public double getLength() {
62         return length;
63     }
64
65     public void setLength(final double theLength) {
66         length = theLength;
67     }
68 }