1 package net.sf.openrocket.motor;
3 import net.sf.openrocket.util.BugException;
4 import net.sf.openrocket.util.Coordinate;
6 public class ThrustCurveMotorPlaceholder implements Motor {
8 private final Motor.Type type;
9 private final String manufacturer;
10 private final String designation;
11 private final double diameter;
12 private final double length;
13 private final String digest;
14 private final double delay;
15 private final double launchMass;
16 private final double emptyMass;
19 public ThrustCurveMotorPlaceholder(Type type, String manufacturer, String designation, double diameter, double length,
20 String digest, double delay, double launchMass, double emptyMass) {
22 this.manufacturer = manufacturer;
23 this.designation = designation;
24 this.diameter = diameter;
28 this.launchMass = launchMass;
29 this.emptyMass = emptyMass;
34 public Type getMotorType() {
38 public String getManufacturer() {
43 public String getDesignation() {
48 public String getDesignation(double designationDelay) {
49 return designation + "-" + ThrustCurveMotor.getDelayString(designationDelay);
53 public String getDescription() {
58 public double getDiameter() {
63 public double getLength() {
68 public String getDigest() {
72 public double getDelay() {
77 public MotorInstance getInstance() {
78 throw new BugException("Called getInstance on PlaceholderMotor");
82 public Coordinate getLaunchCG() {
83 return new Coordinate(length / 2, 0, 0, launchMass);
87 public Coordinate getEmptyCG() {
88 return new Coordinate(length / 2, 0, 0, emptyMass);
92 public double getBurnTimeEstimate() {
97 public double getAverageThrustEstimate() {
102 public double getMaxThrustEstimate() {
107 public double getTotalImpulseEstimate() {
112 public int hashCode() {
113 final int prime = 31;
116 temp = Double.doubleToLongBits(delay);
117 result = prime * result + (int) (temp ^ (temp >>> 32));
118 result = prime * result
119 + ((designation == null) ? 0 : designation.hashCode());
120 temp = Double.doubleToLongBits(diameter);
121 result = prime * result + (int) (temp ^ (temp >>> 32));
122 result = prime * result + ((digest == null) ? 0 : digest.hashCode());
123 temp = Double.doubleToLongBits(emptyMass);
124 result = prime * result + (int) (temp ^ (temp >>> 32));
125 temp = Double.doubleToLongBits(launchMass);
126 result = prime * result + (int) (temp ^ (temp >>> 32));
127 temp = Double.doubleToLongBits(length);
128 result = prime * result + (int) (temp ^ (temp >>> 32));
129 result = prime * result
130 + ((manufacturer == null) ? 0 : manufacturer.hashCode());
131 result = prime * result + ((type == null) ? 0 : type.hashCode());
136 public boolean equals(Object obj) {
141 if (getClass() != obj.getClass())
143 ThrustCurveMotorPlaceholder other = (ThrustCurveMotorPlaceholder) obj;
144 if (Double.doubleToLongBits(delay) != Double
145 .doubleToLongBits(other.delay))
147 if (designation == null) {
148 if (other.designation != null)
150 } else if (!designation.equals(other.designation))
152 if (Double.doubleToLongBits(diameter) != Double
153 .doubleToLongBits(other.diameter))
155 if (digest == null) {
156 if (other.digest != null)
158 } else if (!digest.equals(other.digest))
160 if (Double.doubleToLongBits(emptyMass) != Double
161 .doubleToLongBits(other.emptyMass))
163 if (Double.doubleToLongBits(launchMass) != Double
164 .doubleToLongBits(other.launchMass))
166 if (Double.doubleToLongBits(length) != Double
167 .doubleToLongBits(other.length))
169 if (manufacturer == null) {
170 if (other.manufacturer != null)
172 } else if (!manufacturer.equals(other.manufacturer))
174 if (type != other.type)
181 public String toString() {
182 return "ThrustCurveMotorPlaceholder [manufacturer=" + manufacturer
183 + ", designation=" + designation + "]";