+
+ // One motor
+ if (motors.size() == 1) {
+ ThrustCurveMotor m = motors.get(0);
+ if (digest != null && !MotorDigest.digestMotor(m).equals(digest)) {
+ String str = "Motor with designation '" + designation + "'";
+ if (manufacturer != null)
+ str += " for manufacturer '" + manufacturer + "'";
+ str += " has differing thrust curve than the original.";
+ warnings.add(str);
+ }
+ return m;
+ }
+
+ // Multiple motors, check digest for which one to use
+ if (digest != null) {
+
+ // Check for motor with correct digest
+ for (ThrustCurveMotor m : motors) {
+ if (MotorDigest.digestMotor(m).equals(digest)) {
+ return m;
+ }
+ }
+ String str = "Motor with designation '" + designation + "'";
+ if (manufacturer != null)
+ str += " for manufacturer '" + manufacturer + "'";
+ str += " has differing thrust curve than the original.";
+ warnings.add(str);
+
+ } else {
+
+ // No digest, check for preferred digest (OpenRocket <= 1.1.0)
+ // TODO: MEDIUM: This should only be done for document versions 1.1 and below
+ for (ThrustCurveMotor m : motors) {
+ if (PreferredMotorDigests.DIGESTS.contains(MotorDigest.digestMotor(m))) {
+ return m;
+ }
+ }
+
+ String str = "Multiple motors with designation '" + designation + "'";