projects
/
debian
/
openrocket
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixing various issues
[debian/openrocket]
/
core
/
src
/
net
/
sf
/
openrocket
/
file
/
motor
/
RockSimMotorLoader.java
diff --git
a/core/src/net/sf/openrocket/file/motor/RockSimMotorLoader.java
b/core/src/net/sf/openrocket/file/motor/RockSimMotorLoader.java
index d2bbcd265e0e83ec29d436a635716b4029f86fc8..8627bf82f79ae3b74ade31cc15717fc8324eb021 100644
(file)
--- a/
core/src/net/sf/openrocket/file/motor/RockSimMotorLoader.java
+++ b/
core/src/net/sf/openrocket/file/motor/RockSimMotorLoader.java
@@
-32,19
+32,19
@@
public class RockSimMotorLoader extends AbstractMotorLoader {
public static final Charset CHARSET = Charset.forName(CHARSET_NAME);
public static final Charset CHARSET = Charset.forName(CHARSET_NAME);
-
+
/** Any delay longer than this will be interpreted as a plugged motor. */
private static final int DELAY_LIMIT = 90;
/** Any delay longer than this will be interpreted as a plugged motor. */
private static final int DELAY_LIMIT = 90;
-
+
@Override
protected Charset getDefaultCharset() {
return CHARSET;
}
@Override
protected Charset getDefaultCharset() {
return CHARSET;
}
-
+
/**
* Load a <code>Motor</code> from a RockSim motor definition file specified by the
* <code>Reader</code>. The <code>Reader</code> is responsible for using the correct
/**
* Load a <code>Motor</code> from a RockSim motor definition file specified by the
* <code>Reader</code>. The <code>Reader</code> is responsible for using the correct
@@
-73,7
+73,7
@@
public class RockSimMotorLoader extends AbstractMotorLoader {
}
}
-
+
/**
* Initial handler for the RockSim engine files.
*/
/**
* Initial handler for the RockSim engine files.
*/
@@
-234,11
+234,11
@@
public class RockSimMotorLoader extends AbstractMotorLoader {
// Motor type
str = attributes.get("Type");
// Motor type
str = attributes.get("Type");
- if (
str != null && str.equalsIgnoreCase("single-use"
)) {
+ if (
"single-use".equalsIgnoreCase(str
)) {
type = Motor.Type.SINGLE;
type = Motor.Type.SINGLE;
- } else if (
str != null && str.equalsIgnoreCase("hybrid"
)) {
+ } else if (
"hybrid".equalsIgnoreCase(str
)) {
type = Motor.Type.HYBRID;
type = Motor.Type.HYBRID;
- } else if (
str != null && str.equalsIgnoreCase("reloadable"
)) {
+ } else if (
"reloadable".equalsIgnoreCase(str
)) {
type = Motor.Type.RELOAD;
} else {
type = Motor.Type.UNKNOWN;
type = Motor.Type.RELOAD;
} else {
type = Motor.Type.UNKNOWN;
@@
-323,7
+323,7
@@
public class RockSimMotorLoader extends AbstractMotorLoader {
if (time == null || time.size() == 0)
throw new SAXException("Illegal motor data");
if (time == null || time.size() == 0)
throw new SAXException("Illegal motor data");
-
+
finalizeThrustCurve(time, force, mass, cg);
final int n = time.size();
finalizeThrustCurve(time, force, mass, cg);
final int n = time.size();
@@
-348,7
+348,7
@@
public class RockSimMotorLoader extends AbstractMotorLoader {
cgArray[i] = new Coordinate(cg.get(i), 0, 0, mass.get(i));
}
cgArray[i] = new Coordinate(cg.get(i), 0, 0, mass.get(i));
}
-
+
// Create the motor digest from all data available in the file
MotorDigest motorDigest = new MotorDigest();
motorDigest.update(DataType.TIME_ARRAY, timeArray);
// Create the motor digest from all data available in the file
MotorDigest motorDigest = new MotorDigest();
motorDigest.update(DataType.TIME_ARRAY, timeArray);
@@
-361,10
+361,9
@@
public class RockSimMotorLoader extends AbstractMotorLoader {
motorDigest.update(DataType.CG_PER_TIME, toArray(cg));
}
motorDigest.update(DataType.FORCE_PER_TIME, thrustArray);
motorDigest.update(DataType.CG_PER_TIME, toArray(cg));
}
motorDigest.update(DataType.FORCE_PER_TIME, thrustArray);
- // TODO: HIGH: Motor digest?
- // final String digest = motorDigest.getDigest();
+ final String digest = motorDigest.getDigest();
+
-
try {
Manufacturer m = Manufacturer.getManufacturer(manufacturer);
Motor.Type t = type;
try {
Manufacturer m = Manufacturer.getManufacturer(manufacturer);
Motor.Type t = type;
@@
-380,7
+379,7
@@
public class RockSimMotorLoader extends AbstractMotorLoader {
}
return new ThrustCurveMotor(m, designation, description, t,
}
return new ThrustCurveMotor(m, designation, description, t,
- delays, diameter, length, timeArray, thrustArray, cgArray);
+ delays, diameter, length, timeArray, thrustArray, cgArray
, digest
);
} catch (IllegalArgumentException e) {
throw new SAXException("Illegal motor data", e);
}
} catch (IllegalArgumentException e) {
throw new SAXException("Illegal motor data", e);
}
@@
-460,7
+459,7
@@
public class RockSimMotorLoader extends AbstractMotorLoader {
}
}
-
+
private static boolean hasIllegalValue(List<Double> list) {
for (Double d : list) {
if (d == null || d.isNaN() || d.isInfinite()) {
private static boolean hasIllegalValue(List<Double> list) {
for (Double d : list) {
if (d == null || d.isNaN() || d.isInfinite()) {