Replace explicit type with <>
This commit is contained in:
parent
aef972699a
commit
595406ab68
@ -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() );
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -89,7 +89,7 @@ public class DefaultAppearance {
|
||||
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 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
|
||||
|
@ -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,7 +83,7 @@ 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);
|
||||
@ -105,7 +105,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);
|
||||
|
@ -18,8 +18,8 @@ import java.util.List;
|
||||
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() {
|
||||
|
@ -25,15 +25,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<>();
|
||||
|
||||
|
||||
|
||||
|
@ -28,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;
|
||||
|
@ -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
|
||||
|
@ -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());
|
||||
|
||||
@ -299,7 +299,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;
|
||||
|
||||
|
@ -72,8 +72,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<>();
|
||||
@ -86,8 +86,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
|
||||
@ -103,7 +103,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;
|
||||
@ -114,7 +114,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
|
||||
@ -169,7 +169,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);
|
||||
|
@ -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;
|
||||
|
@ -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()) {
|
||||
|
@ -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;
|
||||
|
@ -62,8 +62,8 @@ 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;
|
||||
@ -80,7 +80,7 @@ public class RASPMotorLoader extends AbstractMotorLoader {
|
||||
comment = "";
|
||||
length = 0;
|
||||
diameter = 0;
|
||||
delays = new ArrayList<Double>();
|
||||
delays = new ArrayList<>();
|
||||
propW = 0;
|
||||
totalW = 0;
|
||||
time.clear();
|
||||
|
@ -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;
|
||||
|
@ -479,7 +479,7 @@ public class OpenRocketSaver extends RocketSaver {
|
||||
return;
|
||||
|
||||
// Retrieve the data from the branch
|
||||
List<List<Double>> data = new ArrayList<List<Double>>(types.length);
|
||||
List<List<Double>> data = new ArrayList<>(types.length);
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
data.add(branch.get(types[i]));
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ public class ConfigHandler extends AbstractElementHandler {
|
||||
|
||||
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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
@ -89,7 +89,7 @@ class SingleSimulationHandler extends AbstractElementHandler {
|
||||
String id = attributes.get("extensionid");
|
||||
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);
|
||||
|
@ -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);
|
||||
|
@ -10,7 +10,7 @@ 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>");
|
||||
|
@ -226,7 +226,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();
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -18,9 +18,9 @@ import info.openrocket.core.logging.WarningSet;
|
||||
class DelegatorHandler extends DefaultHandler {
|
||||
private final WarningSet warnings;
|
||||
|
||||
private final Deque<ElementHandler> handlerStack = new ArrayDeque<ElementHandler>();
|
||||
private final Deque<StringBuilder> elementData = new ArrayDeque<StringBuilder>();
|
||||
private final Deque<HashMap<String, String>> elementAttributes = new ArrayDeque<HashMap<String, String>>();
|
||||
private final Deque<ElementHandler> handlerStack = new ArrayDeque<>();
|
||||
private final Deque<StringBuilder> elementData = new ArrayDeque<>();
|
||||
private final Deque<HashMap<String, String>> elementAttributes = new ArrayDeque<>();
|
||||
|
||||
// Ignore all elements as long as ignore > 0
|
||||
private int ignore = 0;
|
||||
@ -98,7 +98,7 @@ class DelegatorHandler extends DefaultHandler {
|
||||
}
|
||||
|
||||
private static HashMap<String, String> copyAttributes(Attributes atts) {
|
||||
HashMap<String, String> ret = new HashMap<String, String>();
|
||||
HashMap<String, String> ret = new HashMap<>();
|
||||
for (int i = 0; i < atts.getLength(); i++) {
|
||||
ret.put(atts.getLocalName(i), atts.getValue(i));
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ import org.xml.sax.SAXException;
|
||||
public class NullElementHandler extends AbstractElementHandler {
|
||||
public static final NullElementHandler INSTANCE = new NullElementHandler();
|
||||
|
||||
private static final HashMap<String, String> EMPTY_MAP = new HashMap<String, String>();
|
||||
private static final HashMap<String, String> EMPTY_MAP = new HashMap<>();
|
||||
|
||||
private NullElementHandler() {
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ public class SimpleSAX {
|
||||
private XMLReaderCache(int maxSize) {
|
||||
parserFactory = SAXParserFactory.newInstance();
|
||||
parserFactory.setNamespaceAware(true);
|
||||
queue = new LinkedBlockingQueue<XMLReader>(maxSize);
|
||||
queue = new LinkedBlockingQueue<>(maxSize);
|
||||
}
|
||||
|
||||
private XMLReader createXMLReader() throws SAXException {
|
||||
|
@ -212,7 +212,7 @@ public final class DefaultMtl implements Mtl {
|
||||
*/
|
||||
public DefaultMtl(String name) {
|
||||
this.name = name;
|
||||
this.reflOptions = new ArrayList<TextureOptions>();
|
||||
this.reflOptions = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -54,7 +54,7 @@ public final class DefaultObjGroup implements ObjGroup {
|
||||
*/
|
||||
public DefaultObjGroup(String name) {
|
||||
this.name = name;
|
||||
faces = new ArrayList<ObjFace>();
|
||||
faces = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -103,7 +103,7 @@ public final class L10N {
|
||||
/*
|
||||
* This list is generated using the L10NGenerator utility.
|
||||
*/
|
||||
Map<Character, String> m = new HashMap<Character, String>();
|
||||
Map<Character, String> m = new HashMap<>();
|
||||
m.put('\u00aa', "a");
|
||||
m.put('\u00b2', "2");
|
||||
m.put('\u00b3', "3");
|
||||
|
@ -94,7 +94,7 @@ public abstract class MessageSet<E extends Message> extends AbstractSet<E> imple
|
||||
@Override
|
||||
public Iterator<E> iterator() {
|
||||
final Iterator<E> iterator = messages.iterator();
|
||||
return new Iterator<E>() {
|
||||
return new Iterator<>() {
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return iterator.hasNext();
|
||||
|
@ -185,7 +185,7 @@ public class MassCalculation {
|
||||
RigidBody inertia = RigidBody.EMPTY;
|
||||
|
||||
// center-of-mass AND moment-of-inertia data.
|
||||
final ArrayList<RigidBody> bodies = new ArrayList<RigidBody>();
|
||||
final ArrayList<RigidBody> bodies = new ArrayList<>();
|
||||
|
||||
String prefix = "";
|
||||
|
||||
|
@ -41,7 +41,7 @@ public class Manufacturer implements Serializable {
|
||||
static {
|
||||
|
||||
// AeroTech has many name combinations...
|
||||
List<String> names = new ArrayList<String>();
|
||||
List<String> names = new ArrayList<>();
|
||||
for (String s : new String[] { "A", "AT", "AERO", "AEROT", "AEROTECH" }) {
|
||||
names.add(s);
|
||||
names.add(s + "-RMS");
|
||||
@ -141,8 +141,8 @@ public class Manufacturer implements Serializable {
|
||||
throw new IllegalArgumentException("motorType cannot be null");
|
||||
}
|
||||
|
||||
Set<String> all = new HashSet<String>();
|
||||
Set<String> search = new HashSet<String>();
|
||||
Set<String> all = new HashSet<>();
|
||||
Set<String> search = new HashSet<>();
|
||||
|
||||
all.add(displayName);
|
||||
all.add(simpleName);
|
||||
|
@ -14,7 +14,7 @@ import java.util.List;
|
||||
*/
|
||||
public class OptimizationControllerDelegator implements OptimizationController {
|
||||
|
||||
private final List<OptimizationController> controllers = new ArrayList<OptimizationController>();
|
||||
private final List<OptimizationController> controllers = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Construct the controlled based on an array of controllers.
|
||||
|
@ -32,8 +32,8 @@ import info.openrocket.core.util.BugException;
|
||||
*/
|
||||
public class ParallelExecutorCache implements ParallelFunctionCache {
|
||||
|
||||
private final Map<Point, Double> functionCache = new HashMap<Point, Double>();
|
||||
private final Map<Point, Future<Double>> futureMap = new HashMap<Point, Future<Double>>();
|
||||
private final Map<Point, Double> functionCache = new HashMap<>();
|
||||
private final Map<Point, Future<Double>> futureMap = new HashMap<>();
|
||||
|
||||
private final ExecutorService executor;
|
||||
|
||||
@ -57,7 +57,7 @@ public class ParallelExecutorCache implements ParallelFunctionCache {
|
||||
*/
|
||||
public ParallelExecutorCache(int threadCount) {
|
||||
this(new ThreadPoolExecutor(threadCount, threadCount, 60, TimeUnit.SECONDS,
|
||||
new LinkedBlockingQueue<Runnable>(),
|
||||
new LinkedBlockingQueue<>(),
|
||||
new ThreadFactory() {
|
||||
@Override
|
||||
public Thread newThread(Runnable r) {
|
||||
@ -152,7 +152,7 @@ public class ParallelExecutorCache implements ParallelFunctionCache {
|
||||
|
||||
@Override
|
||||
public List<Point> abort(Collection<Point> points) {
|
||||
List<Point> computed = new ArrayList<Point>(Math.min(points.size(), 10));
|
||||
List<Point> computed = new ArrayList<>(Math.min(points.size(), 10));
|
||||
|
||||
for (Point p : points) {
|
||||
if (abort(p)) {
|
||||
@ -244,7 +244,7 @@ public class ParallelExecutorCache implements ParallelFunctionCache {
|
||||
|
||||
@Override
|
||||
public void clearCache() {
|
||||
List<Point> list = new ArrayList<Point>(futureMap.keySet());
|
||||
List<Point> list = new ArrayList<>(futureMap.keySet());
|
||||
abort(list);
|
||||
functionCache.clear();
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ import info.openrocket.core.util.Statistics;
|
||||
public class MultidirectionalSearchOptimizer implements FunctionOptimizer, Statistics {
|
||||
private static final Logger log = LoggerFactory.getLogger(MultidirectionalSearchOptimizer.class);
|
||||
|
||||
private final List<Point> simplex = new ArrayList<Point>();
|
||||
private final List<Point> simplex = new ArrayList<>();
|
||||
|
||||
private ParallelFunctionCache functionExecutor;
|
||||
|
||||
@ -72,9 +72,9 @@ public class MultidirectionalSearchOptimizer implements FunctionOptimizer, Stati
|
||||
}
|
||||
|
||||
// Normal iterations
|
||||
List<Point> reflection = new ArrayList<Point>(simplex.size());
|
||||
List<Point> expansion = new ArrayList<Point>(simplex.size());
|
||||
List<Point> coordinateSearch = new ArrayList<Point>(simplex.size());
|
||||
List<Point> reflection = new ArrayList<>(simplex.size());
|
||||
List<Point> expansion = new ArrayList<>(simplex.size());
|
||||
List<Point> coordinateSearch = new ArrayList<>(simplex.size());
|
||||
Point current;
|
||||
double currentValue;
|
||||
boolean continueOptimization = true;
|
||||
@ -177,7 +177,7 @@ public class MultidirectionalSearchOptimizer implements FunctionOptimizer, Stati
|
||||
if (accept(coordinateSearch, currentValue)) {
|
||||
|
||||
log.debug("Coordinate search successful, resetting simplex");
|
||||
List<Point> toAbort = new LinkedList<Point>(simplex);
|
||||
List<Point> toAbort = new LinkedList<>(simplex);
|
||||
simplex.clear();
|
||||
simplex.add(current);
|
||||
for (Point p : pattern) {
|
||||
|
@ -19,7 +19,7 @@ public class SearchPattern {
|
||||
* @param dimensionality the dimensionality
|
||||
*/
|
||||
public static List<Point> square(int dimensionality) {
|
||||
List<Point> pattern = new ArrayList<Point>(dimensionality);
|
||||
List<Point> pattern = new ArrayList<>(dimensionality);
|
||||
|
||||
for (int i = 0; i < dimensionality; i++) {
|
||||
double[] p = new double[dimensionality];
|
||||
@ -39,7 +39,7 @@ public class SearchPattern {
|
||||
throw new IllegalArgumentException("Illegal dimensionality " + dimensionality);
|
||||
}
|
||||
|
||||
List<Point> pattern = new ArrayList<Point>(dimensionality);
|
||||
List<Point> pattern = new ArrayList<>(dimensionality);
|
||||
|
||||
double[] coordinates = new double[dimensionality];
|
||||
double dot = -1.0 / dimensionality;
|
||||
|
@ -14,7 +14,7 @@ public class IdentitySimulationDomain implements SimulationDomain {
|
||||
|
||||
@Override
|
||||
public Pair<Double, Value> getDistanceToDomain(Simulation simulation) {
|
||||
return new Pair<Double, Value>(-1.0, null);
|
||||
return new Pair<>(-1.0, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -108,27 +108,27 @@ public class StabilityDomain implements SimulationDomain {
|
||||
if (minAbsolute) {
|
||||
ref = minimum - absolute;
|
||||
if (ref > 0) {
|
||||
return new Pair<Double, Value>(ref, desc);
|
||||
return new Pair<>(ref, desc);
|
||||
}
|
||||
} else {
|
||||
ref = minimum - relative;
|
||||
if (ref > 0) {
|
||||
return new Pair<Double, Value>(ref, desc);
|
||||
return new Pair<>(ref, desc);
|
||||
}
|
||||
}
|
||||
|
||||
if (maxAbsolute) {
|
||||
ref = absolute - maximum;
|
||||
if (ref > 0) {
|
||||
return new Pair<Double, Value>(ref, desc);
|
||||
return new Pair<>(ref, desc);
|
||||
}
|
||||
} else {
|
||||
ref = relative - maximum;
|
||||
if (ref > 0) {
|
||||
return new Pair<Double, Value>(ref, desc);
|
||||
return new Pair<>(ref, desc);
|
||||
}
|
||||
}
|
||||
|
||||
return new Pair<Double, Value>(0.0, desc);
|
||||
return new Pair<>(0.0, desc);
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public abstract class AbstractSimulationModifier implements SimulationModifier {
|
||||
private double minValue = 0.0;
|
||||
private double maxValue = 1.0;
|
||||
|
||||
private final List<EventListener> listeners = new ArrayList<EventListener>();
|
||||
private final List<EventListener> listeners = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Sole constructor.
|
||||
|
@ -24,7 +24,7 @@ public class DefaultOptimizableParameterService implements OptimizableParameterS
|
||||
|
||||
@Override
|
||||
public Collection<OptimizableParameter> getParameters(OpenRocketDocument document) {
|
||||
List<OptimizableParameter> list = new ArrayList<OptimizableParameter>();
|
||||
List<OptimizableParameter> list = new ArrayList<>();
|
||||
|
||||
list.add(new MaximumAltitudeParameter());
|
||||
list.add(new MaximumVelocityParameter());
|
||||
|
@ -46,7 +46,7 @@ public class DefaultSimulationModifierService implements SimulationModifierServi
|
||||
private static final double DEFAULT_RANGE_MULTIPLIER = 2.0;
|
||||
|
||||
|
||||
private static final Map<Class<?>, List<ModifierDefinition>> definitions = new HashMap<Class<?>, List<ModifierDefinition>>();
|
||||
private static final Map<Class<?>, List<ModifierDefinition>> definitions = new HashMap<>();
|
||||
static {
|
||||
//addModifier("optimization.modifier.", unitGroup, multiplier, componentClass, methodName);
|
||||
|
||||
@ -110,7 +110,7 @@ public class DefaultSimulationModifierService implements SimulationModifierServi
|
||||
|
||||
List<ModifierDefinition> list = definitions.get(componentClass);
|
||||
if (list == null) {
|
||||
list = new ArrayList<DefaultSimulationModifierService.ModifierDefinition>();
|
||||
list = new ArrayList<>();
|
||||
definitions.put(componentClass, list);
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ public class DefaultSimulationModifierService implements SimulationModifierServi
|
||||
|
||||
@Override
|
||||
public Collection<SimulationModifier> getModifiers(OpenRocketDocument document) {
|
||||
List<SimulationModifier> modifiers = new ArrayList<SimulationModifier>();
|
||||
List<SimulationModifier> modifiers = new ArrayList<>();
|
||||
|
||||
Rocket rocket = document.getRocket();
|
||||
|
||||
@ -192,7 +192,7 @@ public class DefaultSimulationModifierService implements SimulationModifierServi
|
||||
modifiers.add(mod);
|
||||
|
||||
// Motor ignition delay
|
||||
mod = new FlightConfigurationModifier<MotorConfiguration>(
|
||||
mod = new FlightConfigurationModifier<>(
|
||||
trans.get("optimization.modifier.motormount.delay"),
|
||||
trans.get("optimization.modifier.motormount.delay.desc"),
|
||||
c, UnitGroup.UNITS_SHORT_TIME,
|
||||
@ -250,7 +250,7 @@ public class DefaultSimulationModifierService implements SimulationModifierServi
|
||||
|
||||
// Recovery device deployment altitude and delay
|
||||
if (c instanceof RecoveryDevice) {
|
||||
SimulationModifier mod = new FlightConfigurationModifier<DeploymentConfiguration>(
|
||||
SimulationModifier mod = new FlightConfigurationModifier<>(
|
||||
trans.get("optimization.modifier.recoverydevice.deployDelay"),
|
||||
trans.get("optimization.modifier.recoverydevice.deployDelay.desc"),
|
||||
c,
|
||||
@ -266,7 +266,7 @@ public class DefaultSimulationModifierService implements SimulationModifierServi
|
||||
mod.setMaxValue(10);
|
||||
modifiers.add(mod);
|
||||
|
||||
mod = new FlightConfigurationModifier<DeploymentConfiguration>(
|
||||
mod = new FlightConfigurationModifier<>(
|
||||
trans.get("optimization.modifier.recoverydevice.deployAltitude"),
|
||||
trans.get("optimization.modifier.recoverydevice.deployAltitude.desc"),
|
||||
c,
|
||||
|
@ -25,7 +25,7 @@ public final class OptimizationServiceHelper {
|
||||
* @return a collection of all simulation modifiers applicable to the document.
|
||||
*/
|
||||
public static Collection<SimulationModifier> getSimulationModifiers(OpenRocketDocument document) {
|
||||
List<SimulationModifier> list = new ArrayList<SimulationModifier>();
|
||||
List<SimulationModifier> list = new ArrayList<>();
|
||||
|
||||
ServiceLoader<SimulationModifierService> loader = ServiceLoader.load(SimulationModifierService.class);
|
||||
for (SimulationModifierService service : loader) {
|
||||
@ -47,7 +47,7 @@ public final class OptimizationServiceHelper {
|
||||
* document.
|
||||
*/
|
||||
public static Collection<OptimizableParameter> getOptimizableParameters(OpenRocketDocument document) {
|
||||
List<OptimizableParameter> list = new ArrayList<OptimizableParameter>();
|
||||
List<OptimizableParameter> list = new ArrayList<>();
|
||||
|
||||
ServiceLoader<OptimizableParameterService> loader = ServiceLoader.load(OptimizableParameterService.class);
|
||||
for (OptimizableParameterService service : loader) {
|
||||
|
@ -180,75 +180,75 @@ public class ComponentPreset implements Comparable<ComponentPreset>, Serializabl
|
||||
|
||||
}
|
||||
|
||||
public final static TypedKey<Boolean> LEGACY = new TypedKey<Boolean>("Legacy", Boolean.class);
|
||||
public final static TypedKey<Manufacturer> MANUFACTURER = new TypedKey<Manufacturer>("Manufacturer",
|
||||
public final static TypedKey<Boolean> LEGACY = new TypedKey<>("Legacy", Boolean.class);
|
||||
public final static TypedKey<Manufacturer> MANUFACTURER = new TypedKey<>("Manufacturer",
|
||||
Manufacturer.class);
|
||||
public final static TypedKey<String> PARTNO = new TypedKey<String>("PartNo", String.class);
|
||||
public final static TypedKey<String> DESCRIPTION = new TypedKey<String>("Description", String.class);
|
||||
public final static TypedKey<Type> TYPE = new TypedKey<Type>("Type", Type.class);
|
||||
public final static TypedKey<Double> LENGTH = new TypedKey<Double>("Length", Double.class, UnitGroup.UNITS_LENGTH);
|
||||
public final static TypedKey<Double> HEIGHT = new TypedKey<Double>("Height", Double.class, UnitGroup.UNITS_LENGTH);
|
||||
public final static TypedKey<Double> WIDTH = new TypedKey<Double>("Width", Double.class, UnitGroup.UNITS_LENGTH);
|
||||
public final static TypedKey<Double> INNER_DIAMETER = new TypedKey<Double>("InnerDiameter", Double.class,
|
||||
public final static TypedKey<String> PARTNO = new TypedKey<>("PartNo", String.class);
|
||||
public final static TypedKey<String> DESCRIPTION = new TypedKey<>("Description", String.class);
|
||||
public final static TypedKey<Type> TYPE = new TypedKey<>("Type", Type.class);
|
||||
public final static TypedKey<Double> LENGTH = new TypedKey<>("Length", Double.class, UnitGroup.UNITS_LENGTH);
|
||||
public final static TypedKey<Double> HEIGHT = new TypedKey<>("Height", Double.class, UnitGroup.UNITS_LENGTH);
|
||||
public final static TypedKey<Double> WIDTH = new TypedKey<>("Width", Double.class, UnitGroup.UNITS_LENGTH);
|
||||
public final static TypedKey<Double> INNER_DIAMETER = new TypedKey<>("InnerDiameter", Double.class,
|
||||
UnitGroup.UNITS_LENGTH);
|
||||
public final static TypedKey<Double> OUTER_DIAMETER = new TypedKey<Double>("OuterDiameter", Double.class,
|
||||
public final static TypedKey<Double> OUTER_DIAMETER = new TypedKey<>("OuterDiameter", Double.class,
|
||||
UnitGroup.UNITS_LENGTH);
|
||||
public final static TypedKey<Double> FORE_SHOULDER_LENGTH = new TypedKey<Double>("ForeShoulderLength", Double.class,
|
||||
public final static TypedKey<Double> FORE_SHOULDER_LENGTH = new TypedKey<>("ForeShoulderLength", Double.class,
|
||||
UnitGroup.UNITS_LENGTH);
|
||||
public final static TypedKey<Double> FORE_SHOULDER_DIAMETER = new TypedKey<Double>("ForeShoulderDiameter",
|
||||
public final static TypedKey<Double> FORE_SHOULDER_DIAMETER = new TypedKey<>("ForeShoulderDiameter",
|
||||
Double.class, UnitGroup.UNITS_LENGTH);
|
||||
public final static TypedKey<Double> FORE_OUTER_DIAMETER = new TypedKey<Double>("ForeOuterDiameter", Double.class,
|
||||
public final static TypedKey<Double> FORE_OUTER_DIAMETER = new TypedKey<>("ForeOuterDiameter", Double.class,
|
||||
UnitGroup.UNITS_LENGTH);
|
||||
public final static TypedKey<Double> AFT_SHOULDER_LENGTH = new TypedKey<Double>("AftShoulderLength", Double.class,
|
||||
public final static TypedKey<Double> AFT_SHOULDER_LENGTH = new TypedKey<>("AftShoulderLength", Double.class,
|
||||
UnitGroup.UNITS_LENGTH);
|
||||
public final static TypedKey<Double> AFT_SHOULDER_DIAMETER = new TypedKey<Double>("AftShoulderDiameter",
|
||||
public final static TypedKey<Double> AFT_SHOULDER_DIAMETER = new TypedKey<>("AftShoulderDiameter",
|
||||
Double.class, UnitGroup.UNITS_LENGTH);
|
||||
public final static TypedKey<Double> AFT_OUTER_DIAMETER = new TypedKey<Double>("AftOuterDiameter", Double.class,
|
||||
public final static TypedKey<Double> AFT_OUTER_DIAMETER = new TypedKey<>("AftOuterDiameter", Double.class,
|
||||
UnitGroup.UNITS_LENGTH);
|
||||
public static final TypedKey<Double> CD = new TypedKey<Double>("DragCoefficient", Double.class,
|
||||
public static final TypedKey<Double> CD = new TypedKey<>("DragCoefficient", Double.class,
|
||||
UnitGroup.UNITS_COEFFICIENT);
|
||||
public final static TypedKey<Shape> SHAPE = new TypedKey<Shape>("Shape", Shape.class);
|
||||
public final static TypedKey<Material> MATERIAL = new TypedKey<Material>("Material", Material.class);
|
||||
public final static TypedKey<Finish> FINISH = new TypedKey<Finish>("Finish", Finish.class);
|
||||
public final static TypedKey<Double> THICKNESS = new TypedKey<Double>("Thickness", Double.class,
|
||||
public final static TypedKey<Shape> SHAPE = new TypedKey<>("Shape", Shape.class);
|
||||
public final static TypedKey<Material> MATERIAL = new TypedKey<>("Material", Material.class);
|
||||
public final static TypedKey<Finish> FINISH = new TypedKey<>("Finish", Finish.class);
|
||||
public final static TypedKey<Double> THICKNESS = new TypedKey<>("Thickness", Double.class,
|
||||
UnitGroup.UNITS_LENGTH);
|
||||
public final static TypedKey<Boolean> FILLED = new TypedKey<Boolean>("Filled", Boolean.class);
|
||||
public final static TypedKey<Double> MASS = new TypedKey<Double>("Mass", Double.class, UnitGroup.UNITS_MASS);
|
||||
public final static TypedKey<Double> DIAMETER = new TypedKey<Double>("Diameter", Double.class,
|
||||
public final static TypedKey<Boolean> FILLED = new TypedKey<>("Filled", Boolean.class);
|
||||
public final static TypedKey<Double> MASS = new TypedKey<>("Mass", Double.class, UnitGroup.UNITS_MASS);
|
||||
public final static TypedKey<Double> DIAMETER = new TypedKey<>("Diameter", Double.class,
|
||||
UnitGroup.UNITS_LENGTH);
|
||||
public final static TypedKey<byte[]> IMAGE = new TypedKey<byte[]>("Image", byte[].class);
|
||||
public final static TypedKey<byte[]> IMAGE = new TypedKey<>("Image", byte[].class);
|
||||
|
||||
// RAIL BUTTON SPECIFIC
|
||||
public final static TypedKey<Double> BASE_HEIGHT = new TypedKey<Double>("BaseHeight", Double.class,
|
||||
public final static TypedKey<Double> BASE_HEIGHT = new TypedKey<>("BaseHeight", Double.class,
|
||||
UnitGroup.UNITS_LENGTH);
|
||||
public final static TypedKey<Double> FLANGE_HEIGHT = new TypedKey<Double>("FlangeHeight", Double.class,
|
||||
public final static TypedKey<Double> FLANGE_HEIGHT = new TypedKey<>("FlangeHeight", Double.class,
|
||||
UnitGroup.UNITS_LENGTH);
|
||||
public final static TypedKey<Double> SCREW_HEIGHT = new TypedKey<Double>("ScrewHeight", Double.class,
|
||||
public final static TypedKey<Double> SCREW_HEIGHT = new TypedKey<>("ScrewHeight", Double.class,
|
||||
UnitGroup.UNITS_LENGTH);
|
||||
public final static TypedKey<Double> SCREW_MASS = new TypedKey<Double>("ScrewMass", Double.class,
|
||||
public final static TypedKey<Double> SCREW_MASS = new TypedKey<>("ScrewMass", Double.class,
|
||||
UnitGroup.UNITS_MASS);
|
||||
public final static TypedKey<Double> NUT_MASS = new TypedKey<Double>("NutMass", Double.class, UnitGroup.UNITS_MASS);
|
||||
public final static TypedKey<Double> NUT_MASS = new TypedKey<>("NutMass", Double.class, UnitGroup.UNITS_MASS);
|
||||
|
||||
// PARACHUTE SPECIFIC
|
||||
// Parachute Manufacturer declaration see: MANUFACTURER
|
||||
// Parachute Part Number declaration see: PARTNO
|
||||
// Parachute Description declaration see: DESCRIPTION
|
||||
public final static TypedKey<Shape> CANOPY_SHAPE = new TypedKey<Shape>("CanopyShape", Shape.class);
|
||||
public final static TypedKey<Shape> CANOPY_SHAPE = new TypedKey<>("CanopyShape", Shape.class);
|
||||
// Parachute diameter declaration see: DIAMETER
|
||||
public final static TypedKey<Double> SPILL_DIA = new TypedKey<Double>("SpillDia", Double.class,
|
||||
public final static TypedKey<Double> SPILL_DIA = new TypedKey<>("SpillDia", Double.class,
|
||||
UnitGroup.UNITS_LENGTH);
|
||||
public final static TypedKey<Double> SURFACE_AREA = new TypedKey<Double>("SurfaceArea", Double.class,
|
||||
public final static TypedKey<Double> SURFACE_AREA = new TypedKey<>("SurfaceArea", Double.class,
|
||||
UnitGroup.UNITS_LENGTH);
|
||||
|
||||
// Parachute canopy material declaration see: MATERIAL
|
||||
public final static TypedKey<Integer> SIDES = new TypedKey<Integer>("Sides", Integer.class);
|
||||
public final static TypedKey<Integer> LINE_COUNT = new TypedKey<Integer>("LineCount", Integer.class);
|
||||
public final static TypedKey<Double> LINE_LENGTH = new TypedKey<Double>("LineLength", Double.class,
|
||||
public final static TypedKey<Integer> SIDES = new TypedKey<>("Sides", Integer.class);
|
||||
public final static TypedKey<Integer> LINE_COUNT = new TypedKey<>("LineCount", Integer.class);
|
||||
public final static TypedKey<Double> LINE_LENGTH = new TypedKey<>("LineLength", Double.class,
|
||||
UnitGroup.UNITS_LENGTH);
|
||||
public final static TypedKey<Material> LINE_MATERIAL = new TypedKey<Material>("LineMaterial", Material.class);
|
||||
public final static TypedKey<Double> PACKED_LENGTH = new TypedKey<Double>("PackedLength", Double.class,
|
||||
public final static TypedKey<Material> LINE_MATERIAL = new TypedKey<>("LineMaterial", Material.class);
|
||||
public final static TypedKey<Double> PACKED_LENGTH = new TypedKey<>("PackedLength", Double.class,
|
||||
UnitGroup.UNITS_LENGTH);
|
||||
public final static TypedKey<Double> PACKED_DIAMETER = new TypedKey<Double>("PackedDiameter", Double.class,
|
||||
public final static TypedKey<Double> PACKED_DIAMETER = new TypedKey<>("PackedDiameter", Double.class,
|
||||
UnitGroup.UNITS_LENGTH);
|
||||
// Parachute Mass declaration see: MASS
|
||||
|
||||
@ -410,9 +410,9 @@ public class ComponentPreset implements Comparable<ComponentPreset>, Serializabl
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
DataOutputStream os = new DataOutputStream(bos);
|
||||
|
||||
List<TypedKey<?>> keys = new ArrayList<TypedKey<?>>(properties.keySet());
|
||||
List<TypedKey<?>> keys = new ArrayList<>(properties.keySet());
|
||||
|
||||
Collections.sort(keys, new Comparator<TypedKey<?>>() {
|
||||
Collections.sort(keys, new Comparator<>() {
|
||||
@Override
|
||||
public int compare(TypedKey<?> a, TypedKey<?> b) {
|
||||
return a.getName().compareTo(b.getName());
|
||||
@ -481,7 +481,7 @@ public class ComponentPreset implements Comparable<ComponentPreset>, Serializabl
|
||||
}
|
||||
|
||||
private void writeObject(ObjectOutputStream oos) throws IOException {
|
||||
Map<String, Object> DTO = new HashMap<String, Object>();
|
||||
Map<String, Object> DTO = new HashMap<>();
|
||||
|
||||
for (Entry<TypedKey<?>, Object> entry : properties.entrySet()) {
|
||||
|
||||
|
@ -5,8 +5,8 @@ import java.util.List;
|
||||
|
||||
public class InvalidComponentPresetException extends Exception {
|
||||
|
||||
private final List<String> errors = new ArrayList<String>();
|
||||
private final List<TypedKey<?>> invalidParameters = new ArrayList<TypedKey<?>>();
|
||||
private final List<String> errors = new ArrayList<>();
|
||||
private final List<TypedKey<?>> invalidParameters = new ArrayList<>();
|
||||
|
||||
public InvalidComponentPresetException() {
|
||||
super();
|
||||
|
@ -11,7 +11,7 @@ public class TypedPropertyMap implements Cloneable {
|
||||
private final Map<TypedKey<?>, Object> delegate;
|
||||
|
||||
public TypedPropertyMap() {
|
||||
delegate = new LinkedHashMap<TypedKey<?>, Object>();
|
||||
delegate = new LinkedHashMap<>();
|
||||
}
|
||||
|
||||
public int size() {
|
||||
|
@ -15,7 +15,7 @@ public abstract class BaseComponentLoader extends RockSimComponentFileLoader {
|
||||
|
||||
public BaseComponentLoader(MaterialHolder materials, File theBasePathToLoadFrom) {
|
||||
super(theBasePathToLoadFrom);
|
||||
presets = new ArrayList<ComponentPreset>();
|
||||
presets = new ArrayList<>();
|
||||
|
||||
fileColumns.add(new ManufacturerColumnParser());
|
||||
fileColumns.add(new StringColumnParser("Part No.", ComponentPreset.PARTNO));
|
||||
|
@ -16,7 +16,7 @@ public abstract class BaseUnitColumnParser extends BaseColumnParser {
|
||||
protected static Map<String, Unit> rocksimUnits;
|
||||
|
||||
static {
|
||||
rocksimUnits = new HashMap<String, Unit>();
|
||||
rocksimUnits = new HashMap<>();
|
||||
rocksimUnits.put("0", UnitGroup.UNITS_LENGTH.getUnit("in"));
|
||||
rocksimUnits.put("1", UnitGroup.UNITS_LENGTH.getUnit("mm"));
|
||||
}
|
||||
|
@ -13,11 +13,11 @@ import info.openrocket.core.unit.UnitGroup;
|
||||
|
||||
public class MaterialHolder {
|
||||
|
||||
private final Map<String, Material.Bulk> bulkMaterials = new HashMap<String, Material.Bulk>();
|
||||
private final Map<String, Material.Bulk> bulkMaterials = new HashMap<>();
|
||||
|
||||
private final Map<String, Material.Surface> surfaceMaterials = new HashMap<String, Material.Surface>();
|
||||
private final Map<String, Material.Surface> surfaceMaterials = new HashMap<>();
|
||||
|
||||
private final Map<String, Material.Line> lineMaterials = new HashMap<String, Material.Line>();
|
||||
private final Map<String, Material.Line> lineMaterials = new HashMap<>();
|
||||
|
||||
public MaterialHolder() {
|
||||
}
|
||||
@ -108,7 +108,7 @@ public class MaterialHolder {
|
||||
|
||||
public Collection<Material> values() {
|
||||
|
||||
HashSet<Material> allMats = new HashSet<Material>();
|
||||
HashSet<Material> allMats = new HashSet<>();
|
||||
allMats.addAll(bulkMaterials.values());
|
||||
allMats.addAll(surfaceMaterials.values());
|
||||
allMats.addAll(lineMaterials.values());
|
||||
@ -118,7 +118,7 @@ public class MaterialHolder {
|
||||
}
|
||||
|
||||
public Database<Material> asDatabase(Material.Type theType) {
|
||||
Database<Material> result = new Database<Material>();
|
||||
Database<Material> result = new Database<>();
|
||||
switch (theType) {
|
||||
case LINE:
|
||||
result.addAll(lineMaterials.values());
|
||||
|
@ -12,9 +12,9 @@ public class MaterialLoader extends RockSimComponentFileLoader {
|
||||
|
||||
private final MaterialHolder materialMap = new MaterialHolder();
|
||||
|
||||
private final static TypedKey<String> MATERIALNAME = new TypedKey<String>("MaterialName", String.class);
|
||||
private final static TypedKey<String> UNITS = new TypedKey<String>("Units", String.class);
|
||||
private final static TypedKey<Double> DENSITY = new TypedKey<Double>("Density", Double.class);
|
||||
private final static TypedKey<String> MATERIALNAME = new TypedKey<>("MaterialName", String.class);
|
||||
private final static TypedKey<String> UNITS = new TypedKey<>("Units", String.class);
|
||||
private final static TypedKey<Double> DENSITY = new TypedKey<>("Density", Double.class);
|
||||
|
||||
public MaterialLoader(File theBasePathToLoadFrom) {
|
||||
super(theBasePathToLoadFrom);
|
||||
|
@ -33,7 +33,7 @@ public abstract class RockSimComponentFileLoader {
|
||||
|
||||
private final File dir;
|
||||
|
||||
protected List<RockSimComponentFileColumnParser> fileColumns = new ArrayList<RockSimComponentFileColumnParser>();
|
||||
protected List<RockSimComponentFileColumnParser> fileColumns = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -30,7 +30,7 @@ public class OpenRocketComponentDTO {
|
||||
|
||||
@XmlElementWrapper(name = "Materials")
|
||||
@XmlElement(name = "Material")
|
||||
List<MaterialDTO> materials = new ArrayList<MaterialDTO>();
|
||||
List<MaterialDTO> materials = new ArrayList<>();
|
||||
|
||||
@XmlElementWrapper(name = "Components")
|
||||
@XmlElementRefs({
|
||||
@ -45,7 +45,7 @@ public class OpenRocketComponentDTO {
|
||||
@XmlElementRef(name = "RailButtons", type = RailButtonDTO.class),
|
||||
@XmlElementRef(name = "Streamers", type = StreamerDTO.class),
|
||||
@XmlElementRef(name = "Parachutes", type = ParachuteDTO.class) })
|
||||
private List<BaseComponentDTO> components = new ArrayList<BaseComponentDTO>();
|
||||
private List<BaseComponentDTO> components = new ArrayList<>();
|
||||
|
||||
public OpenRocketComponentDTO() {
|
||||
}
|
||||
@ -97,7 +97,7 @@ public class OpenRocketComponentDTO {
|
||||
}
|
||||
|
||||
public List<ComponentPreset> asComponentPresets() throws InvalidComponentPresetException {
|
||||
List<ComponentPreset> result = new ArrayList<ComponentPreset>(components.size());
|
||||
List<ComponentPreset> result = new ArrayList<>(components.size());
|
||||
for (int i = 0; i < components.size(); i++) {
|
||||
result.add(components.get(i).asComponentPreset(getLegacy(), materials));
|
||||
}
|
||||
@ -105,7 +105,7 @@ public class OpenRocketComponentDTO {
|
||||
}
|
||||
|
||||
public List<Material> asMaterialList() {
|
||||
List<Material> result = new ArrayList<Material>(materials.size());
|
||||
List<Material> result = new ArrayList<>(materials.size());
|
||||
for (MaterialDTO material : materials) {
|
||||
result.add(material.asMaterial());
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ public class OpenRocketComponentSaver {
|
||||
// We're going to sort the initial data since that makes the output much easier
|
||||
// on the eyes.
|
||||
|
||||
Collections.sort(theMaterialList, new Comparator<Material>() {
|
||||
Collections.sort(theMaterialList, new Comparator<>() {
|
||||
|
||||
@Override
|
||||
public int compare(Material o1, Material o2) {
|
||||
@ -86,7 +86,7 @@ public class OpenRocketComponentSaver {
|
||||
|
||||
});
|
||||
|
||||
Collections.sort(thePresetList, new Comparator<ComponentPreset>() {
|
||||
Collections.sort(thePresetList, new Comparator<>() {
|
||||
|
||||
@Override
|
||||
public int compare(ComponentPreset o1, ComponentPreset o2) {
|
||||
|
@ -18,7 +18,7 @@ public class AxialStage extends ComponentAssembly implements FlightConfigurableC
|
||||
* default constructor, builds a rocket with zero stages
|
||||
*/
|
||||
public AxialStage() {
|
||||
this.separations = new FlightConfigurableParameterSet<StageSeparationConfiguration>(
|
||||
this.separations = new FlightConfigurableParameterSet<>(
|
||||
new StageSeparationConfiguration());
|
||||
this.axialMethod = AxialMethod.AFTER;
|
||||
this.stageNumber = 0;
|
||||
@ -93,7 +93,7 @@ public class AxialStage extends ComponentAssembly implements FlightConfigurableC
|
||||
@Override
|
||||
protected RocketComponent copyWithOriginalID() {
|
||||
AxialStage copy = (AxialStage) super.copyWithOriginalID();
|
||||
copy.separations = new FlightConfigurableParameterSet<StageSeparationConfiguration>(separations);
|
||||
copy.separations = new FlightConfigurableParameterSet<>(separations);
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ public class ClusterConfiguration {
|
||||
throw new IllegalArgumentException("Illegal number of points specified: " +
|
||||
points.length);
|
||||
}
|
||||
List<Double> l = new ArrayList<Double>(points.length);
|
||||
List<Double> l = new ArrayList<>(points.length);
|
||||
for (double d : points)
|
||||
l.add(d);
|
||||
|
||||
@ -108,7 +108,7 @@ public class ClusterConfiguration {
|
||||
public List<Double> getPoints(double rotation) {
|
||||
double cos = Math.cos(rotation);
|
||||
double sin = Math.sin(rotation);
|
||||
List<Double> ret = new ArrayList<Double>(points.size());
|
||||
List<Double> ret = new ArrayList<>(points.size());
|
||||
for (int i = 0; i < points.size() / 2; i++) {
|
||||
double x = points.get(2 * i);
|
||||
double y = points.get(2 * i + 1);
|
||||
|
@ -22,7 +22,7 @@ public class FlightConfigurableParameterSet<E extends FlightConfigurableParamete
|
||||
|
||||
// private static final Logger log =
|
||||
// LoggerFactory.getLogger(ParameterSet.class);
|
||||
protected final LinkedHashMap<FlightConfigurationId, E> map = new LinkedHashMap<FlightConfigurationId, E>();
|
||||
protected final LinkedHashMap<FlightConfigurationId, E> map = new LinkedHashMap<>();
|
||||
|
||||
/**
|
||||
* Construct a FlightConfiguration that has no overrides.
|
||||
@ -153,7 +153,7 @@ public class FlightConfigurableParameterSet<E extends FlightConfigurableParamete
|
||||
* @return a sorted list of all the contained FlightConfigurationIDs
|
||||
*/
|
||||
public List<FlightConfigurationId> getIds() {
|
||||
ArrayList<FlightConfigurationId> toReturn = new ArrayList<FlightConfigurationId>();
|
||||
ArrayList<FlightConfigurationId> toReturn = new ArrayList<>();
|
||||
|
||||
toReturn.addAll(this.map.keySet());
|
||||
toReturn.remove(FlightConfigurationId.DEFAULT_VALUE_FCID);
|
||||
|
@ -65,9 +65,9 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
||||
/* Cached data */
|
||||
final protected Map<Integer, StageFlags> stages = new HashMap<>(); // Map of stage number to StageFlags of the
|
||||
// corresponding stage
|
||||
final protected Map<MotorConfigurationId, MotorConfiguration> motors = new HashMap<MotorConfigurationId, MotorConfiguration>();
|
||||
final protected Map<MotorConfigurationId, MotorConfiguration> motors = new HashMap<>();
|
||||
private Map<Integer, Boolean> preloadStageActiveness = null;
|
||||
final private Collection<MotorConfiguration> activeMotors = new ConcurrentLinkedQueue<MotorConfiguration>();
|
||||
final private Collection<MotorConfiguration> activeMotors = new ConcurrentLinkedQueue<>();
|
||||
final private InstanceMap activeInstances = new InstanceMap();
|
||||
final private InstanceMap extraRenderInstances = new InstanceMap(); // Extra instances to be rendered, besides the
|
||||
// active instances
|
||||
@ -321,7 +321,7 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
||||
}
|
||||
|
||||
public Collection<RocketComponent> getAllComponents() {
|
||||
List<RocketComponent> traversalOrder = new ArrayList<RocketComponent>();
|
||||
List<RocketComponent> traversalOrder = new ArrayList<>();
|
||||
recurseAllComponentsDepthFirst(this.rocket, traversalOrder);
|
||||
return traversalOrder;
|
||||
}
|
||||
@ -339,7 +339,7 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
||||
* NOTE: components, NOT instances
|
||||
*/
|
||||
public ArrayList<RocketComponent> getCoreComponents() {
|
||||
Queue<RocketComponent> toProcess = new ArrayDeque<RocketComponent>();
|
||||
Queue<RocketComponent> toProcess = new ArrayDeque<>();
|
||||
toProcess.offer(this.rocket);
|
||||
|
||||
ArrayList<RocketComponent> toReturn = new ArrayList<>();
|
||||
@ -377,7 +377,7 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
||||
// recommend migrating to either: `getAllComponents` or `getActiveInstances`
|
||||
@Deprecated
|
||||
public Collection<RocketComponent> getActiveComponents() {
|
||||
Queue<RocketComponent> toProcess = new ArrayDeque<RocketComponent>(this.getActiveStages());
|
||||
Queue<RocketComponent> toProcess = new ArrayDeque<>(this.getActiveStages());
|
||||
ArrayList<RocketComponent> toReturn = new ArrayList<>();
|
||||
|
||||
while (!toProcess.isEmpty()) {
|
||||
|
@ -221,7 +221,7 @@ public class LaunchLug extends Tube implements AnglePositionable, BoxBounded, Li
|
||||
|
||||
@Override
|
||||
public Collection<Coordinate> getComponentBounds() {
|
||||
ArrayList<Coordinate> set = new ArrayList<Coordinate>();
|
||||
ArrayList<Coordinate> set = new ArrayList<>();
|
||||
addBound(set, 0, radius);
|
||||
addBound(set, length, radius);
|
||||
return set;
|
||||
|
@ -235,7 +235,7 @@ public abstract class MassObject extends InternalComponent {
|
||||
|
||||
@Override
|
||||
public final Collection<Coordinate> getComponentBounds() {
|
||||
Collection<Coordinate> c = new ArrayList<Coordinate>();
|
||||
Collection<Coordinate> c = new ArrayList<>();
|
||||
addBound(c, 0, getRadius());
|
||||
addBound(c, getLength(), getRadius());
|
||||
return c;
|
||||
|
@ -49,7 +49,7 @@ public class ParallelStage extends AxialStage implements FlightConfigurableCompo
|
||||
// not strictly accurate, but this should provide an acceptable estimate for total vehicle size
|
||||
@Override
|
||||
public Collection<Coordinate> getComponentBounds() {
|
||||
Collection<Coordinate> bounds = new ArrayList<Coordinate>(8);
|
||||
Collection<Coordinate> bounds = new ArrayList<>(8);
|
||||
double x_min = Double.MAX_VALUE;
|
||||
double x_max = Double.MIN_VALUE;
|
||||
double r_max = 0;
|
||||
|
@ -353,7 +353,7 @@ public class RailButton extends ExternalComponent
|
||||
@Override
|
||||
public Collection<Coordinate> getComponentBounds() {
|
||||
final double r = outerDiameter_m / 2.0;
|
||||
ArrayList<Coordinate> set = new ArrayList<Coordinate>();
|
||||
ArrayList<Coordinate> set = new ArrayList<>();
|
||||
set.add(new Coordinate(r, totalHeight_m, r));
|
||||
set.add(new Coordinate(r, totalHeight_m, -r));
|
||||
set.add(new Coordinate(r, 0, r));
|
||||
|
@ -203,7 +203,7 @@ public abstract class RingComponent extends StructuralComponent implements BoxBo
|
||||
|
||||
@Override
|
||||
public Collection<Coordinate> getComponentBounds() {
|
||||
List<Coordinate> bounds = new ArrayList<Coordinate>();
|
||||
List<Coordinate> bounds = new ArrayList<>();
|
||||
addBound(bounds, 0, getOuterRadius());
|
||||
addBound(bounds, length, getOuterRadius());
|
||||
return bounds;
|
||||
|
@ -486,7 +486,7 @@ public class Rocket extends ComponentAssembly {
|
||||
*/
|
||||
public void resetListeners() {
|
||||
// System.out.println("RESETTING LISTENER LIST of Rocket "+this);
|
||||
listenerList = new HashSet<EventListener>();
|
||||
listenerList = new HashSet<>();
|
||||
}
|
||||
|
||||
|
||||
|
@ -70,7 +70,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
|
||||
/**
|
||||
* List of child components of this component.
|
||||
*/
|
||||
protected ArrayList<RocketComponent> children = new ArrayList<RocketComponent>();
|
||||
protected ArrayList<RocketComponent> children = new ArrayList<>();
|
||||
|
||||
|
||||
//////// Parameters common to all components:
|
||||
@ -438,7 +438,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
|
||||
|
||||
// Reset all parent/child information
|
||||
clone.parent = null;
|
||||
clone.children = new ArrayList<RocketComponent>();
|
||||
clone.children = new ArrayList<>();
|
||||
|
||||
// Add copied children to the structure without firing events.
|
||||
for (RocketComponent child : this.children) {
|
||||
@ -2960,7 +2960,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
|
||||
*/
|
||||
private static class RocketComponentIterator implements Iterator<RocketComponent> {
|
||||
// Stack holds iterators which still have some components left.
|
||||
private final Deque<Iterator<RocketComponent>> iteratorStack = new ArrayDeque<Iterator<RocketComponent>>();
|
||||
private final Deque<Iterator<RocketComponent>> iteratorStack = new ArrayDeque<>();
|
||||
|
||||
private final Rocket root;
|
||||
private final ModID treeModID;
|
||||
|
@ -174,7 +174,7 @@ public abstract class SymmetricComponent extends BodyComponent implements BoxBou
|
||||
*/
|
||||
@Override
|
||||
public Collection<Coordinate> getComponentBounds() {
|
||||
List<Coordinate> list = new ArrayList<Coordinate>(20);
|
||||
List<Coordinate> list = new ArrayList<>(20);
|
||||
for (int n = 0; n <= 5; n++) {
|
||||
double x = n * getLength() / 5;
|
||||
double r = getRadius(x);
|
||||
|
@ -360,7 +360,7 @@ public class TubeFinSet extends Tube implements AxialPositionable, BoxBounded, R
|
||||
|
||||
@Override
|
||||
public Collection<Coordinate> getComponentBounds() {
|
||||
List<Coordinate> bounds = new ArrayList<Coordinate>();
|
||||
List<Coordinate> bounds = new ArrayList<>();
|
||||
double r = getBodyRadius();
|
||||
|
||||
addBound(bounds, 0, 2 * getBoundingRadius());
|
||||
|
@ -8,7 +8,7 @@ import info.openrocket.core.rocketcomponent.RocketComponent;
|
||||
public class ListComponents<T extends RocketComponent> extends DepthFirstRecursiveVisitor<List<T>> {
|
||||
|
||||
private final Class<T> componentClazz;
|
||||
protected List<T> components = new ArrayList<T>();
|
||||
protected List<T> components = new ArrayList<>();
|
||||
|
||||
public ListComponents(Class<T> componentClazz) {
|
||||
super();
|
||||
|
@ -57,7 +57,7 @@ public class BasicEventSimulationEngine implements SimulationEngine {
|
||||
private FlightConfigurationId fcid;
|
||||
|
||||
// this is just a list of simulation branches to
|
||||
Deque<SimulationStatus> toSimulate = new ArrayDeque<SimulationStatus>();
|
||||
Deque<SimulationStatus> toSimulate = new ArrayDeque<>();
|
||||
|
||||
FlightData flightData;
|
||||
|
||||
@ -202,7 +202,7 @@ public class BasicEventSimulationEngine implements SimulationEngine {
|
||||
if (!currentStatus.isLanded())
|
||||
currentStatus.addEvent(new FlightEvent(FlightEvent.Type.ALTITUDE, currentStatus.getSimulationTime(),
|
||||
currentStatus.getConfiguration().getRocket(),
|
||||
new Pair<Double, Double>(oldAlt, currentStatus.getRocketPosition().z)));
|
||||
new Pair<>(oldAlt, currentStatus.getRocketPosition().z)));
|
||||
|
||||
if (currentStatus.getRocketPosition().z > currentStatus.getMaxAlt()) {
|
||||
currentStatus.setMaxAlt(currentStatus.getRocketPosition().z);
|
||||
|
@ -40,7 +40,7 @@ public class FlightData {
|
||||
|
||||
private final Mutable mutable = new Mutable();
|
||||
|
||||
private final ArrayList<FlightDataBranch> branches = new ArrayList<FlightDataBranch>();
|
||||
private final ArrayList<FlightDataBranch> branches = new ArrayList<>();
|
||||
|
||||
private final WarningSet warnings = new WarningSet();
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class FlightDataBranch implements Monitorable {
|
||||
*/
|
||||
private double optimumAltitude = Double.NaN;
|
||||
|
||||
private final ArrayList<FlightEvent> events = new ArrayList<FlightEvent>();
|
||||
private final ArrayList<FlightEvent> events = new ArrayList<>();
|
||||
|
||||
private final Mutable mutable = new Mutable();
|
||||
|
||||
@ -73,7 +73,7 @@ public class FlightDataBranch implements Monitorable {
|
||||
"times in constructor.");
|
||||
}
|
||||
|
||||
values.put(t, new ArrayList<Double>());
|
||||
values.put(t, new ArrayList<>());
|
||||
minValues.put(t, Double.NaN);
|
||||
maxValues.put(t, Double.NaN);
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public class FlightDataType implements Comparable<FlightDataType> {
|
||||
|
||||
/** List of existing types. MUST BE DEFINED BEFORE ANY TYPES!! */
|
||||
/** NOTE: The String key here is now the symbol */
|
||||
private static final Map<String, FlightDataType> EXISTING_TYPES = new HashMap<String, FlightDataType>();
|
||||
private static final Map<String, FlightDataType> EXISTING_TYPES = new HashMap<>();
|
||||
|
||||
//// Time
|
||||
public static final FlightDataType TYPE_TIME = newType(trans.get("FlightDataType.TYPE_TIME"), "t",
|
||||
|
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