Merge branch 'refs/heads/unstable' into material-groups
# Conflicts: # core/src/main/java/info/openrocket/core/database/Databases.java # core/src/main/java/info/openrocket/core/file/openrocket/importt/ConfigHandler.java # core/src/main/java/info/openrocket/core/material/Material.java # swing/src/main/java/info/openrocket/swing/gui/configdialog/ParachuteConfig.java # swing/src/main/java/info/openrocket/swing/gui/dialogs/preferences/DesignPreferencesPanel.java # swing/src/main/java/info/openrocket/swing/gui/dialogs/preferences/DisplayPreferencesPanel.java # swing/src/main/java/info/openrocket/swing/gui/dialogs/preferences/MaterialEditPanel.java # swing/src/main/java/info/openrocket/swing/gui/util/GUIUtil.java # swing/src/main/java/info/openrocket/swing/gui/widgets/SearchableAndCategorizableComboBox.java
This commit is contained in:
commit
a38230a05e
@ -35,9 +35,7 @@ public class CommandlineInterpreter {
|
||||
try {
|
||||
final PostfixExpression pe = PostfixExpression.fromInfix(string);
|
||||
System.out.println(pe.calculate());
|
||||
} catch (UnparsableExpressionException e) {
|
||||
e.printStackTrace();
|
||||
} catch (UnknownFunctionException e) {
|
||||
} catch (UnparsableExpressionException | UnknownFunctionException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ public abstract class CustomFunction extends CalculationToken {
|
||||
|
||||
@Override
|
||||
void mutateStackForCalculation(Stack<Variable> stack, VariableSet variables) {
|
||||
List<Variable> args = new ArrayList<Variable>(argc);
|
||||
List<Variable> args = new ArrayList<>(argc);
|
||||
for (int i=0; i < argc; i++) {
|
||||
args.add(i, stack.pop() );
|
||||
}
|
||||
|
@ -36,9 +36,9 @@ public class Example {
|
||||
}
|
||||
|
||||
double subtotal = 0;
|
||||
for (int i = 0; i < vals.length; i++ ){
|
||||
subtotal += vals[i];
|
||||
}
|
||||
for (double val : vals) {
|
||||
subtotal += val;
|
||||
}
|
||||
|
||||
subtotal = scale * subtotal / vals.length;
|
||||
return new Variable("double MEAN result, ", subtotal);
|
||||
|
@ -13,7 +13,7 @@ import java.util.Set;
|
||||
*/
|
||||
public class ExpressionBuilder {
|
||||
private VariableSet variables = new VariableSet();
|
||||
private final Set<CustomFunction> customFunctions = new HashSet<CustomFunction>();
|
||||
private final Set<CustomFunction> customFunctions = new HashSet<>();
|
||||
|
||||
private String expression;
|
||||
|
||||
@ -48,7 +48,7 @@ public class ExpressionBuilder {
|
||||
for (String name : variables.getVariableNames()) {
|
||||
function.append(name).append(',');
|
||||
}
|
||||
expression = function.deleteCharAt(function.length() - 1).toString() + ")=" + expression;
|
||||
expression = function.deleteCharAt(function.length() - 1) + ")=" + expression;
|
||||
}
|
||||
// create the PostfixExpression and return it as a Calculable
|
||||
PostfixExpression delegate = PostfixExpression.fromInfix(expression, customFunctions);
|
||||
|
@ -93,50 +93,29 @@ class FunctionToken extends CalculationToken {
|
||||
* The actual function application on a double
|
||||
*/
|
||||
private double applyFunction(double x){
|
||||
switch (function) {
|
||||
case ABS:
|
||||
return Math.abs(x);
|
||||
case ACOS:
|
||||
return Math.acos(x);
|
||||
case ASIN:
|
||||
return Math.asin(x);
|
||||
case ATAN:
|
||||
return Math.atan(x);
|
||||
case CBRT:
|
||||
return Math.cbrt(x);
|
||||
case CEIL:
|
||||
return Math.ceil(x);
|
||||
case COS:
|
||||
return Math.cos(x);
|
||||
case COSH:
|
||||
return Math.cosh(x);
|
||||
case EXP:
|
||||
return Math.exp(x);
|
||||
case EXPM1:
|
||||
return Math.expm1(x);
|
||||
case FLOOR:
|
||||
return Math.floor(x);
|
||||
case ROUND:
|
||||
return Math.round(x);
|
||||
case RANDOM:
|
||||
return Math.random()*x;
|
||||
case LOG:
|
||||
return Math.log(x);
|
||||
case LOG10:
|
||||
return Math.log10(x);
|
||||
case SIN:
|
||||
return Math.sin(x);
|
||||
case SINH:
|
||||
return Math.sinh(x);
|
||||
case SQRT:
|
||||
return Math.sqrt(x);
|
||||
case TAN:
|
||||
return Math.tan(x);
|
||||
case TANH:
|
||||
return Math.tanh(x);
|
||||
default:
|
||||
return Double.NaN; // should not happen ;)
|
||||
}
|
||||
return switch (function) {
|
||||
case ABS -> Math.abs(x);
|
||||
case ACOS -> Math.acos(x);
|
||||
case ASIN -> Math.asin(x);
|
||||
case ATAN -> Math.atan(x);
|
||||
case CBRT -> Math.cbrt(x);
|
||||
case CEIL -> Math.ceil(x);
|
||||
case COS -> Math.cos(x);
|
||||
case COSH -> Math.cosh(x);
|
||||
case EXP -> Math.exp(x);
|
||||
case EXPM1 -> Math.expm1(x);
|
||||
case FLOOR -> Math.floor(x);
|
||||
case ROUND -> Math.round(x);
|
||||
case RANDOM -> Math.random() * x;
|
||||
case LOG -> Math.log(x);
|
||||
case LOG10 -> Math.log10(x);
|
||||
case SIN -> Math.sin(x);
|
||||
case SINH -> Math.sinh(x);
|
||||
case SQRT -> Math.sqrt(x);
|
||||
case TAN -> Math.tan(x);
|
||||
case TANH -> Math.tanh(x);
|
||||
default -> Double.NaN; // should not happen ;)
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -96,7 +96,7 @@ class InfixTranslator {
|
||||
infixExpression = substituteUnaryOperators(infixExpression);
|
||||
final Token[] tokens = new Tokenizer(variableStrings, customFunctions).tokenize(infixExpression);
|
||||
final StringBuilder output = new StringBuilder(tokens.length);
|
||||
final Stack<Token> operatorStack = new Stack<Token>();
|
||||
final Stack<Token> operatorStack = new Stack<>();
|
||||
for (final Token token : tokens) {
|
||||
token.mutateStackForInfixTranslation(operatorStack, output);
|
||||
}
|
||||
|
@ -50,24 +50,16 @@ class OperatorToken extends CalculationToken {
|
||||
* @return the corresponding {@link Operation}
|
||||
*/
|
||||
static Operation getOperation(char c) {
|
||||
switch (c) {
|
||||
case '+':
|
||||
return Operation.ADDITION;
|
||||
case '-':
|
||||
return Operation.SUBTRACTION;
|
||||
case '*':
|
||||
return Operation.MULTIPLICATION;
|
||||
case '/':
|
||||
return Operation.DIVISION;
|
||||
case '^':
|
||||
return Operation.EXPONENTIATION;
|
||||
case '#':
|
||||
return Operation.UNARY_MINUS;
|
||||
case '%':
|
||||
return Operation.MODULO;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
return switch (c) {
|
||||
case '+' -> Operation.ADDITION;
|
||||
case '-' -> Operation.SUBTRACTION;
|
||||
case '*' -> Operation.MULTIPLICATION;
|
||||
case '/' -> Operation.DIVISION;
|
||||
case '^' -> Operation.EXPONENTIATION;
|
||||
case '#' -> Operation.UNARY_MINUS;
|
||||
case '%' -> Operation.MODULO;
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
|
||||
static boolean isOperator(char c) {
|
||||
@ -133,26 +125,17 @@ class OperatorToken extends CalculationToken {
|
||||
|
||||
//System.out.println("Applying "+operation.toString()+" to values starting "+values[0]);
|
||||
|
||||
switch (operation) {
|
||||
case ADDITION:
|
||||
return values[0] + values[1];
|
||||
case SUBTRACTION:
|
||||
return values[0] - values[1];
|
||||
case MULTIPLICATION:
|
||||
return values[0] * values[1];
|
||||
case EXPONENTIATION:
|
||||
return Math.pow(values[0], values[1]);
|
||||
case DIVISION:
|
||||
return values[0] / values[1];
|
||||
case UNARY_MINUS:
|
||||
return -values[0];
|
||||
case UNARY_PLUS:
|
||||
return values[0];
|
||||
case MODULO:
|
||||
return values[0] % values[1];
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
return switch (operation) {
|
||||
case ADDITION -> values[0] + values[1];
|
||||
case SUBTRACTION -> values[0] - values[1];
|
||||
case MULTIPLICATION -> values[0] * values[1];
|
||||
case EXPONENTIATION -> Math.pow(values[0], values[1]);
|
||||
case DIVISION -> values[0] / values[1];
|
||||
case UNARY_MINUS -> -values[0];
|
||||
case UNARY_PLUS -> values[0];
|
||||
case MODULO -> values[0] % values[1];
|
||||
default -> 0;
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -165,20 +148,11 @@ class OperatorToken extends CalculationToken {
|
||||
}
|
||||
|
||||
int getOperandCount() {
|
||||
switch (operation) {
|
||||
case ADDITION:
|
||||
case SUBTRACTION:
|
||||
case MULTIPLICATION:
|
||||
case DIVISION:
|
||||
case EXPONENTIATION:
|
||||
case MODULO:
|
||||
return 2;
|
||||
case UNARY_MINUS:
|
||||
case UNARY_PLUS:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
return switch (operation) {
|
||||
case ADDITION, SUBTRACTION, MULTIPLICATION, DIVISION, EXPONENTIATION, MODULO -> 2;
|
||||
case UNARY_MINUS, UNARY_PLUS -> 1;
|
||||
default -> 0;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -103,7 +103,7 @@ public final class PostfixExpression extends AbstractExpression implements Calcu
|
||||
@Override
|
||||
public Variable calculate() throws IllegalArgumentException {
|
||||
|
||||
final Stack<Variable> stack = new Stack<Variable>();
|
||||
final Stack<Variable> stack = new Stack<>();
|
||||
for (final Token t : getTokens()) {
|
||||
((CalculationToken) t).mutateStackForCalculation(stack, variables);
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ import de.congrace.exp4j.FunctionToken.Function;
|
||||
*/
|
||||
class Tokenizer {
|
||||
private String[] variableNames;
|
||||
private final Set<String> functionNames = new HashSet<String>();
|
||||
private final Set<String> functionNames = new HashSet<>();
|
||||
private final Set<CustomFunction> customFunctions;
|
||||
|
||||
{
|
||||
@ -160,7 +160,7 @@ class Tokenizer {
|
||||
* when an unknown function name has been used.
|
||||
*/
|
||||
Token[] tokenize(String infix) throws UnparsableExpressionException, UnknownFunctionException {
|
||||
final List<Token> tokens = new ArrayList<Token>();
|
||||
final List<Token> tokens = new ArrayList<>();
|
||||
final char[] chars = infix.toCharArray();
|
||||
// iterate over the chars and fork on different types of input
|
||||
Token lastToken;
|
||||
@ -218,6 +218,6 @@ class Tokenizer {
|
||||
}
|
||||
tokens.add(lastToken);
|
||||
}
|
||||
return tokens.toArray(new Token[tokens.size()]);
|
||||
return tokens.toArray(new Token[0]);
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,6 @@ package info.openrocket.core.aerodynamics;
|
||||
|
||||
import static info.openrocket.core.util.MathUtil.pow2;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import info.openrocket.core.logging.Warning;
|
||||
import info.openrocket.core.logging.WarningSet;
|
||||
import info.openrocket.core.rocketcomponent.AxialStage;
|
||||
@ -32,6 +30,15 @@ import info.openrocket.core.util.ModID;
|
||||
import info.openrocket.core.util.PolyInterpolator;
|
||||
import info.openrocket.core.util.Reflection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
|
||||
/**
|
||||
* An aerodynamic calculator that uses the extended Barrowman method to
|
||||
* calculate the CP of a rocket.
|
||||
@ -527,9 +534,9 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
||||
|
||||
// Correct body data in map
|
||||
if (forceMap != null) {
|
||||
for (RocketComponent c : forceMap.keySet()) {
|
||||
if (c instanceof SymmetricComponent) {
|
||||
forceMap.get(c).setFrictionCD(forceMap.get(c).getFrictionCD() * correction);
|
||||
for (Map.Entry<RocketComponent, AerodynamicForces> entry : forceMap.entrySet()) {
|
||||
if (entry.getKey() instanceof SymmetricComponent) {
|
||||
entry.getValue().setFrictionCD(entry.getValue().getFrictionCD() * correction);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -564,7 +571,7 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
||||
if (configuration.getRocket().isPerfectFinish()) {
|
||||
|
||||
// Assume partial laminar layer. Roughness-limitation is checked later.
|
||||
if (Re < 1e4) {
|
||||
if (Re < 1.0e4) {
|
||||
// Too low, constant
|
||||
Cf = 1.33e-2;
|
||||
} else if (Re < 5.39e5) {
|
||||
@ -579,18 +586,18 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
||||
|
||||
if (mach < 1.1) {
|
||||
// Below Re=1e6 no correction
|
||||
if (Re > 1e6) {
|
||||
if (Re < 3e6) {
|
||||
c1 = 1 - 0.1 * pow2(mach) * (Re - 1e6) / 2e6; // transition to turbulent
|
||||
if (Re > 1.0e6) {
|
||||
if (Re < 3.0e6) {
|
||||
c1 = 1 - 0.1 * pow2(mach) * (Re - 1.0e6) / 2.0e6; // transition to turbulent
|
||||
} else {
|
||||
c1 = 1 - 0.1 * pow2(mach);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mach > 0.9) {
|
||||
if (Re > 1e6) {
|
||||
if (Re < 3e6) {
|
||||
c2 = 1 + (1.0 / Math.pow(1 + 0.045 * pow2(mach), 0.25) - 1) * (Re - 1e6) / 2e6;
|
||||
if (Re > 1.0e6) {
|
||||
if (Re < 3.0e6) {
|
||||
c2 = 1 + (1.0 / Math.pow(1 + 0.045 * pow2(mach), 0.25) - 1) * (Re - 1.0e6) / 2.0e6;
|
||||
} else {
|
||||
c2 = 1.0 / Math.pow(1 + 0.045 * pow2(mach), 0.25);
|
||||
}
|
||||
@ -610,7 +617,7 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
||||
} else {
|
||||
|
||||
// Assume fully turbulent. Roughness-limitation is checked later.
|
||||
if (Re < 1e4) {
|
||||
if (Re < 1.0e4) {
|
||||
// Too low, constant
|
||||
Cf = 1.48e-2;
|
||||
} else {
|
||||
|
@ -23,7 +23,7 @@ import info.openrocket.core.util.ModID;
|
||||
*/
|
||||
public class FlightConditions implements Cloneable, ChangeSource, Monitorable {
|
||||
|
||||
private List<EventListener> listenerList = new ArrayList<EventListener>();
|
||||
private List<EventListener> listenerList = new ArrayList<>();
|
||||
private EventObject event = new EventObject(this);
|
||||
|
||||
/** Reference length used in calculations. */
|
||||
@ -419,7 +419,7 @@ public class FlightConditions implements Cloneable, ChangeSource, Monitorable {
|
||||
public FlightConditions clone() {
|
||||
try {
|
||||
FlightConditions cond = (FlightConditions) super.clone();
|
||||
cond.listenerList = new ArrayList<EventListener>();
|
||||
cond.listenerList = new ArrayList<>();
|
||||
cond.event = new EventObject(cond);
|
||||
cond.atmosphericConditions = atmosphericConditions.clone();
|
||||
return cond;
|
||||
|
@ -547,8 +547,8 @@ public class FinSetCalc extends RocketComponentCalc {
|
||||
double x = 1.0;
|
||||
double val = 0;
|
||||
|
||||
for (int i = 0; i < poly.length; i++) {
|
||||
val += poly[i] * x;
|
||||
for (double v : poly) {
|
||||
val += v * x;
|
||||
x *= m;
|
||||
}
|
||||
// logger.debug("val = {}", val);
|
||||
|
@ -1,7 +1,6 @@
|
||||
package info.openrocket.core.aerodynamics.barrowman;
|
||||
|
||||
import java.util.List;
|
||||
import java.lang.Math;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -6,7 +6,6 @@ import info.openrocket.core.aerodynamics.AerodynamicForces;
|
||||
import info.openrocket.core.aerodynamics.FlightConditions;
|
||||
import info.openrocket.core.logging.Warning;
|
||||
import info.openrocket.core.logging.WarningSet;
|
||||
import info.openrocket.core.rocketcomponent.BodyTube;
|
||||
import info.openrocket.core.rocketcomponent.RocketComponent;
|
||||
import info.openrocket.core.rocketcomponent.TubeFinSet;
|
||||
import info.openrocket.core.util.Coordinate;
|
||||
@ -230,8 +229,8 @@ public class TubeFinSetCalc extends TubeCalc {
|
||||
double x = 1.0;
|
||||
double val = 0;
|
||||
|
||||
for (int i = 0; i < poly.length; i++) {
|
||||
val += poly[i] * x;
|
||||
for (double v : poly) {
|
||||
val += v * x;
|
||||
x *= m;
|
||||
}
|
||||
// log.debug("val = {}", val);
|
||||
|
@ -80,16 +80,16 @@ public class DefaultAppearance {
|
||||
private static final Appearance CHUTE = simple("/datafiles/textures/chute.jpg");
|
||||
|
||||
|
||||
private static final Appearance ESTES_BT = simpleAlpha(new ORColor(212, 185, 145), .3f, "/datafiles/textures/spiral-wound-alpha.png");
|
||||
private static final Appearance ESTES_IT = simpleAlpha(new ORColor(168, 146, 116), .1f, "/datafiles/textures/spiral-wound-alpha.png");
|
||||
private static final Appearance WHITE_BT = simpleAlpha(new ORColor(240, 240, 240), .3f, "/datafiles/textures/spiral-wound-alpha.png");
|
||||
private static final Appearance ESTES_BT = simpleAlpha(new ORColor(212, 185, 145), 0.3f, "/datafiles/textures/spiral-wound-alpha.png");
|
||||
private static final Appearance ESTES_IT = simpleAlpha(new ORColor(168, 146, 116), 0.1f, "/datafiles/textures/spiral-wound-alpha.png");
|
||||
private static final Appearance WHITE_BT = simpleAlpha(new ORColor(240, 240, 240), 0.3f, "/datafiles/textures/spiral-wound-alpha.png");
|
||||
|
||||
private static final Appearance ESTES_MOTOR = simple("/datafiles/textures/motors/estes.jpg");
|
||||
private static final Appearance AEROTECH_MOTOR = simple("/datafiles/textures/motors/aerotech.png");
|
||||
private static final Appearance KLIMA_MOTOR = simple("/datafiles/textures/motors/klima.jpg");
|
||||
private static final Appearance REUSABLE_MOTOR = simpleAlpha(new ORColor(195, 60, 50), .6f, "/datafiles/textures/motors/reusable.png");
|
||||
private static final Appearance REUSABLE_MOTOR = simpleAlpha(new ORColor(195, 60, 50), 0.6f, "/datafiles/textures/motors/reusable.png");
|
||||
|
||||
private static final HashMap<ORColor, Appearance> plastics = new HashMap<ORColor, Appearance>();
|
||||
private static final HashMap<ORColor, Appearance> plastics = new HashMap<>();
|
||||
|
||||
/**
|
||||
* gets the appearance correspondent to the plastic with the given color
|
||||
@ -99,7 +99,7 @@ public class DefaultAppearance {
|
||||
*/
|
||||
private static Appearance getPlastic(ORColor c) {
|
||||
if (!plastics.containsKey(c)) {
|
||||
plastics.put(c, new Appearance(c, .3));
|
||||
plastics.put(c, new Appearance(c, 0.3));
|
||||
}
|
||||
return plastics.get(c);
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package info.openrocket.core.appearance.defaults;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@ -51,17 +50,13 @@ public class ResourceDecalImage implements DecalImage {
|
||||
@Override
|
||||
public void exportImage(File file) throws IOException {
|
||||
InputStream is = getBytes();
|
||||
OutputStream os = new BufferedOutputStream(new FileOutputStream(file));
|
||||
|
||||
if (is == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
try (is; OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
|
||||
FileUtils.copy(is, os);
|
||||
} finally {
|
||||
is.close();
|
||||
os.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,9 +28,9 @@ public class SystemInfo {
|
||||
public static Platform getPlatform() {
|
||||
String os = System.getProperty("os.name").toLowerCase(Locale.ENGLISH);
|
||||
|
||||
if (os.indexOf("win") >= 0) {
|
||||
if (os.contains("win")) {
|
||||
return Platform.WINDOWS;
|
||||
} else if (os.indexOf("mac") >= 0) {
|
||||
} else if (os.contains("mac")) {
|
||||
return Platform.MAC_OS;
|
||||
} else {
|
||||
/*
|
||||
@ -51,12 +51,10 @@ public class SystemInfo {
|
||||
* otherwise
|
||||
*/
|
||||
public static boolean isConfined() {
|
||||
switch (getPlatform()) {
|
||||
case UNIX:
|
||||
return (System.getenv("SNAP_VERSION") != null);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return switch (getPlatform()) {
|
||||
case UNIX -> (System.getenv("SNAP_VERSION") != null);
|
||||
default -> false;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -35,7 +35,7 @@ public class ComponentPresetDatabase extends Database<ComponentPreset> implement
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
List<ComponentPreset> result = new ArrayList<ComponentPreset>(list.size() / 6);
|
||||
List<ComponentPreset> result = new ArrayList<>(list.size() / 6);
|
||||
|
||||
for (ComponentPreset preset : list) {
|
||||
if (preset.get(ComponentPreset.TYPE).equals(type)) {
|
||||
@ -61,7 +61,7 @@ public class ComponentPresetDatabase extends Database<ComponentPreset> implement
|
||||
return listForType(type);
|
||||
}
|
||||
|
||||
List<ComponentPreset> result = new ArrayList<ComponentPreset>(list.size() / 6);
|
||||
List<ComponentPreset> result = new ArrayList<>(list.size() / 6);
|
||||
|
||||
Set<String> favorites = Application.getPreferences().getComponentFavorites(type);
|
||||
|
||||
@ -83,12 +83,13 @@ public class ComponentPresetDatabase extends Database<ComponentPreset> implement
|
||||
return listForType(type[0]);
|
||||
}
|
||||
|
||||
List<ComponentPreset> result = new ArrayList<ComponentPreset>(list.size() / 6);
|
||||
List<ComponentPreset> result = new ArrayList<>(list.size() / 6);
|
||||
|
||||
for (ComponentPreset preset : list) {
|
||||
ComponentPreset.Type presetType = preset.get(ComponentPreset.TYPE);
|
||||
typeLoop: for (int i = 0; i < type.length; i++) {
|
||||
if (presetType.equals(type[i])) {
|
||||
typeLoop:
|
||||
for (ComponentPreset.Type value : type) {
|
||||
if (presetType.equals(value)) {
|
||||
result.add(preset);
|
||||
break typeLoop; // from inner loop.
|
||||
}
|
||||
@ -105,7 +106,7 @@ public class ComponentPresetDatabase extends Database<ComponentPreset> implement
|
||||
|
||||
@Override
|
||||
public List<ComponentPreset> find(String manufacturer, String partNo) {
|
||||
List<ComponentPreset> presets = new ArrayList<ComponentPreset>();
|
||||
List<ComponentPreset> presets = new ArrayList<>();
|
||||
for (ComponentPreset preset : list) {
|
||||
if (preset.getManufacturer().matches(manufacturer) && preset.getPartNo().equals(partNo)) {
|
||||
presets.add(preset);
|
||||
|
@ -6,8 +6,6 @@ import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import info.openrocket.core.database.DatabaseListener;
|
||||
|
||||
/**
|
||||
* A database set. This class functions as a <code>Set</code> that contains
|
||||
* items
|
||||
@ -20,8 +18,8 @@ import info.openrocket.core.database.DatabaseListener;
|
||||
public class Database<T extends Comparable<T>> extends AbstractSet<T> {
|
||||
|
||||
/** the list that contains the data from the database itself */
|
||||
protected final List<T> list = new ArrayList<T>();
|
||||
private final ArrayList<DatabaseListener<T>> listeners = new ArrayList<DatabaseListener<T>>();
|
||||
protected final List<T> list = new ArrayList<>();
|
||||
private final ArrayList<DatabaseListener<T>> listeners = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public Iterator<T> iterator() {
|
||||
|
@ -26,15 +26,15 @@ public class Databases {
|
||||
/**
|
||||
* A database of bulk materials (with bulk densities).
|
||||
*/
|
||||
public static final Database<Material> BULK_MATERIAL = new Database<Material>();
|
||||
public static final Database<Material> BULK_MATERIAL = new Database<>();
|
||||
/**
|
||||
* A database of surface materials (with surface densities).
|
||||
*/
|
||||
public static final Database<Material> SURFACE_MATERIAL = new Database<Material>();
|
||||
public static final Database<Material> SURFACE_MATERIAL = new Database<>();
|
||||
/**
|
||||
* A database of linear material (with length densities).
|
||||
*/
|
||||
public static final Database<Material> LINE_MATERIAL = new Database<Material>();
|
||||
public static final Database<Material> LINE_MATERIAL = new Database<>();
|
||||
|
||||
|
||||
|
||||
|
@ -103,9 +103,8 @@ public class MotorDatabaseLoader extends AsynchronousDatabaseLoader {
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private void loadSerialized(Pair<File, InputStream> f) {
|
||||
try {
|
||||
log.debug("Reading motors from file " + f.getU().getPath());
|
||||
ObjectInputStream ois = new ObjectInputStream(f.getV());
|
||||
log.debug("Reading motors from file " + f.getU().getPath());
|
||||
try (ObjectInputStream ois = new ObjectInputStream(f.getV())) {
|
||||
List<ThrustCurveMotor> motors = (List<ThrustCurveMotor>) ois.readObject();
|
||||
addMotors(motors);
|
||||
} catch (Exception ex) {
|
||||
|
@ -7,8 +7,6 @@ import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import info.openrocket.core.motor.DesignationComparator;
|
||||
import info.openrocket.core.motor.Manufacturer;
|
||||
@ -30,10 +28,10 @@ public class ThrustCurveMotorSet implements Comparable<ThrustCurveMotorSet> {
|
||||
private static final DesignationComparator DESIGNATION_COMPARATOR = new DesignationComparator();
|
||||
private static final ThrustCurveMotorComparator comparator = new ThrustCurveMotorComparator();
|
||||
|
||||
private final ArrayList<ThrustCurveMotor> motors = new ArrayList<ThrustCurveMotor>();
|
||||
private final Map<ThrustCurveMotor, String> digestMap = new IdentityHashMap<ThrustCurveMotor, String>();
|
||||
private final ArrayList<ThrustCurveMotor> motors = new ArrayList<>();
|
||||
private final Map<ThrustCurveMotor, String> digestMap = new IdentityHashMap<>();
|
||||
|
||||
private final List<Double> delays = new ArrayList<Double>();
|
||||
private final List<Double> delays = new ArrayList<>();
|
||||
|
||||
private Manufacturer manufacturer = null;
|
||||
private String commonName = null;
|
||||
@ -60,7 +58,7 @@ public class ThrustCurveMotorSet implements Comparable<ThrustCurveMotorSet> {
|
||||
if (!checkMotorOverwrite(motor)) {
|
||||
motors.add(motor);
|
||||
digestMap.put(motor, motor.getDigest());
|
||||
Collections.sort(motors, comparator);
|
||||
motors.sort(comparator);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,14 +19,14 @@ import info.openrocket.core.motor.ThrustCurveMotor;
|
||||
public class ThrustCurveMotorSetDatabase implements MotorDatabase {
|
||||
private static final Logger log = LoggerFactory.getLogger(ThrustCurveMotorSetDatabase.class);
|
||||
|
||||
private final List<ThrustCurveMotorSet> motorSets = new ArrayList<ThrustCurveMotorSet>();
|
||||
private final List<ThrustCurveMotorSet> motorSets = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public List<ThrustCurveMotor> findMotors(String digest, Motor.Type type, String manufacturer, String designation,
|
||||
double diameter, double length) {
|
||||
ArrayList<ThrustCurveMotor> fullMatches = new ArrayList<ThrustCurveMotor>();
|
||||
ArrayList<ThrustCurveMotor> digestMatches = new ArrayList<ThrustCurveMotor>();
|
||||
ArrayList<ThrustCurveMotor> descriptionMatches = new ArrayList<ThrustCurveMotor>();
|
||||
ArrayList<ThrustCurveMotor> fullMatches = new ArrayList<>();
|
||||
ArrayList<ThrustCurveMotor> digestMatches = new ArrayList<>();
|
||||
ArrayList<ThrustCurveMotor> descriptionMatches = new ArrayList<>();
|
||||
|
||||
// Apply filters to see if we can find any motors that match the given criteria.
|
||||
// We'll return
|
||||
@ -39,7 +39,7 @@ public class ThrustCurveMotorSetDatabase implements MotorDatabase {
|
||||
|
||||
// unlike the description, digest must be present in search criteria to get a
|
||||
// match
|
||||
if (digest == null || digest != m.getDigest())
|
||||
if (digest == null || !digest.equals(m.getDigest()))
|
||||
matchDigest = false;
|
||||
|
||||
// match description
|
||||
|
@ -41,7 +41,7 @@ public class DecalRegistry {
|
||||
}
|
||||
|
||||
/** the decal usage map */
|
||||
private final Map<String, DecalImageImpl> registeredDecals = new HashMap<String, DecalImageImpl>();
|
||||
private final Map<String, DecalImageImpl> registeredDecals = new HashMap<>();
|
||||
|
||||
/**
|
||||
* returns a new decal with the same image but with unique names
|
||||
@ -113,7 +113,7 @@ public class DecalRegistry {
|
||||
|
||||
public Collection<DecalImage> getDecalList() {
|
||||
|
||||
Set<DecalImage> decals = new TreeSet<DecalImage>();
|
||||
Set<DecalImage> decals = new TreeSet<>();
|
||||
|
||||
decals.addAll(registeredDecals.values());
|
||||
|
||||
@ -166,12 +166,9 @@ public class DecalRegistry {
|
||||
if (!exportedFile.exists()) {
|
||||
throw new DecalNotFoundException(exportedFile.getAbsolutePath(), this);
|
||||
}
|
||||
InputStream rawIs = new FileInputStream(exportedFile);
|
||||
try {
|
||||
try (InputStream rawIs = new FileInputStream(exportedFile)) {
|
||||
byte[] bytes = FileUtils.readBytes(rawIs);
|
||||
return new ByteArrayInputStream(bytes);
|
||||
} finally {
|
||||
rawIs.close();
|
||||
}
|
||||
|
||||
}
|
||||
@ -299,7 +296,7 @@ public class DecalRegistry {
|
||||
String basename = getGroup(BASE_NAME_INDEX, fileNamePattern.matcher(newName));
|
||||
String extension = getGroup(EXTENSION_INDEX, fileNamePattern.matcher(newName));
|
||||
|
||||
Set<Integer> counts = new TreeSet<Integer>();
|
||||
Set<Integer> counts = new TreeSet<>();
|
||||
|
||||
boolean needsRewrite = false;
|
||||
|
||||
|
@ -1,7 +1,16 @@
|
||||
package info.openrocket.core.document;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.EventObject;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import info.openrocket.core.file.wavefrontobj.export.OBJExportOptions;
|
||||
import info.openrocket.core.material.Material;
|
||||
@ -69,8 +78,8 @@ public class OpenRocketDocument implements ComponentChangeListener, StateChangeL
|
||||
|
||||
private final Rocket rocket;
|
||||
|
||||
private final ArrayList<Simulation> simulations = new ArrayList<Simulation>();
|
||||
private final ArrayList<CustomExpression> customExpressions = new ArrayList<CustomExpression>();
|
||||
private final ArrayList<Simulation> simulations = new ArrayList<>();
|
||||
private final ArrayList<CustomExpression> customExpressions = new ArrayList<>();
|
||||
|
||||
// The Photo Settings will be saved in the core module as a map of key values with corresponding content
|
||||
private Map<String, String> photoSettings = new HashMap<>();
|
||||
@ -83,8 +92,8 @@ public class OpenRocketDocument implements ComponentChangeListener, StateChangeL
|
||||
* The undo history of the rocket. Whenever a new undo position is created while the
|
||||
* rocket is in "dirty" state, the rocket is copied here.
|
||||
*/
|
||||
private final LinkedList<Rocket> undoHistory = new LinkedList<Rocket>();
|
||||
private final LinkedList<String> undoDescription = new LinkedList<String>();
|
||||
private final LinkedList<Rocket> undoHistory = new LinkedList<>();
|
||||
private final LinkedList<String> undoDescription = new LinkedList<>();
|
||||
|
||||
/**
|
||||
* The position in the undoHistory we are currently at. If modifications have been
|
||||
@ -100,7 +109,7 @@ public class OpenRocketDocument implements ComponentChangeListener, StateChangeL
|
||||
private String storedDescription = null;
|
||||
|
||||
|
||||
private final ArrayList<UndoRedoListener> undoRedoListeners = new ArrayList<UndoRedoListener>(2);
|
||||
private final ArrayList<UndoRedoListener> undoRedoListeners = new ArrayList<>(2);
|
||||
|
||||
private File file = null;
|
||||
private ModID modID = ModID.INVALID;
|
||||
@ -111,7 +120,7 @@ public class OpenRocketDocument implements ComponentChangeListener, StateChangeL
|
||||
|
||||
private final DecalRegistry decalRegistry = new DecalRegistry();
|
||||
|
||||
private final List<DocumentChangeListener> listeners = new ArrayList<DocumentChangeListener>();
|
||||
private final List<DocumentChangeListener> listeners = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* main constructor, enable events in the rocket
|
||||
@ -167,7 +176,7 @@ public class OpenRocketDocument implements ComponentChangeListener, StateChangeL
|
||||
* @returns a set of all the flight data types defined or available in any way in the rocket document
|
||||
*/
|
||||
public Set<FlightDataType> getFlightDataTypes() {
|
||||
Set<FlightDataType> allTypes = new LinkedHashSet<FlightDataType>();
|
||||
Set<FlightDataType> allTypes = new LinkedHashSet<>();
|
||||
|
||||
// built in
|
||||
Collections.addAll(allTypes, FlightDataType.ALL_TYPES);
|
||||
@ -279,9 +288,7 @@ public class OpenRocketDocument implements ComponentChangeListener, StateChangeL
|
||||
* @return the decal list registered in the document
|
||||
*/
|
||||
public Collection<DecalImage> getDecalList() {
|
||||
|
||||
return decalRegistry.getDecalList();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -292,9 +299,7 @@ public class OpenRocketDocument implements ComponentChangeListener, StateChangeL
|
||||
public int countDecalUsage(DecalImage img) {
|
||||
int count = 0;
|
||||
|
||||
Iterator<RocketComponent> it = rocket.iterator();
|
||||
while (it.hasNext()) {
|
||||
RocketComponent c = it.next();
|
||||
for (RocketComponent c : rocket) {
|
||||
if (hasDecal(c, img))
|
||||
count++;
|
||||
else if (hasDecalInside(c, img))
|
||||
|
@ -84,7 +84,7 @@ public class Simulation implements ChangeSource, Cloneable {
|
||||
// TODO: HIGH: Change to use actual conditions class??
|
||||
private SimulationOptions options = new SimulationOptions();
|
||||
|
||||
private ArrayList<SimulationExtension> simulationExtensions = new ArrayList<SimulationExtension>();
|
||||
private ArrayList<SimulationExtension> simulationExtensions = new ArrayList<>();
|
||||
|
||||
|
||||
private final Class<? extends SimulationEngine> simulationEngineClass = BasicEventSimulationEngine.class;
|
||||
@ -94,7 +94,7 @@ public class Simulation implements ChangeSource, Cloneable {
|
||||
private final Class<? extends MassCalculator> massCalculatorClass = MassCalculator.class;
|
||||
|
||||
/** Listeners for this object */
|
||||
private List<EventListener> listeners = new ArrayList<EventListener>();
|
||||
private List<EventListener> listeners = new ArrayList<>();
|
||||
|
||||
|
||||
/** The conditions actually used in the previous simulation, or null */
|
||||
@ -547,11 +547,11 @@ public class Simulation implements ChangeSource, Cloneable {
|
||||
copy.mutex = SafetyMutex.newInstance();
|
||||
copy.status = Status.NOT_SIMULATED;
|
||||
copy.options = this.options.clone();
|
||||
copy.simulationExtensions = new ArrayList<SimulationExtension>();
|
||||
copy.simulationExtensions = new ArrayList<>();
|
||||
for (SimulationExtension c : this.simulationExtensions) {
|
||||
copy.simulationExtensions.add(c.clone());
|
||||
}
|
||||
copy.listeners = new ArrayList<EventListener>();
|
||||
copy.listeners = new ArrayList<>();
|
||||
copy.simulatedConditions = null;
|
||||
copy.simulatedConfigurationDescription = null;
|
||||
copy.simulatedData = null;
|
||||
|
@ -2,7 +2,6 @@ package info.openrocket.core.document.attachments;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
|
@ -24,9 +24,7 @@ public class ZipFileAttachment extends Attachment {
|
||||
public InputStream getBytes() throws DecalNotFoundException, IOException {
|
||||
String name = getName();
|
||||
|
||||
ZipInputStream zis = new ZipInputStream(zipFileLocation.openStream());
|
||||
|
||||
try {
|
||||
try (ZipInputStream zis = new ZipInputStream(zipFileLocation.openStream())) {
|
||||
ZipEntry entry = zis.getNextEntry();
|
||||
while (entry != null) {
|
||||
if (entry.getName().equals(name)) {
|
||||
@ -36,8 +34,6 @@ public class ZipFileAttachment extends Attachment {
|
||||
entry = zis.getNextEntry();
|
||||
}
|
||||
throw new DecalNotFoundException(name, null);
|
||||
} finally {
|
||||
zis.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ public class GeneralRocketSaver {
|
||||
return;
|
||||
}
|
||||
|
||||
Set<DecalImage> usedDecals = new TreeSet<DecalImage>();
|
||||
Set<DecalImage> usedDecals = new TreeSet<>();
|
||||
|
||||
// Look for all decals used in the rocket.
|
||||
for (RocketComponent c : document.getRocket()) {
|
||||
@ -211,9 +211,9 @@ public class GeneralRocketSaver {
|
||||
|
||||
// Open a zip stream to write to.
|
||||
ZipOutputStream zos = new ZipOutputStream(output);
|
||||
zos.setLevel(9);
|
||||
// big try block to close the zos.
|
||||
try {
|
||||
try (zos) {
|
||||
zos.setLevel(9);
|
||||
|
||||
ZipEntry mainFile = new ZipEntry("rocket.ork");
|
||||
zos.putNextEntry(mainFile);
|
||||
@ -241,8 +241,6 @@ public class GeneralRocketSaver {
|
||||
}
|
||||
|
||||
zos.flush();
|
||||
} finally {
|
||||
zos.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -14,16 +14,12 @@ public final class TipShapeCode {
|
||||
* @return a CrossSection instance
|
||||
*/
|
||||
public static FinSet.CrossSection convertTipShapeCode(int tipShape) {
|
||||
switch (tipShape) {
|
||||
case 0:
|
||||
return FinSet.CrossSection.SQUARE;
|
||||
case 1:
|
||||
return FinSet.CrossSection.ROUNDED;
|
||||
case 2:
|
||||
return FinSet.CrossSection.AIRFOIL;
|
||||
default:
|
||||
return FinSet.CrossSection.SQUARE;
|
||||
}
|
||||
return switch (tipShape) {
|
||||
case 0 -> FinSet.CrossSection.SQUARE;
|
||||
case 1 -> FinSet.CrossSection.ROUNDED;
|
||||
case 2 -> FinSet.CrossSection.AIRFOIL;
|
||||
default -> FinSet.CrossSection.SQUARE;
|
||||
};
|
||||
}
|
||||
|
||||
public static int convertTipShapeCode(FinSet.CrossSection cs) {
|
||||
|
@ -69,8 +69,8 @@ public abstract class AbstractMotorLoader implements MotorLoader {
|
||||
*/
|
||||
protected static List<Double> calculateMass(List<Double> time, List<Double> thrust,
|
||||
double total, double prop) {
|
||||
List<Double> mass = new ArrayList<Double>();
|
||||
List<Double> deltam = new ArrayList<Double>();
|
||||
List<Double> mass = new ArrayList<>();
|
||||
List<Double> deltam = new ArrayList<>();
|
||||
|
||||
double t0, f0;
|
||||
double totalMassChange = 0;
|
||||
@ -134,7 +134,7 @@ public abstract class AbstractMotorLoader implements MotorLoader {
|
||||
*/
|
||||
protected static String[] split(String str, String delim) {
|
||||
String[] pieces = str.split(delim);
|
||||
if (pieces.length == 0 || !pieces[0].equals(""))
|
||||
if (pieces.length == 0 || !pieces[0].isEmpty())
|
||||
return pieces;
|
||||
return ArrayUtils.copyOfRange(pieces, 1, pieces.length);
|
||||
}
|
||||
|
@ -52,7 +52,6 @@ public class RASPMotorLoader extends AbstractMotorLoader {
|
||||
public List<ThrustCurveMotor.Builder> load(Reader reader, String filename, boolean removeDelayFromDesignation)
|
||||
throws IOException {
|
||||
List<ThrustCurveMotor.Builder> motors = new ArrayList<>();
|
||||
BufferedReader in = new BufferedReader(reader);
|
||||
|
||||
String manufacturer = "";
|
||||
String designation = "";
|
||||
@ -62,13 +61,13 @@ public class RASPMotorLoader extends AbstractMotorLoader {
|
||||
double diameter = 0;
|
||||
ArrayList<Double> delays = null;
|
||||
|
||||
List<Double> time = new ArrayList<Double>();
|
||||
List<Double> thrust = new ArrayList<Double>();
|
||||
List<Double> time = new ArrayList<>();
|
||||
List<Double> thrust = new ArrayList<>();
|
||||
|
||||
double propW = 0;
|
||||
double totalW = 0;
|
||||
|
||||
try {
|
||||
try (BufferedReader in = new BufferedReader(reader)) {
|
||||
String line;
|
||||
String[] pieces, buf;
|
||||
|
||||
@ -80,7 +79,7 @@ public class RASPMotorLoader extends AbstractMotorLoader {
|
||||
comment = "";
|
||||
length = 0;
|
||||
diameter = 0;
|
||||
delays = new ArrayList<Double>();
|
||||
delays = new ArrayList<>();
|
||||
propW = 0;
|
||||
totalW = 0;
|
||||
time.clear();
|
||||
@ -114,13 +113,13 @@ public class RASPMotorLoader extends AbstractMotorLoader {
|
||||
|
||||
} else {
|
||||
buf = split(pieces[3], "[-,]+");
|
||||
for (int i = 0; i < buf.length; i++) {
|
||||
if (buf[i].equalsIgnoreCase("P") ||
|
||||
buf[i].equalsIgnoreCase("plugged")) {
|
||||
for (String s : buf) {
|
||||
if (s.equalsIgnoreCase("P") ||
|
||||
s.equalsIgnoreCase("plugged")) {
|
||||
delays.add(Motor.PLUGGED_DELAY);
|
||||
} else if (buf[i].matches("[0-9]+")) {
|
||||
} else if (s.matches("[0-9]+")) {
|
||||
// Many RASP files have "100" as an only delay
|
||||
double d = Double.parseDouble(buf[i]);
|
||||
double d = Double.parseDouble(s);
|
||||
if (d < 99)
|
||||
delays.add(d);
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ public class RockSimMotorLoader extends AbstractMotorLoader {
|
||||
designation = removeDelay(str);
|
||||
|
||||
// Delays
|
||||
ArrayList<Double> delayList = new ArrayList<Double>();
|
||||
ArrayList<Double> delayList = new ArrayList<>();
|
||||
str = attributes.get("delays");
|
||||
if (str != null) {
|
||||
String[] split = str.split(",");
|
||||
@ -397,10 +397,10 @@ public class RockSimMotorLoader extends AbstractMotorLoader {
|
||||
*/
|
||||
private static class RSEMotorDataHandler extends AbstractElementHandler {
|
||||
|
||||
private final List<Double> time = new ArrayList<Double>();
|
||||
private final List<Double> force = new ArrayList<Double>();
|
||||
private final List<Double> mass = new ArrayList<Double>();
|
||||
private final List<Double> cg = new ArrayList<Double>();
|
||||
private final List<Double> time = new ArrayList<>();
|
||||
private final List<Double> force = new ArrayList<>();
|
||||
private final List<Double> mass = new ArrayList<>();
|
||||
private final List<Double> cg = new ArrayList<>();
|
||||
|
||||
public List<Double> getTime() {
|
||||
return time;
|
||||
|
@ -5,7 +5,11 @@ import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Writer;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import info.openrocket.core.file.openrocket.savers.PhotoStudioSaver;
|
||||
import info.openrocket.core.logging.ErrorSet;
|
||||
@ -529,9 +533,9 @@ public class OpenRocketSaver extends RocketSaver {
|
||||
return;
|
||||
|
||||
// Retrieve the data from the branch
|
||||
List<List<Double>> data = new ArrayList<List<Double>>(types.length);
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
data.add(branch.get(types[i]));
|
||||
List<List<Double>> data = new ArrayList<>(types.length);
|
||||
for (FlightDataType type : types) {
|
||||
data.add(branch.get(type));
|
||||
}
|
||||
|
||||
// Build the <databranch> tag
|
||||
|
@ -47,7 +47,7 @@ class ColorSetter implements Setter {
|
||||
ORColor color = new ORColor(r, g, b);
|
||||
setMethod.invoke(c, color);
|
||||
|
||||
if (!s.trim().equals("")) {
|
||||
if (!s.trim().isEmpty()) {
|
||||
warnings.add(Warning.FILE_INVALID_PARAMETER);
|
||||
}
|
||||
}
|
||||
|
@ -42,9 +42,7 @@ class ComponentHandler extends AbstractElementHandler {
|
||||
RocketComponent c;
|
||||
try {
|
||||
c = constructor.newInstance();
|
||||
} catch (InstantiationException e) {
|
||||
throw new BugException("Error constructing component.", e);
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (InstantiationException | IllegalAccessException e) {
|
||||
throw new BugException("Error constructing component.", e);
|
||||
} catch (InvocationTargetException e) {
|
||||
throw Reflection.handleWrappedException(e);
|
||||
|
@ -15,7 +15,7 @@ public class ConfigHandler extends EntryHandler {
|
||||
|
||||
private ConfigHandler listHandler;
|
||||
private final Config config = new Config();
|
||||
private final List<Object> list = new ArrayList<Object>();
|
||||
private final List<Object> list = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public ElementHandler openElement(String element, HashMap<String, String> attributes, WarningSet warnings)
|
||||
|
@ -63,7 +63,7 @@ class DocumentConfig {
|
||||
|
||||
|
||||
//////// Component constructors
|
||||
static final HashMap<String, Constructor<? extends RocketComponent>> constructors = new HashMap<String, Constructor<? extends RocketComponent>>();
|
||||
static final HashMap<String, Constructor<? extends RocketComponent>> constructors = new HashMap<>();
|
||||
static {
|
||||
try {
|
||||
// External components
|
||||
@ -108,7 +108,7 @@ class DocumentConfig {
|
||||
* the element name. Setters are searched for in descending class order.
|
||||
* A setter of null means setting the parameter is not allowed.
|
||||
*/
|
||||
static final HashMap<String, Setter> setters = new HashMap<String, Setter>();
|
||||
static final HashMap<String, Setter> setters = new HashMap<>();
|
||||
static {
|
||||
// RocketComponent
|
||||
setters.put("RocketComponent:name", new StringSetter(
|
||||
@ -117,7 +117,7 @@ class DocumentConfig {
|
||||
Reflection.findMethod(RocketComponent.class, "setID", String.class)));
|
||||
setters.put("RocketComponent:color", new ColorSetter(
|
||||
Reflection.findMethod(RocketComponent.class, "setColor", ORColor.class)));
|
||||
setters.put("RocketComponent:linestyle", new EnumSetter<LineStyle>(
|
||||
setters.put("RocketComponent:linestyle", new EnumSetter<>(
|
||||
Reflection.findMethod(RocketComponent.class, "setLineStyle", LineStyle.class),
|
||||
LineStyle.class));
|
||||
setters.put("RocketComponent:position", new AxialPositionSetter());
|
||||
@ -149,7 +149,7 @@ class DocumentConfig {
|
||||
|
||||
|
||||
// ExternalComponent
|
||||
setters.put("ExternalComponent:finish", new EnumSetter<Finish>(
|
||||
setters.put("ExternalComponent:finish", new EnumSetter<>(
|
||||
Reflection.findMethod(ExternalComponent.class, "setFinish", Finish.class),
|
||||
Finish.class));
|
||||
setters.put("ExternalComponent:material", new MaterialSetter(
|
||||
@ -215,7 +215,7 @@ class DocumentConfig {
|
||||
|
||||
|
||||
// Transition
|
||||
setters.put("Transition:shape", new EnumSetter<Transition.Shape>(
|
||||
setters.put("Transition:shape", new EnumSetter<>(
|
||||
Reflection.findMethod(Transition.class, "setShapeType", Transition.Shape.class),
|
||||
Transition.Shape.class));
|
||||
setters.put("Transition:shapeclipped", new BooleanSetter(
|
||||
@ -274,7 +274,7 @@ class DocumentConfig {
|
||||
setters.put("FinSet:radiusoffset", new RadiusPositionSetter());
|
||||
setters.put("FinSet:thickness", new DoubleSetter(
|
||||
Reflection.findMethod(FinSet.class, "setThickness", double.class)));
|
||||
setters.put("FinSet:crosssection", new EnumSetter<FinSet.CrossSection>(
|
||||
setters.put("FinSet:crosssection", new EnumSetter<>(
|
||||
Reflection.findMethod(FinSet.class, "setCrossSection", FinSet.CrossSection.class),
|
||||
FinSet.CrossSection.class));
|
||||
setters.put("FinSet:cant", new DoubleSetter(
|
||||
@ -414,7 +414,7 @@ class DocumentConfig {
|
||||
* Reflection.findMethod(MassComponent.class, "setMassComponentType",
|
||||
* double.class)));
|
||||
*/
|
||||
setters.put("MassComponent:masscomponenttype", new EnumSetter<MassComponent.MassComponentType>(
|
||||
setters.put("MassComponent:masscomponenttype", new EnumSetter<>(
|
||||
Reflection.findMethod(MassComponent.class, "setMassComponentType",
|
||||
MassComponent.MassComponentType.class),
|
||||
MassComponent.MassComponentType.class));
|
||||
@ -437,7 +437,7 @@ class DocumentConfig {
|
||||
Reflection.findMethod(RecoveryDevice.class, "setCD", double.class),
|
||||
"auto",
|
||||
Reflection.findMethod(RecoveryDevice.class, "setCDAutomatic", boolean.class)));
|
||||
setters.put("RecoveryDevice:deployevent", new EnumSetter<DeployEvent>(
|
||||
setters.put("RecoveryDevice:deployevent", new EnumSetter<>(
|
||||
Reflection.findMethod(RecoveryDevice.class, "getDeploymentConfigurations"),
|
||||
Reflection.findMethod(DeploymentConfiguration.class, "setDeployEvent", DeployEvent.class),
|
||||
DeployEvent.class));
|
||||
@ -479,7 +479,7 @@ class DocumentConfig {
|
||||
|
||||
// Rocket
|
||||
// <motorconfiguration> handled by separate handler
|
||||
setters.put("Rocket:referencetype", new EnumSetter<ReferenceType>(
|
||||
setters.put("Rocket:referencetype", new EnumSetter<>(
|
||||
Reflection.findMethod(Rocket.class, "setReferenceType", ReferenceType.class),
|
||||
ReferenceType.class));
|
||||
setters.put("Rocket:customreference", new DoubleSetter(
|
||||
@ -490,7 +490,7 @@ class DocumentConfig {
|
||||
Reflection.findMethod(Rocket.class, "setRevision", String.class)));
|
||||
|
||||
// Axial Stage
|
||||
setters.put("AxialStage:separationevent", new EnumSetter<StageSeparationConfiguration.SeparationEvent>(
|
||||
setters.put("AxialStage:separationevent", new EnumSetter<>(
|
||||
Reflection.findMethod(AxialStage.class, "getSeparationConfigurations"),
|
||||
Reflection.findMethod(StageSeparationConfiguration.class, "setSeparationEvent",
|
||||
StageSeparationConfiguration.SeparationEvent.class),
|
||||
|
@ -22,7 +22,7 @@ class FinSetPointHandler extends AbstractElementHandler {
|
||||
@SuppressWarnings("unused")
|
||||
private final DocumentLoadingContext context;
|
||||
private final FreeformFinSet finset;
|
||||
private final ArrayList<Coordinate> coordinates = new ArrayList<Coordinate>();
|
||||
private final ArrayList<Coordinate> coordinates = new ArrayList<>();
|
||||
|
||||
public FinSetPointHandler(FreeformFinSet finset, DocumentLoadingContext context) {
|
||||
this.finset = finset;
|
||||
|
@ -2,13 +2,13 @@ package info.openrocket.core.file.openrocket.importt;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import info.openrocket.core.rocketcomponent.position.AxialMethod;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.openrocket.core.logging.WarningSet;
|
||||
import info.openrocket.core.rocketcomponent.FinSet;
|
||||
import info.openrocket.core.rocketcomponent.RocketComponent;
|
||||
import info.openrocket.core.rocketcomponent.position.*;
|
||||
import info.openrocket.core.util.Reflection;
|
||||
|
||||
class FinTabPositionSetter extends DoubleSetter {
|
||||
|
@ -19,7 +19,7 @@ class FlightDataHandler extends AbstractElementHandler {
|
||||
|
||||
private FlightDataBranchHandler dataHandler;
|
||||
private final WarningSet warningSet = new WarningSet();
|
||||
private final List<FlightDataBranch> branches = new ArrayList<FlightDataBranch>();
|
||||
private final List<FlightDataBranch> branches = new ArrayList<>();
|
||||
|
||||
private final SingleSimulationHandler simHandler;
|
||||
private FlightData data;
|
||||
|
@ -30,7 +30,7 @@ class MaterialSetter implements Setter {
|
||||
|
||||
// Check name != ""
|
||||
name = name.trim();
|
||||
if (name.equals("")) {
|
||||
if (name.isEmpty()) {
|
||||
warnings.add(Warning.fromString("Illegal material specification, ignoring."));
|
||||
return;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package info.openrocket.core.file.openrocket.importt;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
@ -69,8 +70,8 @@ class MotorConfigurationHandler extends AbstractElementHandler {
|
||||
rocket.getFlightConfiguration(fcid).setName(name);
|
||||
}
|
||||
|
||||
for (int stageNr : stageActiveness.keySet()) {
|
||||
rocket.getFlightConfiguration(fcid).preloadStageActiveness(stageNr, stageActiveness.get(stageNr));
|
||||
for (Map.Entry<Integer, Boolean> entry : stageActiveness.entrySet()) {
|
||||
rocket.getFlightConfiguration(fcid).preloadStageActiveness(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
if ("true".equals(attributes.remove("default"))) {
|
||||
|
@ -1,7 +1,5 @@
|
||||
package info.openrocket.core.file.openrocket.importt;
|
||||
|
||||
import java.lang.Double;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
|
||||
|
@ -72,7 +72,7 @@ public class OpenRocketHandler extends AbstractElementHandler {
|
||||
String str = "Unsupported document version";
|
||||
if (docVersion != null)
|
||||
str += " " + docVersion;
|
||||
if (creator != null && !creator.trim().equals(""))
|
||||
if (creator != null && !creator.trim().isEmpty())
|
||||
str += " (written using '" + creator.trim() + "')";
|
||||
str += ", attempting to read file anyway.";
|
||||
warnings.add(str);
|
||||
|
@ -4,7 +4,6 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
import info.openrocket.core.rocketcomponent.ComponentChangeEvent;
|
||||
import info.openrocket.core.rocketcomponent.FlightConfiguration;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -13,7 +12,6 @@ import org.xml.sax.SAXException;
|
||||
|
||||
import info.openrocket.core.document.OpenRocketDocument;
|
||||
import info.openrocket.core.document.Simulation;
|
||||
import info.openrocket.core.document.StorageOptions;
|
||||
import info.openrocket.core.document.StorageOptions.FileType;
|
||||
import info.openrocket.core.file.AbstractRocketLoader;
|
||||
import info.openrocket.core.file.DocumentLoadingContext;
|
||||
|
@ -8,7 +8,10 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* This class will parse the photostudio xml parameters from the
|
||||
|
@ -36,7 +36,7 @@ class SingleSimulationHandler extends AbstractElementHandler {
|
||||
private ConfigHandler configHandler;
|
||||
private FlightDataHandler dataHandler;
|
||||
|
||||
private final List<SimulationExtension> extensions = new ArrayList<SimulationExtension>();
|
||||
private final List<SimulationExtension> extensions = new ArrayList<>();
|
||||
|
||||
public SingleSimulationHandler(OpenRocketDocument doc, DocumentLoadingContext context) {
|
||||
this.doc = doc;
|
||||
@ -90,7 +90,7 @@ class SingleSimulationHandler extends AbstractElementHandler {
|
||||
id = id.replace("net.sf.openrocket", "info.openrocket.core");
|
||||
SimulationExtension extension = null;
|
||||
Set<SimulationExtensionProvider> extensionProviders = Application.getInjector()
|
||||
.getInstance(new Key<Set<SimulationExtensionProvider>>() {
|
||||
.getInstance(new Key<>() {
|
||||
});
|
||||
for (SimulationExtensionProvider p : extensionProviders) {
|
||||
if (p.getIds().contains(id)) {
|
||||
|
@ -15,7 +15,7 @@ public class AxialStageSaver extends ComponentAssemblySaver {
|
||||
private static final AxialStageSaver instance = new AxialStageSaver();
|
||||
|
||||
public static ArrayList<String> getElements(info.openrocket.core.rocketcomponent.RocketComponent c) {
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
|
||||
if (c.isAfter()) {
|
||||
// yes, this test is redundant. I'm merely paranoid, and attempting to
|
||||
@ -67,7 +67,7 @@ public class AxialStageSaver extends ComponentAssemblySaver {
|
||||
}
|
||||
|
||||
private List<String> addSeparationConfigParams(StageSeparationConfiguration config, boolean indent) {
|
||||
List<String> elements = new ArrayList<String>(2);
|
||||
List<String> elements = new ArrayList<>(2);
|
||||
elements.add((indent ? " " : "") + "<separationevent>"
|
||||
+ config.getSeparationEvent().name().toLowerCase(Locale.ENGLISH).replace("_", "")
|
||||
+ "</separationevent>");
|
||||
|
@ -8,7 +8,7 @@ public class BodyTubeSaver extends SymmetricComponentSaver {
|
||||
private static final BodyTubeSaver instance = new BodyTubeSaver();
|
||||
|
||||
public static List<String> getElements(info.openrocket.core.rocketcomponent.RocketComponent c) {
|
||||
List<String> list = new ArrayList<String>();
|
||||
List<String> list = new ArrayList<>();
|
||||
|
||||
list.add("<bodytube>");
|
||||
instance.addParams(c, list);
|
||||
|
@ -8,7 +8,7 @@ public class BulkheadSaver extends RadiusRingComponentSaver {
|
||||
private static final BulkheadSaver instance = new BulkheadSaver();
|
||||
|
||||
public static List<String> getElements(info.openrocket.core.rocketcomponent.RocketComponent c) {
|
||||
List<String> list = new ArrayList<String>();
|
||||
List<String> list = new ArrayList<>();
|
||||
|
||||
list.add("<bulkhead>");
|
||||
instance.addParams(c, list);
|
||||
|
@ -8,7 +8,7 @@ public class CenteringRingSaver extends RadiusRingComponentSaver {
|
||||
private static final CenteringRingSaver instance = new CenteringRingSaver();
|
||||
|
||||
public static List<String> getElements(info.openrocket.core.rocketcomponent.RocketComponent c) {
|
||||
List<String> list = new ArrayList<String>();
|
||||
List<String> list = new ArrayList<>();
|
||||
|
||||
list.add("<centeringring>");
|
||||
instance.addParams(c, list);
|
||||
|
@ -9,7 +9,7 @@ public class ComponentAssemblySaver extends RocketComponentSaver {
|
||||
private static final ComponentAssemblySaver instance = new ComponentAssemblySaver();
|
||||
|
||||
public static ArrayList<String> getElements(info.openrocket.core.rocketcomponent.RocketComponent c) {
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
|
||||
if (!c.isAfter()) {
|
||||
if (c instanceof PodSet) {
|
||||
|
@ -8,7 +8,7 @@ public class EllipticalFinSetSaver extends FinSetSaver {
|
||||
private static final EllipticalFinSetSaver instance = new EllipticalFinSetSaver();
|
||||
|
||||
public static ArrayList<String> getElements(info.openrocket.core.rocketcomponent.RocketComponent c) {
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
|
||||
list.add("<ellipticalfinset>");
|
||||
instance.addParams(c, list);
|
||||
|
@ -8,7 +8,7 @@ public class EngineBlockSaver extends ThicknessRingComponentSaver {
|
||||
private static final EngineBlockSaver instance = new EngineBlockSaver();
|
||||
|
||||
public static List<String> getElements(info.openrocket.core.rocketcomponent.RocketComponent c) {
|
||||
List<String> list = new ArrayList<String>();
|
||||
List<String> list = new ArrayList<>();
|
||||
|
||||
list.add("<engineblock>");
|
||||
instance.addParams(c, list);
|
||||
|
@ -3,8 +3,6 @@ package info.openrocket.core.file.openrocket.savers;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import info.openrocket.core.rocketcomponent.FinSet;
|
||||
import info.openrocket.core.rocketcomponent.position.AxialMethod;
|
||||
import info.openrocket.core.util.MathUtil;
|
||||
|
||||
public class FinSetSaver extends ExternalComponentSaver {
|
||||
@ -35,17 +33,12 @@ public class FinSetSaver extends ExternalComponentSaver {
|
||||
// anymore
|
||||
String offset = "center";
|
||||
double offsetVal = fins.getTabOffset();
|
||||
switch (fins.getTabOffsetMethod()) {
|
||||
case TOP:
|
||||
offset = "front";
|
||||
break;
|
||||
case BOTTOM:
|
||||
offset = "end";
|
||||
break;
|
||||
case MIDDLE:
|
||||
offset = "center";
|
||||
break;
|
||||
}
|
||||
offset = switch (fins.getTabOffsetMethod()) {
|
||||
case TOP -> "front";
|
||||
case BOTTOM -> "end";
|
||||
case MIDDLE -> "center";
|
||||
default -> offset;
|
||||
};
|
||||
elements.add("<tabposition relativeto=\"" + offset + "\">" +
|
||||
offsetVal + "</tabposition>");
|
||||
elements.add("<tabposition relativeto=\"" +
|
||||
|
@ -11,7 +11,7 @@ public class FreeformFinSetSaver extends FinSetSaver {
|
||||
private static final FreeformFinSetSaver instance = new FreeformFinSetSaver();
|
||||
|
||||
public static ArrayList<String> getElements(info.openrocket.core.rocketcomponent.RocketComponent c) {
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
|
||||
list.add("<freeformfinset>");
|
||||
instance.addParams(c, list);
|
||||
|
@ -10,7 +10,7 @@ public class InnerTubeSaver extends ThicknessRingComponentSaver {
|
||||
private static final InnerTubeSaver instance = new InnerTubeSaver();
|
||||
|
||||
public static List<String> getElements(info.openrocket.core.rocketcomponent.RocketComponent c) {
|
||||
List<String> list = new ArrayList<String>();
|
||||
List<String> list = new ArrayList<>();
|
||||
|
||||
list.add("<innertube>");
|
||||
instance.addParams(c, list);
|
||||
|
@ -10,7 +10,7 @@ public class LaunchLugSaver extends ExternalComponentSaver {
|
||||
private static final LaunchLugSaver instance = new LaunchLugSaver();
|
||||
|
||||
public static List<String> getElements(info.openrocket.core.rocketcomponent.RocketComponent c) {
|
||||
List<String> list = new ArrayList<String>();
|
||||
List<String> list = new ArrayList<>();
|
||||
|
||||
list.add("<launchlug>");
|
||||
instance.addParams(c, list);
|
||||
|
@ -12,7 +12,7 @@ public class MassComponentSaver extends MassObjectSaver {
|
||||
private static final MassComponentSaver instance = new MassComponentSaver();
|
||||
|
||||
public static List<String> getElements(info.openrocket.core.rocketcomponent.RocketComponent c) {
|
||||
List<String> list = new ArrayList<String>();
|
||||
List<String> list = new ArrayList<>();
|
||||
|
||||
list.add("<masscomponent>");
|
||||
instance.addParams(c, list);
|
||||
|
@ -4,14 +4,13 @@ import info.openrocket.core.rocketcomponent.NoseCone;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class NoseConeSaver extends TransitionSaver {
|
||||
|
||||
private static final NoseConeSaver instance = new NoseConeSaver();
|
||||
|
||||
public static ArrayList<String> getElements(info.openrocket.core.rocketcomponent.RocketComponent c) {
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
|
||||
list.add("<nosecone>");
|
||||
instance.addParams(c, list);
|
||||
|
@ -10,7 +10,7 @@ public class ParachuteSaver extends RecoveryDeviceSaver {
|
||||
private static final ParachuteSaver instance = new ParachuteSaver();
|
||||
|
||||
public static List<String> getElements(info.openrocket.core.rocketcomponent.RocketComponent c) {
|
||||
List<String> list = new ArrayList<String>();
|
||||
List<String> list = new ArrayList<>();
|
||||
|
||||
list.add("<parachute>");
|
||||
instance.addParams(c, list);
|
||||
|
@ -17,7 +17,7 @@ import java.util.Map;
|
||||
*/
|
||||
public class PhotoStudioSaver {
|
||||
public static List<String> getElements(Map<String, String> photoSettings) {
|
||||
List<String> elements = new ArrayList<String>();
|
||||
List<String> elements = new ArrayList<>();
|
||||
|
||||
if (photoSettings == null || photoSettings.size() == 0)
|
||||
return elements;
|
||||
|
@ -10,7 +10,7 @@ public class RailButtonSaver extends ExternalComponentSaver {
|
||||
private static final RailButtonSaver instance = new RailButtonSaver();
|
||||
|
||||
public static List<String> getElements(info.openrocket.core.rocketcomponent.RocketComponent c) {
|
||||
List<String> list = new ArrayList<String>();
|
||||
List<String> list = new ArrayList<>();
|
||||
|
||||
list.add("<railbutton>");
|
||||
instance.addParams(c, list);
|
||||
|
@ -43,7 +43,7 @@ public class RecoveryDeviceSaver extends MassObjectSaver {
|
||||
}
|
||||
|
||||
private List<String> addDeploymentConfigurationParams(DeploymentConfiguration config, boolean indent) {
|
||||
List<String> elements = new ArrayList<String>(3);
|
||||
List<String> elements = new ArrayList<>(3);
|
||||
elements.add((indent ? " " : "") + "<deployevent>"
|
||||
+ config.getDeployEvent().name().toLowerCase(Locale.ENGLISH).replace("_", "") + "</deployevent>");
|
||||
elements.add((indent ? " " : "") + "<deployaltitude>" + config.getDeployAltitude() + "</deployaltitude>");
|
||||
|
@ -16,7 +16,21 @@ import info.openrocket.core.motor.Motor;
|
||||
import info.openrocket.core.motor.MotorConfiguration;
|
||||
import info.openrocket.core.motor.ThrustCurveMotor;
|
||||
import info.openrocket.core.preset.ComponentPreset;
|
||||
import info.openrocket.core.rocketcomponent.*;
|
||||
import info.openrocket.core.rocketcomponent.Clusterable;
|
||||
import info.openrocket.core.rocketcomponent.ComponentAssembly;
|
||||
import info.openrocket.core.rocketcomponent.FinSet;
|
||||
import info.openrocket.core.rocketcomponent.FlightConfigurationId;
|
||||
import info.openrocket.core.rocketcomponent.InsideColorComponent;
|
||||
import info.openrocket.core.rocketcomponent.InsideColorComponentHandler;
|
||||
import info.openrocket.core.rocketcomponent.Instanceable;
|
||||
import info.openrocket.core.rocketcomponent.LineInstanceable;
|
||||
import info.openrocket.core.rocketcomponent.MotorMount;
|
||||
import info.openrocket.core.rocketcomponent.ParallelStage;
|
||||
import info.openrocket.core.rocketcomponent.PodSet;
|
||||
import info.openrocket.core.rocketcomponent.RailButton;
|
||||
import info.openrocket.core.rocketcomponent.Rocket;
|
||||
import info.openrocket.core.rocketcomponent.RocketComponent;
|
||||
import info.openrocket.core.rocketcomponent.TubeFinSet;
|
||||
import info.openrocket.core.rocketcomponent.position.AnglePositionable;
|
||||
import info.openrocket.core.rocketcomponent.position.AxialMethod;
|
||||
import info.openrocket.core.rocketcomponent.position.RadiusPositionable;
|
||||
@ -213,7 +227,7 @@ public class RocketComponentSaver {
|
||||
//FlightConfigurationID[] motorConfigIDs = ((RocketComponent) mount).getRocket().getFlightConfigurationIDs();
|
||||
//ParameterSet<FlightConfiguration> configs = ((RocketComponent) mount).getRocket().getConfigurationSet();
|
||||
|
||||
List<String> elements = new ArrayList<String>();
|
||||
List<String> elements = new ArrayList<>();
|
||||
|
||||
MotorConfiguration defaultInstance = mount.getDefaultMotorConfig();
|
||||
|
||||
@ -226,7 +240,7 @@ public class RocketComponentSaver {
|
||||
elements.add(" <ignitiondelay>" + defaultInstance.getIgnitionDelay() + "</ignitiondelay>");
|
||||
elements.add(" <overhang>" + mount.getMotorOverhang() + "</overhang>");
|
||||
|
||||
for( FlightConfigurationId fcid : rkt.getIds()){
|
||||
for (FlightConfigurationId fcid : rkt.getIds()){
|
||||
|
||||
MotorConfiguration motorInstance = mount.getMotorConfig(fcid);
|
||||
// Nothing is stored if no motor loaded
|
||||
|
@ -16,7 +16,7 @@ public class RocketSaver extends RocketComponentSaver {
|
||||
private static final RocketSaver instance = new RocketSaver();
|
||||
|
||||
public static ArrayList<String> getElements(info.openrocket.core.rocketcomponent.RocketComponent c) {
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
|
||||
list.add("<rocket>");
|
||||
instance.addParams(c, list);
|
||||
|
@ -10,7 +10,7 @@ public class ShockCordSaver extends MassObjectSaver {
|
||||
private static final ShockCordSaver instance = new ShockCordSaver();
|
||||
|
||||
public static List<String> getElements(info.openrocket.core.rocketcomponent.RocketComponent c) {
|
||||
List<String> list = new ArrayList<String>();
|
||||
List<String> list = new ArrayList<>();
|
||||
|
||||
list.add("<shockcord>");
|
||||
instance.addParams(c, list);
|
||||
|
@ -10,7 +10,7 @@ public class StreamerSaver extends RecoveryDeviceSaver {
|
||||
private static final StreamerSaver instance = new StreamerSaver();
|
||||
|
||||
public static List<String> getElements(info.openrocket.core.rocketcomponent.RocketComponent c) {
|
||||
List<String> list = new ArrayList<String>();
|
||||
List<String> list = new ArrayList<>();
|
||||
|
||||
list.add("<streamer>");
|
||||
instance.addParams(c, list);
|
||||
|
@ -12,7 +12,7 @@ public class TransitionSaver extends SymmetricComponentSaver {
|
||||
private static final TransitionSaver instance = new TransitionSaver();
|
||||
|
||||
public static ArrayList<String> getElements(info.openrocket.core.rocketcomponent.RocketComponent c) {
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
|
||||
list.add("<transition>");
|
||||
instance.addParams(c, list);
|
||||
|
@ -8,7 +8,7 @@ public class TrapezoidFinSetSaver extends FinSetSaver {
|
||||
private static final TrapezoidFinSetSaver instance = new TrapezoidFinSetSaver();
|
||||
|
||||
public static ArrayList<String> getElements(info.openrocket.core.rocketcomponent.RocketComponent c) {
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
|
||||
list.add("<trapezoidfinset>");
|
||||
instance.addParams(c, list);
|
||||
|
@ -8,7 +8,7 @@ public class TubeCouplerSaver extends ThicknessRingComponentSaver {
|
||||
private static final TubeCouplerSaver instance = new TubeCouplerSaver();
|
||||
|
||||
public static List<String> getElements(info.openrocket.core.rocketcomponent.RocketComponent c) {
|
||||
List<String> list = new ArrayList<String>();
|
||||
List<String> list = new ArrayList<>();
|
||||
|
||||
list.add("<tubecoupler>");
|
||||
instance.addParams(c, list);
|
||||
|
@ -10,7 +10,7 @@ public class TubeFinSetSaver extends ExternalComponentSaver {
|
||||
private static final TubeFinSetSaver instance = new TubeFinSetSaver();
|
||||
|
||||
public static List<String> getElements(info.openrocket.core.rocketcomponent.RocketComponent c) {
|
||||
List<String> list = new ArrayList<String>();
|
||||
List<String> list = new ArrayList<>();
|
||||
|
||||
list.add("<tubefinset>");
|
||||
instance.addParams(c, list);
|
||||
|
@ -1,6 +1,5 @@
|
||||
package info.openrocket.core.file.rasaero;
|
||||
|
||||
import info.openrocket.core.file.motor.GeneralMotorLoader;
|
||||
import info.openrocket.core.file.motor.RASPMotorLoader;
|
||||
import info.openrocket.core.logging.WarningSet;
|
||||
import info.openrocket.core.database.motor.ThrustCurveMotorSet;
|
||||
|
@ -42,32 +42,32 @@ import info.openrocket.core.util.MathUtil;
|
||||
public class BodyTubeDTO extends BasePartDTO implements BodyTubeDTOAdapter {
|
||||
@XmlElement(name = RASAeroCommonConstants.LAUNCH_LUG_DIAMETER)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double launchLugDiameter = 0d;
|
||||
private Double launchLugDiameter = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.LAUNCH_LUG_LENGTH)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double launchLugLength = 0d;
|
||||
private Double launchLugLength = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.RAIL_GUIDE_DIAMETER)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double railGuideDiameter = 0d;
|
||||
private Double railGuideDiameter = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.RAIL_GUIDE_HEIGHT)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double railGuideHeight = 0d;
|
||||
private Double railGuideHeight = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.LAUNCH_SHOE_AREA)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double launchShoeArea = 0d; // Currently not available in OR
|
||||
private Double launchShoeArea = 0.0d; // Currently not available in OR
|
||||
|
||||
@XmlElement(name = RASAeroCommonConstants.BOATTAIL_LENGTH)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double boattailLength = 0d;
|
||||
private Double boattailLength = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.BOATTAIL_REAR_DIAMETER)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double boattailRearDiameter = 0d;
|
||||
private Double boattailRearDiameter = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.BOATTAIL_OFFSET)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double boattailOffset = 0d;
|
||||
private Double boattailOffset = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.OVERHANG)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double overhang = 0d;
|
||||
private Double overhang = 0.0d;
|
||||
|
||||
@XmlElementRef(name = RASAeroCommonConstants.FIN, type = FinDTO.class)
|
||||
private FinDTO fin;
|
||||
|
@ -44,19 +44,19 @@ public class BoosterDTO implements BodyTubeDTOAdapter {
|
||||
private Double insideDiameter;
|
||||
@XmlElement(name = RASAeroCommonConstants.LAUNCH_LUG_DIAMETER)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double launchLugDiameter = 0d;
|
||||
private Double launchLugDiameter = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.LAUNCH_LUG_LENGTH)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double launchLugLength = 0d;
|
||||
private Double launchLugLength = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.RAIL_GUIDE_DIAMETER)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double railGuideDiameter = 0d;
|
||||
private Double railGuideDiameter = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.RAIL_GUIDE_HEIGHT)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double railGuideHeight = 0d;
|
||||
private Double railGuideHeight = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.LAUNCH_SHOE_AREA)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double launchShoeArea = 0d; // Currently not available in OR
|
||||
private Double launchShoeArea = 0.0d; // Currently not available in OR
|
||||
@XmlElement(name = RASAeroCommonConstants.LOCATION)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double location;
|
||||
@ -67,7 +67,7 @@ public class BoosterDTO implements BodyTubeDTOAdapter {
|
||||
private Double shoulderLength;
|
||||
@XmlElement(name = RASAeroCommonConstants.NOZZLE_EXIT_DIAMETER)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double nozzleExitDiameter = 0d;
|
||||
private Double nozzleExitDiameter = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.BOATTAIL_LENGTH)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double boattailLength;
|
||||
|
@ -39,7 +39,7 @@ public class FinDTO {
|
||||
private Double thickness;
|
||||
@XmlElement(name = RASAeroCommonConstants.FIN_LE_RADIUS)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double LERadius = 0d; // Leading edge radius
|
||||
private Double LERadius = 0.0d; // Leading edge radius
|
||||
@XmlElement(name = RASAeroCommonConstants.LOCATION)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double location;
|
||||
@ -47,10 +47,10 @@ public class FinDTO {
|
||||
private String airfoilSection;
|
||||
@XmlElement(name = RASAeroCommonConstants.FIN_FX1)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double FX1 = 0d;
|
||||
private Double FX1 = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.FIN_FX3)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double FX3 = 0d;
|
||||
private Double FX3 = 0.0d;
|
||||
|
||||
@XmlTransient
|
||||
private static final Translator trans = Application.getTranslator();
|
||||
|
@ -22,22 +22,22 @@ public class LaunchSiteDTO {
|
||||
|
||||
@XmlElement(name = RASAeroCommonConstants.LAUNCH_ALTITUDE)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double altitude = 0d;
|
||||
private Double altitude = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.LAUNCH_PRESSURE)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double pressure = 0d;
|
||||
private Double pressure = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.LAUNCH_ROD_ANGLE)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double rodAngle = 0d;
|
||||
private Double rodAngle = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.LAUNCH_ROD_LENGTH)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double rodLength = 0d;
|
||||
private Double rodLength = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.LAUNCH_TEMPERATURE)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double temperature = 0d;
|
||||
private Double temperature = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.LAUNCH_WIND_SPEED)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double windSpeed = 0d;
|
||||
private Double windSpeed = 0.0d;
|
||||
|
||||
/**
|
||||
* We need a default, no-args constructor.
|
||||
|
@ -34,7 +34,7 @@ public class NoseConeDTO extends BasePartDTO {
|
||||
private String shape;
|
||||
@XmlElement(name = RASAeroCommonConstants.BLUNT_RADIUS)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double bluntRadius = 0d;
|
||||
private Double bluntRadius = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.POWER_LAW)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double powerLaw;
|
||||
|
@ -30,10 +30,10 @@ import java.util.List;
|
||||
public class RecoveryDTO {
|
||||
@XmlElement(name = RASAeroCommonConstants.RECOVERY_ALTITUDE + 1)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double altitude1 = 0d;
|
||||
private Double altitude1 = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.RECOVERY_ALTITUDE + 2)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double altitude2 = 0d;
|
||||
private Double altitude2 = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.RECOVERY_DEVICE_TYPE + 1)
|
||||
private String deviceType1 = "None";
|
||||
@XmlElement(name = RASAeroCommonConstants.RECOVERY_DEVICE_TYPE + 2)
|
||||
@ -46,20 +46,20 @@ public class RecoveryDTO {
|
||||
private Boolean event2 = false;
|
||||
@XmlElement(name = RASAeroCommonConstants.RECOVERY_SIZE + 1)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double size1 = 0d;
|
||||
private Double size1 = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.RECOVERY_SIZE + 2)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double size2 = 0d;
|
||||
private Double size2 = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.RECOVERY_EVENT_TYPE + 1)
|
||||
private String eventType1 = "None";
|
||||
@XmlElement(name = RASAeroCommonConstants.RECOVERY_EVENT_TYPE + 2)
|
||||
private String eventType2 = "None";
|
||||
@XmlElement(name = RASAeroCommonConstants.RECOVERY_CD + 1)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double CD1 = 0d;
|
||||
private Double CD1 = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.RECOVERY_CD + 2)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double CD2 = 0d;
|
||||
private Double CD2 = 0.0d;
|
||||
|
||||
@XmlTransient
|
||||
private static final Logger log = LoggerFactory.getLogger(RecoveryDTO.class);
|
||||
|
@ -45,7 +45,7 @@ public class RocketDesignDTO {
|
||||
private String surface = RASAeroCommonConstants.FINISH_SMOOTH;
|
||||
@XmlElement(name = RASAeroCommonConstants.CD)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double CD = 0d;
|
||||
private Double CD = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.MODIFIED_BARROWMAN)
|
||||
@XmlJavaTypeAdapter(CustomBooleanAdapter.class)
|
||||
private Boolean modifiedBarrowman = false;
|
||||
@ -54,13 +54,13 @@ public class RocketDesignDTO {
|
||||
private Boolean turbulence = false;
|
||||
@XmlElement(name = RASAeroCommonConstants.SUSTAINER_NOZZLE)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double sustainerNozzle = 0d;
|
||||
private Double sustainerNozzle = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.BOOSTER1_NOZZLE)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double booster1Nozzle = 0d;
|
||||
private Double booster1Nozzle = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.BOOSTER2_NOZZLE)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double booster2Nozzle = 0d;
|
||||
private Double booster2Nozzle = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.USE_BOOSTER1)
|
||||
@XmlJavaTypeAdapter(CustomBooleanAdapter.class)
|
||||
private Boolean useBooster1 = false;
|
||||
|
@ -36,34 +36,34 @@ public class SimulationDTO {
|
||||
private String sustainerEngine;
|
||||
@XmlElement(name = RASAeroCommonConstants.SUSTAINER_LAUNCH_WT)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double sustainerLaunchWt = 0d;
|
||||
private Double sustainerLaunchWt = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.SUSTAINER_NOZZLE_DIAMETER)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double sustainerNozzleDiameter = 0d;
|
||||
private Double sustainerNozzleDiameter = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.SUSTAINER_CG)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double sustainerCG = 0d;
|
||||
private Double sustainerCG = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.SUSTAINER_IGNITION_DELAY)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double sustainerIgnitionDelay = 0d;
|
||||
private Double sustainerIgnitionDelay = 0.0d;
|
||||
|
||||
@XmlElement(name = RASAeroCommonConstants.BOOSTER1_ENGINE)
|
||||
private String booster1Engine;
|
||||
@XmlElement(name = RASAeroCommonConstants.BOOSTER1_LAUNCH_WT)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double booster1LaunchWt = 0d;
|
||||
private Double booster1LaunchWt = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.BOOSTER1_SEPARATION_DELAY)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double booster1SeparationDelay = 0d;
|
||||
private Double booster1SeparationDelay = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.BOOSTER1_IGNITION_DELAY)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double booster1IgnitionDelay = 0d;
|
||||
private Double booster1IgnitionDelay = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.BOOSTER1_CG)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double booster1CG = 0d;
|
||||
private Double booster1CG = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.BOOSTER1_NOZZLE_DIAMETER)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double booster1NozzleDiameter = 0d;
|
||||
private Double booster1NozzleDiameter = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.INCLUDE_BOOSTER1)
|
||||
@XmlJavaTypeAdapter(CustomBooleanAdapter.class)
|
||||
private Boolean includeBooster1 = false;
|
||||
@ -72,38 +72,38 @@ public class SimulationDTO {
|
||||
private String booster2Engine;
|
||||
@XmlElement(name = RASAeroCommonConstants.BOOSTER2_LAUNCH_WT)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double booster2LaunchWt = 0d;
|
||||
private Double booster2LaunchWt = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.BOOSTER2_SEPARATION_DELAY)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double booster2Delay = 0d;
|
||||
private Double booster2Delay = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.BOOSTER2_CG)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double booster2CG = 0d;
|
||||
private Double booster2CG = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.BOOSTER2_NOZZLE_DIAMETER)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double booster2NozzleDiameter = 0d;
|
||||
private Double booster2NozzleDiameter = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.INCLUDE_BOOSTER2)
|
||||
@XmlJavaTypeAdapter(CustomBooleanAdapter.class)
|
||||
private Boolean includeBooster2 = false;
|
||||
|
||||
@XmlElement(name = RASAeroCommonConstants.FLIGHT_TIME)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double flightTime = 0d;
|
||||
private Double flightTime = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.TIME_TO_APOGEE)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double timetoApogee = 0d;
|
||||
private Double timetoApogee = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.MAX_ALTITUDE)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double maxAltitude = 0d;
|
||||
private Double maxAltitude = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.MAX_VELOCITY)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double maxVelocity = 0d;
|
||||
private Double maxVelocity = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.OPTIMUM_WT)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double optimumWt = 0d;
|
||||
private Double optimumWt = 0.0d;
|
||||
@XmlElement(name = RASAeroCommonConstants.OPTIMUM_MAX_ALT)
|
||||
@XmlJavaTypeAdapter(CustomDoubleAdapter.class)
|
||||
private Double optimumMaxAlt = 0d;
|
||||
private Double optimumMaxAlt = 0.0d;
|
||||
|
||||
@XmlTransient
|
||||
private static final Translator trans = Application.getTranslator();
|
||||
|
@ -75,10 +75,10 @@ public class RecoveryHandler extends AbstractElementHandler {
|
||||
|
||||
// Set the values of the recovery parameters
|
||||
for (int i = 1; i <= NR_OF_RECOVERY_DEVICES; i++) {
|
||||
for (String e : mapParametersToVars.keySet()) {
|
||||
String key = e + i;
|
||||
for (Map.Entry<String, Object[]> entry : mapParametersToVars.entrySet()) {
|
||||
String key = entry.getKey() + i;
|
||||
if (key.equals(element)) {
|
||||
Object[] vars = mapParametersToVars.get(e);
|
||||
Object[] vars = entry.getValue();
|
||||
if (vars.length != NR_OF_RECOVERY_DEVICES) {
|
||||
throw new IllegalArgumentException("Recovery var array length is not 2");
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ public class RockSimCommonConstants {
|
||||
* Surface Density conversion. RockSim is in grams/sq centimeter, OpenRocket in
|
||||
* kilograms/sq meter. 1000/(100*100) = 1/10
|
||||
*/
|
||||
public static final double ROCKSIM_TO_OPENROCKET_SURFACE_DENSITY = 1 / 10d;
|
||||
public static final double ROCKSIM_TO_OPENROCKET_SURFACE_DENSITY = 1 / 10.0d;
|
||||
/**
|
||||
* Line Density conversion. RockSim is in kilograms/meter, OpenRocket in
|
||||
* kilograms/meter.
|
||||
|
@ -34,7 +34,7 @@ public enum RockSimNoseConeCode {
|
||||
/**
|
||||
* Names of the shape that are sometimes found in NCDATA.CSV
|
||||
*/
|
||||
private final Set<String> shapeNames = new HashSet<String>();
|
||||
private final Set<String> shapeNames = new HashSet<>();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -37,9 +37,9 @@ public class AbstractTransitionDTO extends BasePartDTO implements AttachablePart
|
||||
@XmlElement(name = RockSimCommonConstants.CONSTRUCTION_TYPE)
|
||||
private int constructionType = 1;
|
||||
@XmlElement(name = RockSimCommonConstants.WALL_THICKNESS)
|
||||
private double wallThickness = 0d;
|
||||
private double wallThickness = 0.0d;
|
||||
@XmlElement(name = RockSimCommonConstants.SHAPE_PARAMETER)
|
||||
private double shapeParameter = 0d;
|
||||
private double shapeParameter = 0.0d;
|
||||
|
||||
@XmlElementWrapper(name = RockSimCommonConstants.ATTACHED_PARTS)
|
||||
@XmlElementRefs({
|
||||
@ -51,7 +51,7 @@ public class AbstractTransitionDTO extends BasePartDTO implements AttachablePart
|
||||
@XmlElementRef(name = RockSimCommonConstants.STREAMER, type = StreamerDTO.class),
|
||||
@XmlElementRef(name = RockSimCommonConstants.PARACHUTE, type = ParachuteDTO.class),
|
||||
@XmlElementRef(name = RockSimCommonConstants.MASS_OBJECT, type = MassObjectDTO.class) })
|
||||
List<BasePartDTO> attachedParts = new ArrayList<BasePartDTO>();
|
||||
List<BasePartDTO> attachedParts = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
@ -78,32 +78,31 @@ public class AbstractTransitionDTO extends BasePartDTO implements AttachablePart
|
||||
setWallThickness(nc.getThickness() * RockSimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
|
||||
|
||||
List<RocketComponent> children = nc.getChildren();
|
||||
for (int i = 0; i < children.size(); i++) {
|
||||
RocketComponent rocketComponents = children.get(i);
|
||||
if (rocketComponents instanceof InnerTube) {
|
||||
addAttachedPart(new InnerBodyTubeDTO((InnerTube) rocketComponents, this));
|
||||
} else if (rocketComponents instanceof BodyTube) {
|
||||
addAttachedPart(new BodyTubeDTO((BodyTube) rocketComponents));
|
||||
} else if (rocketComponents instanceof Transition) {
|
||||
addAttachedPart(new TransitionDTO((Transition) rocketComponents));
|
||||
} else if (rocketComponents instanceof EngineBlock) {
|
||||
addAttachedPart(new EngineBlockDTO((EngineBlock) rocketComponents));
|
||||
} else if (rocketComponents instanceof TubeCoupler) {
|
||||
addAttachedPart(new TubeCouplerDTO((TubeCoupler) rocketComponents, this));
|
||||
} else if (rocketComponents instanceof CenteringRing) {
|
||||
addAttachedPart(new CenteringRingDTO((CenteringRing) rocketComponents));
|
||||
} else if (rocketComponents instanceof Bulkhead) {
|
||||
addAttachedPart(new BulkheadDTO((Bulkhead) rocketComponents));
|
||||
} else if (rocketComponents instanceof Parachute) {
|
||||
addAttachedPart(new ParachuteDTO((Parachute) rocketComponents));
|
||||
} else if (rocketComponents instanceof MassObject) {
|
||||
addAttachedPart(new MassObjectDTO((MassObject) rocketComponents));
|
||||
} else if (rocketComponents instanceof FreeformFinSet) {
|
||||
addAttachedPart(new CustomFinSetDTO((FreeformFinSet) rocketComponents));
|
||||
} else if (rocketComponents instanceof FinSet) {
|
||||
addAttachedPart(new FinSetDTO((FinSet) rocketComponents));
|
||||
}
|
||||
}
|
||||
for (RocketComponent rocketComponents : children) {
|
||||
if (rocketComponents instanceof InnerTube) {
|
||||
addAttachedPart(new InnerBodyTubeDTO((InnerTube) rocketComponents, this));
|
||||
} else if (rocketComponents instanceof BodyTube) {
|
||||
addAttachedPart(new BodyTubeDTO((BodyTube) rocketComponents));
|
||||
} else if (rocketComponents instanceof Transition) {
|
||||
addAttachedPart(new TransitionDTO((Transition) rocketComponents));
|
||||
} else if (rocketComponents instanceof EngineBlock) {
|
||||
addAttachedPart(new EngineBlockDTO((EngineBlock) rocketComponents));
|
||||
} else if (rocketComponents instanceof TubeCoupler) {
|
||||
addAttachedPart(new TubeCouplerDTO((TubeCoupler) rocketComponents, this));
|
||||
} else if (rocketComponents instanceof CenteringRing) {
|
||||
addAttachedPart(new CenteringRingDTO((CenteringRing) rocketComponents));
|
||||
} else if (rocketComponents instanceof Bulkhead) {
|
||||
addAttachedPart(new BulkheadDTO((Bulkhead) rocketComponents));
|
||||
} else if (rocketComponents instanceof Parachute) {
|
||||
addAttachedPart(new ParachuteDTO((Parachute) rocketComponents));
|
||||
} else if (rocketComponents instanceof MassObject) {
|
||||
addAttachedPart(new MassObjectDTO((MassObject) rocketComponents));
|
||||
} else if (rocketComponents instanceof FreeformFinSet) {
|
||||
addAttachedPart(new CustomFinSetDTO((FreeformFinSet) rocketComponents));
|
||||
} else if (rocketComponents instanceof FinSet) {
|
||||
addAttachedPart(new FinSetDTO((FinSet) rocketComponents));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getShapeCode() {
|
||||
|
@ -34,9 +34,9 @@ public abstract class BasePartDTO {
|
||||
private static int currentSerialNumber = 1;
|
||||
|
||||
@XmlElement(name = RockSimCommonConstants.KNOWN_MASS)
|
||||
private double knownMass = 0d;
|
||||
private double knownMass = 0.0d;
|
||||
@XmlElement(name = RockSimCommonConstants.DENSITY)
|
||||
private double density = 0d;
|
||||
private double density = 0.0d;
|
||||
@XmlElement(name = RockSimCommonConstants.MATERIAL)
|
||||
private String material = "";
|
||||
@XmlElement(name = RockSimCommonConstants.NAME)
|
||||
@ -48,9 +48,9 @@ public abstract class BasePartDTO {
|
||||
@XmlElement(name = RockSimCommonConstants.XB)
|
||||
private double xb = 0;
|
||||
@XmlElement(name = RockSimCommonConstants.CALC_MASS)
|
||||
private double calcMass = 0d;
|
||||
private double calcMass = 0.0d;
|
||||
@XmlElement(name = RockSimCommonConstants.CALC_CG)
|
||||
private double calcCG = 0d;
|
||||
private double calcCG = 0.0d;
|
||||
@XmlElement(name = RockSimCommonConstants.DENSITY_TYPE)
|
||||
private int densityType = 0;
|
||||
@XmlElement(name = RockSimCommonConstants.RADIAL_LOC)
|
||||
@ -60,7 +60,7 @@ public abstract class BasePartDTO {
|
||||
@XmlElement(name = RockSimCommonConstants.LOCATION_MODE)
|
||||
private int locationMode = 0;
|
||||
@XmlElement(name = RockSimCommonConstants.LEN, required = false, nillable = false)
|
||||
private double len = 0d;
|
||||
private double len = 0.0d;
|
||||
@XmlElement(name = RockSimCommonConstants.FINISH_CODE)
|
||||
private int finishCode = 0;
|
||||
@XmlElement(name = RockSimCommonConstants.SERIAL_NUMBER)
|
||||
|
@ -37,15 +37,15 @@ import java.util.List;
|
||||
public class BodyTubeDTO extends BasePartDTO implements AttachableParts {
|
||||
|
||||
@XmlElement(name = RockSimCommonConstants.OD)
|
||||
private double od = 0d;
|
||||
private double od = 0.0d;
|
||||
@XmlElement(name = RockSimCommonConstants.ID)
|
||||
private double id = 0d;
|
||||
private double id = 0.0d;
|
||||
@XmlElement(name = RockSimCommonConstants.IS_MOTOR_MOUNT)
|
||||
private int isMotorMount = 0;
|
||||
@XmlElement(name = RockSimCommonConstants.MOTOR_DIA)
|
||||
private double motorDia = 0d;
|
||||
private double motorDia = 0.0d;
|
||||
@XmlElement(name = RockSimCommonConstants.ENGINE_OVERHANG)
|
||||
private double engineOverhang = 0d;
|
||||
private double engineOverhang = 0.0d;
|
||||
@XmlElement(name = RockSimCommonConstants.IS_INSIDE_TUBE)
|
||||
private int isInsideTube = 0;
|
||||
@XmlElementWrapper(name = RockSimCommonConstants.ATTACHED_PARTS)
|
||||
@ -62,7 +62,7 @@ public class BodyTubeDTO extends BasePartDTO implements AttachableParts {
|
||||
@XmlElementRef(name = RockSimCommonConstants.PARACHUTE, type = ParachuteDTO.class),
|
||||
@XmlElementRef(name = RockSimCommonConstants.MASS_OBJECT, type = MassObjectDTO.class),
|
||||
@XmlElementRef(name = RockSimCommonConstants.EXTERNAL_POD, type = PodSetDTO.class) })
|
||||
List<BasePartDTO> attachedParts = new ArrayList<BasePartDTO>();
|
||||
List<BasePartDTO> attachedParts = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@ -94,51 +94,50 @@ public class BodyTubeDTO extends BasePartDTO implements AttachableParts {
|
||||
setMotorMount(theORBodyTube.isMotorMount());
|
||||
|
||||
List<RocketComponent> children = theORBodyTube.getChildren();
|
||||
for (int i = 0; i < children.size(); i++) {
|
||||
RocketComponent rocketComponent = children.get(i);
|
||||
if (rocketComponent instanceof InnerTube) {
|
||||
final InnerTube innerTube = (InnerTube) rocketComponent;
|
||||
final InnerBodyTubeDTO innerBodyTubeDTO = new InnerBodyTubeDTO(innerTube, this);
|
||||
//Only add the inner tube if it is NOT a cluster.
|
||||
if (innerTube.getInstanceCount() == 1) {
|
||||
addAttachedPart(innerBodyTubeDTO);
|
||||
}
|
||||
} else if (rocketComponent instanceof BodyTube) {
|
||||
addAttachedPart(new BodyTubeDTO((BodyTube) rocketComponent));
|
||||
} else if (rocketComponent instanceof Transition) {
|
||||
addAttachedPart(new TransitionDTO((Transition) rocketComponent));
|
||||
} else if (rocketComponent instanceof EngineBlock) {
|
||||
addAttachedPart(new EngineBlockDTO((EngineBlock) rocketComponent));
|
||||
} else if (rocketComponent instanceof TubeCoupler) {
|
||||
addAttachedPart(new TubeCouplerDTO((TubeCoupler) rocketComponent, this));
|
||||
} else if (rocketComponent instanceof CenteringRing) {
|
||||
addAttachedPart(new CenteringRingDTO((CenteringRing) rocketComponent));
|
||||
} else if (rocketComponent instanceof Bulkhead) {
|
||||
addAttachedPart(new BulkheadDTO((Bulkhead) rocketComponent));
|
||||
} else if (rocketComponent instanceof LaunchLug) {
|
||||
addAttachedPart(new LaunchLugDTO((LaunchLug) rocketComponent));
|
||||
} else if (rocketComponent instanceof Streamer) {
|
||||
addAttachedPart(new StreamerDTO((Streamer) rocketComponent));
|
||||
} else if (rocketComponent instanceof Parachute) {
|
||||
addAttachedPart(new ParachuteDTO((Parachute) rocketComponent));
|
||||
} else if (rocketComponent instanceof MassObject) {
|
||||
addAttachedPart(new MassObjectDTO((MassObject) rocketComponent));
|
||||
} else if (rocketComponent instanceof FreeformFinSet) {
|
||||
addAttachedPart(new CustomFinSetDTO((FreeformFinSet) rocketComponent));
|
||||
} else if (rocketComponent instanceof FinSet) {
|
||||
addAttachedPart(new FinSetDTO((FinSet) rocketComponent));
|
||||
} else if (rocketComponent instanceof TubeFinSet) {
|
||||
addAttachedPart(new TubeFinSetDTO((TubeFinSet) rocketComponent));
|
||||
} else if (rocketComponent instanceof PodSet) {
|
||||
for (PodSetDTO podSetDTO : PodSetDTO.generatePodSetDTOs((PodSet) rocketComponent)) {
|
||||
addAttachedPart(podSetDTO);
|
||||
}
|
||||
} else if (rocketComponent instanceof ParallelStage) {
|
||||
for (ParallelStageDTO parallelStageDTO : ParallelStageDTO.generateParallelStageDTOs((ParallelStage) rocketComponent)) {
|
||||
addAttachedPart(parallelStageDTO);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (RocketComponent rocketComponent : children) {
|
||||
if (rocketComponent instanceof InnerTube) {
|
||||
final InnerTube innerTube = (InnerTube) rocketComponent;
|
||||
final InnerBodyTubeDTO innerBodyTubeDTO = new InnerBodyTubeDTO(innerTube, this);
|
||||
//Only add the inner tube if it is NOT a cluster.
|
||||
if (innerTube.getInstanceCount() == 1) {
|
||||
addAttachedPart(innerBodyTubeDTO);
|
||||
}
|
||||
} else if (rocketComponent instanceof BodyTube) {
|
||||
addAttachedPart(new BodyTubeDTO((BodyTube) rocketComponent));
|
||||
} else if (rocketComponent instanceof Transition) {
|
||||
addAttachedPart(new TransitionDTO((Transition) rocketComponent));
|
||||
} else if (rocketComponent instanceof EngineBlock) {
|
||||
addAttachedPart(new EngineBlockDTO((EngineBlock) rocketComponent));
|
||||
} else if (rocketComponent instanceof TubeCoupler) {
|
||||
addAttachedPart(new TubeCouplerDTO((TubeCoupler) rocketComponent, this));
|
||||
} else if (rocketComponent instanceof CenteringRing) {
|
||||
addAttachedPart(new CenteringRingDTO((CenteringRing) rocketComponent));
|
||||
} else if (rocketComponent instanceof Bulkhead) {
|
||||
addAttachedPart(new BulkheadDTO((Bulkhead) rocketComponent));
|
||||
} else if (rocketComponent instanceof LaunchLug) {
|
||||
addAttachedPart(new LaunchLugDTO((LaunchLug) rocketComponent));
|
||||
} else if (rocketComponent instanceof Streamer) {
|
||||
addAttachedPart(new StreamerDTO((Streamer) rocketComponent));
|
||||
} else if (rocketComponent instanceof Parachute) {
|
||||
addAttachedPart(new ParachuteDTO((Parachute) rocketComponent));
|
||||
} else if (rocketComponent instanceof MassObject) {
|
||||
addAttachedPart(new MassObjectDTO((MassObject) rocketComponent));
|
||||
} else if (rocketComponent instanceof FreeformFinSet) {
|
||||
addAttachedPart(new CustomFinSetDTO((FreeformFinSet) rocketComponent));
|
||||
} else if (rocketComponent instanceof FinSet) {
|
||||
addAttachedPart(new FinSetDTO((FinSet) rocketComponent));
|
||||
} else if (rocketComponent instanceof TubeFinSet) {
|
||||
addAttachedPart(new TubeFinSetDTO((TubeFinSet) rocketComponent));
|
||||
} else if (rocketComponent instanceof PodSet) {
|
||||
for (PodSetDTO podSetDTO : PodSetDTO.generatePodSetDTOs((PodSet) rocketComponent)) {
|
||||
addAttachedPart(podSetDTO);
|
||||
}
|
||||
} else if (rocketComponent instanceof ParallelStage) {
|
||||
for (ParallelStageDTO parallelStageDTO : ParallelStageDTO.generateParallelStageDTOs((ParallelStage) rocketComponent)) {
|
||||
addAttachedPart(parallelStageDTO);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double getOD() {
|
||||
|
@ -34,9 +34,9 @@ public class CenteringRingDTO extends BasePartDTO {
|
||||
}
|
||||
|
||||
@XmlElement(name = RockSimCommonConstants.OD)
|
||||
private double od = 0d;
|
||||
private double od = 0.0d;
|
||||
@XmlElement(name = RockSimCommonConstants.ID)
|
||||
private double id = 0d;
|
||||
private double id = 0.0d;
|
||||
@XmlElement(name = RockSimCommonConstants.USAGE_CODE)
|
||||
private int usageCode = UsageCode.CenteringRing.ordinal;
|
||||
@XmlElement(name = RockSimCommonConstants.AUTO_SIZE)
|
||||
|
@ -23,29 +23,29 @@ public class FinSetDTO extends BasePartDTO {
|
||||
@XmlElement(name = RockSimCommonConstants.FIN_COUNT)
|
||||
private int finCount = 0;
|
||||
@XmlElement(name = RockSimCommonConstants.ROOT_CHORD)
|
||||
private double rootChord = 0d;
|
||||
private double rootChord = 0.0d;
|
||||
@XmlElement(name = RockSimCommonConstants.TIP_CHORD)
|
||||
private double tipChord = 0d;
|
||||
private double tipChord = 0.0d;
|
||||
@XmlElement(name = RockSimCommonConstants.SEMI_SPAN)
|
||||
private double semiSpan = 0d;
|
||||
private double semiSpan = 0.0d;
|
||||
@XmlElement(name = RockSimCommonConstants.SWEEP_DISTANCE)
|
||||
private double sweepDistance = 0d;
|
||||
private double sweepDistance = 0.0d;
|
||||
@XmlElement(name = RockSimCommonConstants.THICKNESS)
|
||||
private double thickness = 0d;
|
||||
private double thickness = 0.0d;
|
||||
@XmlElement(name = RockSimCommonConstants.SHAPE_CODE)
|
||||
private int shapeCode = 0;
|
||||
@XmlElement(name = RockSimCommonConstants.TIP_SHAPE_CODE)
|
||||
private int tipShapeCode = 0;
|
||||
@XmlElement(name = RockSimCommonConstants.TAB_LENGTH)
|
||||
private double tabLength = 0d;
|
||||
private double tabLength = 0.0d;
|
||||
@XmlElement(name = RockSimCommonConstants.TAB_DEPTH)
|
||||
private double tabDepth = 0d;
|
||||
private double tabDepth = 0.0d;
|
||||
@XmlElement(name = RockSimCommonConstants.TAB_OFFSET)
|
||||
private double tabOffset = 0d;
|
||||
private double tabOffset = 0.0d;
|
||||
@XmlElement(name = RockSimCommonConstants.SWEEP_MODE)
|
||||
private int sweepMode = 1;
|
||||
@XmlElement(name = RockSimCommonConstants.CANT_ANGLE)
|
||||
private double cantAngle = 0d;
|
||||
private double cantAngle = 0.0d;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -58,8 +58,7 @@ public class InnerBodyTubeDTO extends BodyTubeDTO implements AttachableParts {
|
||||
setRadialLoc(bt.getRadialPosition() * RockSimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
|
||||
|
||||
List<RocketComponent> children = bt.getChildren();
|
||||
for (int i = 0; i < children.size(); i++) {
|
||||
RocketComponent rocketComponents = children.get(i);
|
||||
for (RocketComponent rocketComponents : children) {
|
||||
if (rocketComponents instanceof InnerTube) {
|
||||
final InnerTube innerTube = (InnerTube) rocketComponents;
|
||||
// Only if the inner tube is NOT a cluster, then create the corresponding
|
||||
|
@ -16,9 +16,9 @@ import info.openrocket.core.rocketcomponent.LaunchLug;
|
||||
public class LaunchLugDTO extends BasePartDTO {
|
||||
|
||||
@XmlElement(name = RockSimCommonConstants.OD)
|
||||
private double od = 0d;
|
||||
private double od = 0.0d;
|
||||
@XmlElement(name = RockSimCommonConstants.ID)
|
||||
private double id = 0d;
|
||||
private double id = 0.0d;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
|
@ -33,8 +33,8 @@ public class MassObjectDTO extends BasePartDTO {
|
||||
super(mo);
|
||||
setRadialAngle(mo.getRadialDirection());
|
||||
setRadialLoc(mo.getRadialPosition() * RockSimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
|
||||
setCalcMass(0d);
|
||||
setCalcCG(0d);
|
||||
setCalcMass(0.0d);
|
||||
setCalcCG(0.0d);
|
||||
setKnownCG(getXb());
|
||||
setUseKnownCG(1);
|
||||
}
|
||||
|
@ -16,11 +16,11 @@ import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
public class NoseConeDTO extends AbstractTransitionDTO {
|
||||
|
||||
@XmlElement(name = RockSimCommonConstants.BASE_DIA)
|
||||
private double baseDia = 0d;
|
||||
private double baseDia = 0.0d;
|
||||
@XmlElement(name = RockSimCommonConstants.SHOULDER_LEN)
|
||||
private double shoulderLen = 0d;
|
||||
private double shoulderLen = 0.0d;
|
||||
@XmlElement(name = RockSimCommonConstants.SHOULDER_OD)
|
||||
private double shoulderOD = 0d;
|
||||
private double shoulderOD = 0.0d;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
|
@ -16,17 +16,17 @@ import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
public class ParachuteDTO extends BasePartDTO {
|
||||
|
||||
@XmlElement(name = RockSimCommonConstants.DIAMETER)
|
||||
private double dia = 0d;
|
||||
private double dia = 0.0d;
|
||||
@XmlElement(name = RockSimCommonConstants.SHROUD_LINE_COUNT)
|
||||
private int ShroudLineCount = 0;
|
||||
@XmlElement(name = RockSimCommonConstants.THICKNESS)
|
||||
private double thickness = 0d;
|
||||
private double thickness = 0.0d;
|
||||
@XmlElement(name = RockSimCommonConstants.SHROUD_LINE_LEN)
|
||||
private double shroudLineLen = 0d;
|
||||
private double shroudLineLen = 0.0d;
|
||||
@XmlElement(name = RockSimCommonConstants.CHUTE_COUNT)
|
||||
private int chuteCount = 1;
|
||||
@XmlElement(name = RockSimCommonConstants.SHROUD_LINE_MASS_PER_MM)
|
||||
private double shroudLineMassPerMM = 0d;
|
||||
private double shroudLineMassPerMM = 0.0d;
|
||||
@XmlElement(name = RockSimCommonConstants.SHROUD_LINE_MATERIAL)
|
||||
private String shroudLineMaterial = "";
|
||||
@XmlElement(name = RockSimCommonConstants.DRAG_COEFFICIENT)
|
||||
|
@ -9,7 +9,6 @@ import info.openrocket.core.rocketcomponent.RocketComponent;
|
||||
import info.openrocket.core.rocketcomponent.Transition;
|
||||
import info.openrocket.core.rocketcomponent.position.AnglePositionable;
|
||||
import info.openrocket.core.rocketcomponent.position.AxialMethod;
|
||||
import info.openrocket.core.rocketcomponent.position.RadiusMethod;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
|
@ -28,9 +28,9 @@ public class RocketDesignDTO {
|
||||
@XmlElement(name = "ViewStageCountEdit")
|
||||
private final int viewStageCountEdit = 3;
|
||||
@XmlElement(name = "ZoomFactor")
|
||||
private final double zoomFactor = 0d;
|
||||
private final double zoomFactor = 0.0d;
|
||||
@XmlElement(name = "ZoomFactorEdit")
|
||||
private final double zoomFactorEdit = 0d;
|
||||
private final double zoomFactorEdit = 0.0d;
|
||||
@XmlElement(name = "ScrollPosX")
|
||||
private final int scrollPosX = 0;
|
||||
@XmlElement(name = "ScrollPosY")
|
||||
@ -46,21 +46,21 @@ public class RocketDesignDTO {
|
||||
@XmlElement(name = "LastSerialNumber")
|
||||
private int lastSerialNumber = -1;
|
||||
@XmlElement(name = "Stage3Mass")
|
||||
private double stage3Mass = 0d;
|
||||
private double stage3Mass = 0.0d;
|
||||
@XmlElement(name = "Stage2Mass")
|
||||
private double stage2Mass = 0d;
|
||||
private double stage2Mass = 0.0d;
|
||||
@XmlElement(name = "Stage1Mass")
|
||||
private double stage1Mass = 0d;
|
||||
private double stage1Mass = 0.0d;
|
||||
@XmlElement(name = "Stage3CG")
|
||||
private double stage3CG = 0d;
|
||||
private double stage3CG = 0.0d;
|
||||
@XmlElement(name = "Stage2CGAlone")
|
||||
private double stage2CGAlone = 0d;
|
||||
private double stage2CGAlone = 0.0d;
|
||||
@XmlElement(name = "Stage1CGAlone")
|
||||
private double stage1CGAlone = 0d;
|
||||
private double stage1CGAlone = 0.0d;
|
||||
@XmlElement(name = "Stage321CG")
|
||||
private double stage321CG = 0d;
|
||||
private double stage321CG = 0.0d;
|
||||
@XmlElement(name = "Stage32CG")
|
||||
private double stage32CG = 0d;
|
||||
private double stage32CG = 0.0d;
|
||||
|
||||
@XmlElement(name = "CPCalcFlags")
|
||||
private final int cpCalcFlags = 1;
|
||||
|
@ -25,7 +25,7 @@ public class StageDTO {
|
||||
@XmlElementRef(name = RockSimCommonConstants.NOSE_CONE, type = NoseConeDTO.class),
|
||||
@XmlElementRef(name = RockSimCommonConstants.TRANSITION, type = TransitionDTO.class)
|
||||
})
|
||||
private final List<BasePartDTO> externalPart = new ArrayList<BasePartDTO>();
|
||||
private final List<BasePartDTO> externalPart = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
@ -76,16 +76,15 @@ public class StageDTO {
|
||||
}
|
||||
|
||||
List<RocketComponent> children = theORStage.getChildren();
|
||||
for (int i = 0; i < children.size(); i++) {
|
||||
RocketComponent rocketComponents = children.get(i);
|
||||
if (rocketComponents instanceof NoseCone) {
|
||||
addExternalPart(toNoseConeDTO((NoseCone) rocketComponents));
|
||||
} else if (rocketComponents instanceof BodyTube) {
|
||||
addExternalPart(toBodyTubeDTO((BodyTube) rocketComponents));
|
||||
} else if (rocketComponents instanceof Transition) {
|
||||
addExternalPart(toTransitionDTO((Transition) rocketComponents));
|
||||
}
|
||||
}
|
||||
for (RocketComponent rocketComponents : children) {
|
||||
if (rocketComponents instanceof NoseCone) {
|
||||
addExternalPart(toNoseConeDTO((NoseCone) rocketComponents));
|
||||
} else if (rocketComponents instanceof BodyTube) {
|
||||
addExternalPart(toBodyTubeDTO((BodyTube) rocketComponents));
|
||||
} else if (rocketComponents instanceof Transition) {
|
||||
addExternalPart(toTransitionDTO((Transition) rocketComponents));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<BasePartDTO> getExternalPart() {
|
||||
|
@ -16,7 +16,7 @@ import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
public class StreamerDTO extends BasePartDTO {
|
||||
|
||||
@XmlElement(name = RockSimCommonConstants.WIDTH)
|
||||
private double width = 0d;
|
||||
private double width = 0.0d;
|
||||
@XmlElement(name = RockSimCommonConstants.DRAG_COEFFICIENT)
|
||||
private double dragCoefficient = 0.75d;
|
||||
|
||||
|
@ -16,17 +16,17 @@ import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
public class TransitionDTO extends AbstractTransitionDTO {
|
||||
|
||||
@XmlElement(name = RockSimCommonConstants.FRONT_SHOULDER_LEN)
|
||||
private double frontShoulderLen = 0d;
|
||||
private double frontShoulderLen = 0.0d;
|
||||
@XmlElement(name = RockSimCommonConstants.REAR_SHOULDER_LEN)
|
||||
private double rearShoulderLen = 0d;
|
||||
private double rearShoulderLen = 0.0d;
|
||||
@XmlElement(name = RockSimCommonConstants.FRONT_SHOULDER_DIA)
|
||||
private double frontShoulderDia = 0d;
|
||||
private double frontShoulderDia = 0.0d;
|
||||
@XmlElement(name = RockSimCommonConstants.REAR_SHOULDER_DIA)
|
||||
private double rearShoulderDia = 0d;
|
||||
private double rearShoulderDia = 0.0d;
|
||||
@XmlElement(name = RockSimCommonConstants.FRONT_DIA)
|
||||
private double frontDia = 0d;
|
||||
private double frontDia = 0.0d;
|
||||
@XmlElement(name = RockSimCommonConstants.REAR_DIA)
|
||||
private double rearDia = 0d;
|
||||
private double rearDia = 0.0d;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user