From b9a881c5c928c8b94735d383e303a95715a08ba6 Mon Sep 17 00:00:00 2001 From: JoePfeiffer Date: Sun, 19 Apr 2020 10:47:28 -0600 Subject: [PATCH 1/2] The deleted methods (setTotalThrustEstimate(), setBurnTimeEstimate(), setAverageThrustEstimate(), and setMaxThrustEstimate()) were never called. The member variables maxThrust, burnTimeEstimate, averageThrust, totalImpulse are all calculated by computeStatistics() and the values (if any) from the thrustcurve file are ignored. --- .../sf/openrocket/motor/ThrustCurveMotor.java | 20 ------------------- .../motor/thrustcurve/MotorRowFilterTest.java | 4 ---- 2 files changed, 24 deletions(-) diff --git a/core/src/net/sf/openrocket/motor/ThrustCurveMotor.java b/core/src/net/sf/openrocket/motor/ThrustCurveMotor.java index d951534fa..68073b0ee 100644 --- a/core/src/net/sf/openrocket/motor/ThrustCurveMotor.java +++ b/core/src/net/sf/openrocket/motor/ThrustCurveMotor.java @@ -60,16 +60,6 @@ public class ThrustCurveMotor implements Motor, Comparable, Se ThrustCurveMotor motor = new ThrustCurveMotor(); - public Builder setAverageThrustEstimate(double v) { - motor.averageThrust = v; - return this; - } - - public Builder setBurnTimeEstimate(double v) { - motor.burnTimeEstimate = v; - return this; - } - public Builder setCaseInfo(String v) { motor.caseInfo = v; return this; @@ -115,11 +105,6 @@ public class ThrustCurveMotor implements Motor, Comparable, Se return this; } - public Builder setMaxThrustEstimate(double v) { - motor.maxThrust = v; - return this; - } - public Builder setMotorType(Motor.Type t) { motor.type = t; return this; @@ -145,11 +130,6 @@ public class ThrustCurveMotor implements Motor, Comparable, Se return this; } - public Builder setTotalThrustEstimate(double v) { - motor.totalImpulse = v; - return this; - } - public Builder setAvailablity(boolean avail) { motor.available = avail; return this; diff --git a/swing/test/net/sf/openrocket/gui/dialogs/motor/thrustcurve/MotorRowFilterTest.java b/swing/test/net/sf/openrocket/gui/dialogs/motor/thrustcurve/MotorRowFilterTest.java index 1890cffea..e91d36d95 100644 --- a/swing/test/net/sf/openrocket/gui/dialogs/motor/thrustcurve/MotorRowFilterTest.java +++ b/swing/test/net/sf/openrocket/gui/dialogs/motor/thrustcurve/MotorRowFilterTest.java @@ -177,8 +177,6 @@ public class MotorRowFilterTest { // create a motor with all fields explicitly defined // This is the Aerotech H123 from thrustcurve.org, motor ID 917 final ThrustCurveMotor fullMotor = new ThrustCurveMotor.Builder() - .setAverageThrustEstimate(83.5) - .setBurnTimeEstimate(2.5) .setCaseInfo("Aerotech 38/240") .setCGPoints(new Coordinate[] {new Coordinate(0.077, 0, 0, 125.0), new Coordinate(0.077, 0, 0, 109.93), @@ -199,13 +197,11 @@ public class MotorRowFilterTest { .setInitialMass(293.3) .setLength(0.152) .setManufacturer(Manufacturer.getManufacturer("AeroTech")) - .setMaxThrustEstimate(174.2) .setMotorType(Motor.Type.RELOAD) .setPropellantInfo("White Lightning") .setStandardDelays(new double[] {6, 10, 14}) .setThrustPoints(new double[] {138.42, 116.45, 116.45, 112.18, 107.82, 86.29, 81.93, 64.72, 47.46, 43.15, 30.2, 0.0}) .setTimePoints(new double[] {0.0, 0.2, 0.6, 0.7, 0.8, 1.3, 1.5, 1.8, 2.1, 2.2, 2.3, 2.6}) - .setTotalThrustEstimate(211.4) .build(); // two search terms, both present, one only a substring of a column From bf6624fb7081690fcca925b357ca0a1dc384a700 Mon Sep 17 00:00:00 2001 From: JoePfeiffer Date: Sun, 19 Apr 2020 18:52:40 -0600 Subject: [PATCH 2/2] I can't find anywhere that these classes are imported by anything else --- .../DatabaseMotorFinderWithMissingMotors.java | 27 -- .../motor/ThrustCurveMotorPlaceholder.java | 239 ------------------ 2 files changed, 266 deletions(-) delete mode 100644 core/src/net/sf/openrocket/file/DatabaseMotorFinderWithMissingMotors.java delete mode 100644 core/src/net/sf/openrocket/motor/ThrustCurveMotorPlaceholder.java diff --git a/core/src/net/sf/openrocket/file/DatabaseMotorFinderWithMissingMotors.java b/core/src/net/sf/openrocket/file/DatabaseMotorFinderWithMissingMotors.java deleted file mode 100644 index 5270151b3..000000000 --- a/core/src/net/sf/openrocket/file/DatabaseMotorFinderWithMissingMotors.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.sf.openrocket.file; - -import net.sf.openrocket.aerodynamics.WarningSet; -import net.sf.openrocket.motor.Motor; -import net.sf.openrocket.motor.Motor.Type; -import net.sf.openrocket.motor.ThrustCurveMotorPlaceholder; - -public class DatabaseMotorFinderWithMissingMotors extends DatabaseMotorFinder -implements MotorFinder { - - /** - * This implementation returns a ThrustCurveMotorPlaceholder. - */ - @Override - protected Motor handleMissingMotor(Type type, String manufacturer, String designation, double diameter, double length, String digest, WarningSet warnings) { - Motor motor = new ThrustCurveMotorPlaceholder(type, - manufacturer, - designation, - diameter, - length, - digest, - /* delay */ Double.NaN, - /*launchMass*/ Double.NaN, - /*emptyMass*/ Double.NaN); - return motor; - } -} diff --git a/core/src/net/sf/openrocket/motor/ThrustCurveMotorPlaceholder.java b/core/src/net/sf/openrocket/motor/ThrustCurveMotorPlaceholder.java deleted file mode 100644 index fd173d5d6..000000000 --- a/core/src/net/sf/openrocket/motor/ThrustCurveMotorPlaceholder.java +++ /dev/null @@ -1,239 +0,0 @@ -package net.sf.openrocket.motor; - -import net.sf.openrocket.util.BugException; - -public class ThrustCurveMotorPlaceholder implements Motor { - - private final Motor.Type type; - private final String manufacturer; - private final String designation; - private final double diameter; - private final double length; - private final String digest; - private final double delay; - private final double launchMass; - private final double emptyMass; - - - public ThrustCurveMotorPlaceholder(Type type, String manufacturer, String designation, double diameter, double length, - String digest, double delay, double launchMass, double emptyMass) { - this.type = type; - this.manufacturer = manufacturer; - this.designation = designation; - this.diameter = diameter; - this.length = length; - this.digest = digest; - this.delay = delay; - this.launchMass = launchMass; - this.emptyMass = emptyMass; - } - - - @Override - public Type getMotorType() { - return type; - } - - public String getManufacturer() { - return manufacturer; - } - - @Override - public String getDesignation() { - return designation; - } - - @Override - public String getDesignation(double designationDelay) { - return designation + "-" + ThrustCurveMotor.getDelayString(designationDelay); - } - - @Override - public String getDescription() { - return ""; - } - - @Override - public double getDiameter() { - return diameter; - } - - @Override - public double getLength() { - return length; - } - - @Override - public String getDigest() { - return digest; - } - - public double getDelay() { - return delay; - } - - @Override - public Motor clone() { - throw new BugException("Called getInstance on PlaceholderMotor"); - } - - @Override - public double getBurnTimeEstimate() { - return Double.NaN; - } - - @Override - public double getAverageThrustEstimate() { - return Double.NaN; - } - - @Override - public double getMaxThrustEstimate() { - return Double.NaN; - } - - @Override - public double getTotalImpulseEstimate() { - return Double.NaN; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - long temp; - temp = Double.doubleToLongBits(delay); - result = prime * result + (int) (temp ^ (temp >>> 32)); - result = prime * result - + ((designation == null) ? 0 : designation.hashCode()); - temp = Double.doubleToLongBits(diameter); - result = prime * result + (int) (temp ^ (temp >>> 32)); - result = prime * result + ((digest == null) ? 0 : digest.hashCode()); - temp = Double.doubleToLongBits(emptyMass); - result = prime * result + (int) (temp ^ (temp >>> 32)); - temp = Double.doubleToLongBits(launchMass); - result = prime * result + (int) (temp ^ (temp >>> 32)); - temp = Double.doubleToLongBits(length); - result = prime * result + (int) (temp ^ (temp >>> 32)); - result = prime * result - + ((manufacturer == null) ? 0 : manufacturer.hashCode()); - result = prime * result + ((type == null) ? 0 : type.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - ThrustCurveMotorPlaceholder other = (ThrustCurveMotorPlaceholder) obj; - if (Double.doubleToLongBits(delay) != Double - .doubleToLongBits(other.delay)) - return false; - if (designation == null) { - if (other.designation != null) - return false; - } else if (!designation.equals(other.designation)) - return false; - if (Double.doubleToLongBits(diameter) != Double - .doubleToLongBits(other.diameter)) - return false; - if (digest == null) { - if (other.digest != null) - return false; - } else if (!digest.equals(other.digest)) - return false; - if (Double.doubleToLongBits(emptyMass) != Double - .doubleToLongBits(other.emptyMass)) - return false; - if (Double.doubleToLongBits(launchMass) != Double - .doubleToLongBits(other.launchMass)) - return false; - if (Double.doubleToLongBits(length) != Double - .doubleToLongBits(other.length)) - return false; - if (manufacturer == null) { - if (other.manufacturer != null) - return false; - } else if (!manufacturer.equals(other.manufacturer)) - return false; - if (type != other.type) - return false; - return true; - } - - - @Override - public String toString() { - return "ThrustCurveMotorPlaceholder [manufacturer=" + manufacturer - + ", designation=" + designation + "]"; - } - - @Override - public double getLaunchCGx() { - return length / 2; - } - - @Override - public double getBurnoutCGx() { - return length / 2; - } - - @Override - public double getLaunchMass() { - return launchMass; - } - - @Override - public double getBurnoutMass() { - return emptyMass; - } - - @Override - public double getThrust(double pseudoIndex) { - return 0; - } - - @Override - public double getAverageThrust(double startTime, double endTime) { - return 0; - } - - @Override - public double getTotalMass(final double motorTime) { - return 0; - } - - @Override - public double getPropellantMass( final Double motorTime){ - return 0.; - } - - @Override - public double getCMx(double pseudoIndex) { - return 0; - } - - @Override - public double getBurnTime() { - return 0; - } - - @Override - public double getUnitIxx() { - return 0.; - } - - @Override - public double getUnitIyy() { - return 0.; - } - - @Override - public double getUnitIzz(){ - return 0.; - } -}