From 141decb4d3cd781a4b963dfe1ba6c2b47a923aac Mon Sep 17 00:00:00 2001 From: soupwizard Date: Wed, 12 Dec 2012 00:43:32 -0800 Subject: [PATCH] fix about 100 build warnings by add @Override, a couple other warning fixes --- .../file/motor/AbstractMotorLoader.java | 1 + .../sf/openrocket/file/motor/MotorLoader.java | 1 + .../file/rocksim/importt/BodyTubeHandler.java | 1 + .../rocksim/importt/MassObjectHandler.java | 1 + .../file/rocksim/importt/NoseConeHandler.java | 1 + .../rocksim/importt/ParachuteHandler.java | 1 + .../importt/RecoveryDeviceHandler.java | 1 + .../rocksim/importt/TransitionHandler.java | 1 + .../sf/openrocket/gui/TextFieldListener.java | 5 ++ .../gui/components/ColorChooser.java | 3 + .../gui/components/UnitSelector.java | 8 +++ .../gui/dialogs/ComponentAnalysisDialog.java | 1 + .../openrocket/gui/figureelements/Caret.java | 2 + .../gui/main/ComponentAddButtons.java | 2 + .../openrocket/gui/main/ComponentIcons.java | 24 ++++--- .../gui/main/MRUDesignFileAction.java | 2 + .../sf/openrocket/gui/main/RocketActions.java | 1 + .../openrocket/gui/main/UndoRedoAction.java | 1 + .../openrocket/gui/preset/ButtonColumn.java | 11 ++- .../gui/preset/ComponentPresetEditor.java | 7 +- .../gui/preset/ImagePreviewPanel.java | 23 +++--- .../sf/openrocket/gui/print/PrintUnit.java | 72 +++++++++---------- .../gui/print/components/CheckBoxNode.java | 1 + .../components/CheckTreeSelectionModel.java | 3 + .../openrocket/gui/print/components/Rule.java | 1 + .../InterpolatingAtmosphericModel.java | 1 + .../SimulationModifier.java | 1 + .../openrocket/rocketcomponent/BodyTube.java | 1 + .../sf/openrocket/simulation/EventQueue.java | 1 + .../SimulationComputationListener.java | 1 + .../listeners/example/DampingMoment.java | 2 + .../openrocket/startup/SerializeMotors.java | 19 ++--- .../sf/openrocket/unit/FixedUnitGroup.java | 4 ++ 33 files changed, 140 insertions(+), 65 deletions(-) diff --git a/core/src/net/sf/openrocket/file/motor/AbstractMotorLoader.java b/core/src/net/sf/openrocket/file/motor/AbstractMotorLoader.java index b166706f8..365a47d53 100644 --- a/core/src/net/sf/openrocket/file/motor/AbstractMotorLoader.java +++ b/core/src/net/sf/openrocket/file/motor/AbstractMotorLoader.java @@ -22,6 +22,7 @@ public abstract class AbstractMotorLoader implements MotorLoader { * This method delegates the reading to the loaded from the Reader using the charset * returned by {@link #getDefaultCharset()}. */ + @Override public List load(InputStream stream, String filename) throws IOException { return load(new InputStreamReader(stream, getDefaultCharset()), filename); } diff --git a/core/src/net/sf/openrocket/file/motor/MotorLoader.java b/core/src/net/sf/openrocket/file/motor/MotorLoader.java index 73e140391..46b3fb16a 100644 --- a/core/src/net/sf/openrocket/file/motor/MotorLoader.java +++ b/core/src/net/sf/openrocket/file/motor/MotorLoader.java @@ -19,6 +19,7 @@ public interface MotorLoader extends Loader { * @return a list of motors contained in the file. * @throws IOException if an I/O exception occurs of the file format is invalid. */ + @Override public List load(InputStream stream, String filename) throws IOException; } diff --git a/core/src/net/sf/openrocket/file/rocksim/importt/BodyTubeHandler.java b/core/src/net/sf/openrocket/file/rocksim/importt/BodyTubeHandler.java index a528f8d1f..8997768a5 100644 --- a/core/src/net/sf/openrocket/file/rocksim/importt/BodyTubeHandler.java +++ b/core/src/net/sf/openrocket/file/rocksim/importt/BodyTubeHandler.java @@ -98,6 +98,7 @@ class BodyTubeHandler extends BaseHandler { * * @return BULK */ + @Override public Material.Type getMaterialType() { return Material.Type.BULK; } diff --git a/core/src/net/sf/openrocket/file/rocksim/importt/MassObjectHandler.java b/core/src/net/sf/openrocket/file/rocksim/importt/MassObjectHandler.java index 2d918af9a..cc2ddee49 100644 --- a/core/src/net/sf/openrocket/file/rocksim/importt/MassObjectHandler.java +++ b/core/src/net/sf/openrocket/file/rocksim/importt/MassObjectHandler.java @@ -187,6 +187,7 @@ class MassObjectHandler extends PositionDependentHandler { * * @param position the OpenRocket position */ + @Override public void setRelativePosition(RocketComponent.Position position) { current.setRelativePosition(position); } diff --git a/core/src/net/sf/openrocket/file/rocksim/importt/NoseConeHandler.java b/core/src/net/sf/openrocket/file/rocksim/importt/NoseConeHandler.java index b2f07c128..49de907c0 100644 --- a/core/src/net/sf/openrocket/file/rocksim/importt/NoseConeHandler.java +++ b/core/src/net/sf/openrocket/file/rocksim/importt/NoseConeHandler.java @@ -147,6 +147,7 @@ class NoseConeHandler extends BaseHandler { * * @return BULK */ + @Override public Material.Type getMaterialType() { return Material.Type.BULK; } diff --git a/core/src/net/sf/openrocket/file/rocksim/importt/ParachuteHandler.java b/core/src/net/sf/openrocket/file/rocksim/importt/ParachuteHandler.java index cc47e24e5..1dc5dc8cc 100644 --- a/core/src/net/sf/openrocket/file/rocksim/importt/ParachuteHandler.java +++ b/core/src/net/sf/openrocket/file/rocksim/importt/ParachuteHandler.java @@ -113,6 +113,7 @@ class ParachuteHandler extends RecoveryDeviceHandler { * * @return a component */ + @Override public Parachute getComponent() { return chute; } diff --git a/core/src/net/sf/openrocket/file/rocksim/importt/RecoveryDeviceHandler.java b/core/src/net/sf/openrocket/file/rocksim/importt/RecoveryDeviceHandler.java index 35aea771b..bf608a01f 100644 --- a/core/src/net/sf/openrocket/file/rocksim/importt/RecoveryDeviceHandler.java +++ b/core/src/net/sf/openrocket/file/rocksim/importt/RecoveryDeviceHandler.java @@ -61,6 +61,7 @@ public abstract class RecoveryDeviceHandler extends Po * @param rawDensity the density as specified in the Rocksim design file * @return a value in OpenRocket SURFACE density units */ + @Override protected double computeDensity(RocksimDensityType type, double rawDensity) { double result; diff --git a/core/src/net/sf/openrocket/file/rocksim/importt/TransitionHandler.java b/core/src/net/sf/openrocket/file/rocksim/importt/TransitionHandler.java index f4b1720a1..21ac5dcb4 100644 --- a/core/src/net/sf/openrocket/file/rocksim/importt/TransitionHandler.java +++ b/core/src/net/sf/openrocket/file/rocksim/importt/TransitionHandler.java @@ -151,6 +151,7 @@ class TransitionHandler extends BaseHandler { * * @return BULK */ + @Override public Material.Type getMaterialType() { return Material.Type.BULK; } diff --git a/core/src/net/sf/openrocket/gui/TextFieldListener.java b/core/src/net/sf/openrocket/gui/TextFieldListener.java index d07730046..4f53d0ea5 100644 --- a/core/src/net/sf/openrocket/gui/TextFieldListener.java +++ b/core/src/net/sf/openrocket/gui/TextFieldListener.java @@ -24,10 +24,15 @@ public abstract class TextFieldListener implements ActionListener, FocusListener public abstract void setText(String text); + @Override public void actionPerformed(ActionEvent e) { setText(field.getText()); } + + @Override public void focusGained(FocusEvent e) { } + + @Override public void focusLost(FocusEvent e) { setText(field.getText()); } diff --git a/core/src/net/sf/openrocket/gui/components/ColorChooser.java b/core/src/net/sf/openrocket/gui/components/ColorChooser.java index e149e3ca4..2c319d86e 100644 --- a/core/src/net/sf/openrocket/gui/components/ColorChooser.java +++ b/core/src/net/sf/openrocket/gui/components/ColorChooser.java @@ -60,6 +60,7 @@ public class ColorChooser extends JPanel { final JButton button = new JButton(COLOR_CHOOSER_BUTTON_LABEL); ActionListener actionListener = new ActionListener() { + @Override public void actionPerformed (ActionEvent actionEvent) { chooser.updateUI(); @@ -71,6 +72,7 @@ public class ColorChooser extends JPanel { // Wait until current event dispatching completes before showing // dialog Runnable showDialog = new Runnable() { + @Override public void run () { dialog.show(); } @@ -84,6 +86,7 @@ public class ColorChooser extends JPanel { // Add listener on model to detect changes to selected color ColorSelectionModel model = chooser.getSelectionModel(); model.addChangeListener(new ChangeListener() { + @Override public void stateChanged (ChangeEvent evt) { ColorSelectionModel model = (ColorSelectionModel) evt.getSource(); // Get the new color value diff --git a/core/src/net/sf/openrocket/gui/components/UnitSelector.java b/core/src/net/sf/openrocket/gui/components/UnitSelector.java index 1bdef68e5..04b45d2f2 100644 --- a/core/src/net/sf/openrocket/gui/components/UnitSelector.java +++ b/core/src/net/sf/openrocket/gui/components/UnitSelector.java @@ -244,10 +244,12 @@ public class UnitSelector extends StyledLabel implements StateChangeListener, Mo //////// ItemListener handling //////// + @Override public void addItemListener(ItemListener listener) { itemListeners.add(listener); } + @Override public void removeItemListener(ItemListener listener) { itemListeners.remove(listener); } @@ -301,6 +303,7 @@ public class UnitSelector extends StyledLabel implements StateChangeListener, Mo unit = u; } + @Override public void actionPerformed(ActionEvent e) { setSelectedUnit(unit); } @@ -316,23 +319,28 @@ public class UnitSelector extends StyledLabel implements StateChangeListener, Mo //////// Mouse handling //////// + @Override public void mouseClicked(MouseEvent e) { if (unitGroup.getUnitCount() > 1) popup(); } + @Override public void mouseEntered(MouseEvent e) { if (unitGroup.getUnitCount() > 1) setBorder(withinBorder); } + @Override public void mouseExited(MouseEvent e) { setBorder(normalBorder); } + @Override public void mousePressed(MouseEvent e) { } // Ignore + @Override public void mouseReleased(MouseEvent e) { } // Ignore diff --git a/core/src/net/sf/openrocket/gui/dialogs/ComponentAnalysisDialog.java b/core/src/net/sf/openrocket/gui/dialogs/ComponentAnalysisDialog.java index a12fbdf32..ec9896647 100644 --- a/core/src/net/sf/openrocket/gui/dialogs/ComponentAnalysisDialog.java +++ b/core/src/net/sf/openrocket/gui/dialogs/ComponentAnalysisDialog.java @@ -461,6 +461,7 @@ public class ComponentAnalysisDialog extends JDialog implements ChangeListener { //Close button button = new JButton(trans.get("dlg.but.close")); button.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { ComponentAnalysisDialog.this.dispose(); } diff --git a/core/src/net/sf/openrocket/gui/figureelements/Caret.java b/core/src/net/sf/openrocket/gui/figureelements/Caret.java index b82731ff2..2b80e27c4 100644 --- a/core/src/net/sf/openrocket/gui/figureelements/Caret.java +++ b/core/src/net/sf/openrocket/gui/figureelements/Caret.java @@ -29,6 +29,7 @@ public abstract class Caret implements FigureElement { /** * Paints the caret to the Graphics2D element. */ + @Override public void paint(Graphics2D g2, double scale) { Area caret = getCaret(); AffineTransform t = new AffineTransform(1.0/scale, 0, 0, 1.0/scale, x, y); @@ -39,6 +40,7 @@ public abstract class Caret implements FigureElement { } + @Override public void paint(Graphics2D g2, double scale, Rectangle visible) { throw new UnsupportedOperationException("paint() with rectangle unsupported."); } diff --git a/core/src/net/sf/openrocket/gui/main/ComponentAddButtons.java b/core/src/net/sf/openrocket/gui/main/ComponentAddButtons.java index fa92a671f..6c0818952 100644 --- a/core/src/net/sf/openrocket/gui/main/ComponentAddButtons.java +++ b/core/src/net/sf/openrocket/gui/main/ComponentAddButtons.java @@ -188,6 +188,7 @@ public class ComponentAddButtons extends JPanel implements Scrollable { viewport.addChangeListener(new ChangeListener() { private int oldWidth = -1; + @Override public void stateChanged(ChangeEvent e) { Dimension d = ComponentAddButtons.this.viewport.getExtentSize(); if (d.width != oldWidth) { @@ -356,6 +357,7 @@ public class ComponentAddButtons extends JPanel implements Scrollable { * Updates the enabled status of the button. * TODO: LOW: What about updates to the rocket tree? */ + @Override public void valueChanged(TreeSelectionEvent e) { updateEnabled(); } diff --git a/core/src/net/sf/openrocket/gui/main/ComponentIcons.java b/core/src/net/sf/openrocket/gui/main/ComponentIcons.java index b0071caaa..e952d59aa 100644 --- a/core/src/net/sf/openrocket/gui/main/ComponentIcons.java +++ b/core/src/net/sf/openrocket/gui/main/ComponentIcons.java @@ -148,16 +148,22 @@ public class ComponentIcons { icons[0] = new ImageIcon(bi, desc); // Create disabled icon - if (false) { // Fade using alpha + boolean useAlphaFade = false; // don't use fade to alpha yet + if (useAlphaFade) { // Fade using alpha - int rgb[] = bi2.getRGB(0, 0, bi2.getWidth(), bi2.getHeight(), null, 0, bi2.getWidth()); - for (int i = 0; i < rgb.length; i++) { - final int alpha = (rgb[i] >> 24) & 0xFF; - rgb[i] = (rgb[i] & 0xFFFFFF) | (alpha / 3) << 24; - - //rgb[i] = (rgb[i]&0xFFFFFF) | ((rgb[i]>>1)&0x3F000000); - } - bi2.setRGB(0, 0, bi2.getWidth(), bi2.getHeight(), rgb, 0, bi2.getWidth()); + /* TODO This code to do fade using alpha had been dead code inside a "if (false) {" block. + * Eclipse would give a build warning about dead code, so this code has been commented out + * but left here for future use; am assuming it was dead code because it wasn't working correctly + * but that it will be useful in the future. + */ + // int rgb[] = bi2.getRGB(0, 0, bi2.getWidth(), bi2.getHeight(), null, 0, bi2.getWidth()); + // for (int i = 0; i < rgb.length; i++) { + // final int alpha = (rgb[i] >> 24) & 0xFF; + // rgb[i] = (rgb[i] & 0xFFFFFF) | (alpha / 3) << 24; + // + // //rgb[i] = (rgb[i]&0xFFFFFF) | ((rgb[i]>>1)&0x3F000000); + // } + // bi2.setRGB(0, 0, bi2.getWidth(), bi2.getHeight(), rgb, 0, bi2.getWidth()); } else { // Raster alpha diff --git a/core/src/net/sf/openrocket/gui/main/MRUDesignFileAction.java b/core/src/net/sf/openrocket/gui/main/MRUDesignFileAction.java index 8757eaa26..0055f938f 100644 --- a/core/src/net/sf/openrocket/gui/main/MRUDesignFileAction.java +++ b/core/src/net/sf/openrocket/gui/main/MRUDesignFileAction.java @@ -34,6 +34,7 @@ public final class MRUDesignFileAction extends JMenu { parent = theParent; MRUDesignFile opts = MRUDesignFile.getInstance(); opts.addPropertyChangeListener(new PropertyChangeListener() { + @Override public void propertyChange(PropertyChangeEvent evt) { if (!evt.getPropertyName().equals(MRUDesignFile.MRU_FILE_LIST_PROPERTY)) { return; @@ -68,6 +69,7 @@ public final class MRUDesignFileAction extends JMenu { */ private Action createAction(String file) { Action action = new AbstractAction() { + @Override public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (BasicFrame.open(new File(command), parent)) { diff --git a/core/src/net/sf/openrocket/gui/main/RocketActions.java b/core/src/net/sf/openrocket/gui/main/RocketActions.java index a8da9c7ef..3c94930e1 100644 --- a/core/src/net/sf/openrocket/gui/main/RocketActions.java +++ b/core/src/net/sf/openrocket/gui/main/RocketActions.java @@ -276,6 +276,7 @@ public class RocketActions { /////// Action classes private abstract class RocketAction extends AbstractAction implements ClipboardListener { + @Override public abstract void clipboardChanged(); } diff --git a/core/src/net/sf/openrocket/gui/main/UndoRedoAction.java b/core/src/net/sf/openrocket/gui/main/UndoRedoAction.java index 08c31c7e7..f09f13799 100644 --- a/core/src/net/sf/openrocket/gui/main/UndoRedoAction.java +++ b/core/src/net/sf/openrocket/gui/main/UndoRedoAction.java @@ -70,6 +70,7 @@ public class UndoRedoAction extends AbstractAction implements UndoRedoListener { // Set all the values correctly (name and enabled/disabled status) + @Override public void setAllValues() { String name, desc; boolean actionEnabled; diff --git a/core/src/net/sf/openrocket/gui/preset/ButtonColumn.java b/core/src/net/sf/openrocket/gui/preset/ButtonColumn.java index 13b86535f..a44d26118 100644 --- a/core/src/net/sf/openrocket/gui/preset/ButtonColumn.java +++ b/core/src/net/sf/openrocket/gui/preset/ButtonColumn.java @@ -145,6 +145,7 @@ public class ButtonColumn extends AbstractCellEditor // // Implement TableCellRenderer interface // + @Override public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { @@ -194,6 +195,7 @@ public class ButtonColumn extends AbstractCellEditor /* * The button has been pressed. Stop editing and invoke the custom Action */ + @Override public void actionPerformed(ActionEvent e) { int row = table.convertRowIndexToModel( table.getEditingRow() ); @@ -216,6 +218,7 @@ public class ButtonColumn extends AbstractCellEditor * the mouse to another cell before releasing it, the editor is still * active. Make sure editing is stopped when the mouse is released. */ + @Override public void mousePressed(MouseEvent e) { if (table.isEditing() @@ -223,6 +226,7 @@ public class ButtonColumn extends AbstractCellEditor isButtonColumnEditor = true; } + @Override public void mouseReleased(MouseEvent e) { if (isButtonColumnEditor @@ -232,7 +236,12 @@ public class ButtonColumn extends AbstractCellEditor isButtonColumnEditor = false; } + @Override public void mouseClicked(MouseEvent e) {} - public void mouseEntered(MouseEvent e) {} + + @Override + public void mouseEntered(MouseEvent e) {} + + @Override public void mouseExited(MouseEvent e) {} } diff --git a/core/src/net/sf/openrocket/gui/preset/ComponentPresetEditor.java b/core/src/net/sf/openrocket/gui/preset/ComponentPresetEditor.java index fb95c4fcd..129469e0b 100644 --- a/core/src/net/sf/openrocket/gui/preset/ComponentPresetEditor.java +++ b/core/src/net/sf/openrocket/gui/preset/ComponentPresetEditor.java @@ -107,6 +107,7 @@ public class ComponentPresetEditor extends JPanel implements PresetResultListene add(scrollPane, "cell 0 0 6 1,grow"); table.addMouseListener(new MouseAdapter() { + @Override public void mouseClicked(MouseEvent e) { JTable target = (JTable) e.getSource(); int selectedColumn = table.getColumnModel().getColumnIndexAtX(target.getSelectedColumn()); @@ -200,6 +201,7 @@ public class ComponentPresetEditor extends JPanel implements PresetResultListene JMenuItem mntmExit = new JMenuItem("Close"); mnFile.add(mntmExit); mntmExit.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent arg0) { Window w = SwingUtilities.getWindowAncestor(ComponentPresetEditor.this); w.dispose(); @@ -303,6 +305,7 @@ public class ComponentPresetEditor extends JPanel implements PresetResultListene associated.clear(); } + @Override public void removeRow(int row) { super.removeRow(row); associated.remove(row); @@ -312,6 +315,7 @@ public class ComponentPresetEditor extends JPanel implements PresetResultListene return associated.get(row); } + @Override public boolean isCellEditable(int rowIndex, int mColIndex) { return false; } @@ -375,8 +379,9 @@ public class ComponentPresetEditor extends JPanel implements PresetResultListene } } catch (Exception e) { + String fileName = (file == null) ? "(file is null, can't get name)" : file.getName(); JOptionPane.showMessageDialog(ComponentPresetEditor.this, "Unable to open OpenRocket component file: " + - file.getName() + " Invalid format. " + e.getMessage()); + fileName + " Invalid format. " + e.getMessage()); editContext.setOpenedFile(null); editContext.setEditingSelected(false); return false; diff --git a/core/src/net/sf/openrocket/gui/preset/ImagePreviewPanel.java b/core/src/net/sf/openrocket/gui/preset/ImagePreviewPanel.java index bab36ec56..ff4c1e88f 100644 --- a/core/src/net/sf/openrocket/gui/preset/ImagePreviewPanel.java +++ b/core/src/net/sf/openrocket/gui/preset/ImagePreviewPanel.java @@ -25,6 +25,7 @@ public class ImagePreviewPanel extends JPanel bg = getBackground(); } + @Override public void propertyChange(PropertyChangeEvent e) { String propertyName = e.getPropertyName(); @@ -42,15 +43,18 @@ public class ImagePreviewPanel extends JPanel * Make reasonably sure we have an image format that AWT can * handle so we don't try to draw something silly. */ - if ((name != null) && - name.toLowerCase().endsWith(".jpg") || - name.toLowerCase().endsWith(".jpeg") || - name.toLowerCase().endsWith(".gif") || - name.toLowerCase().endsWith(".png")) { - icon = new ImageIcon(name); - image = icon.getImage(); - scaleImage(); - repaint(); + if (name != null) { + String nameLower = name.toLowerCase(); + if (nameLower.endsWith(".jpg") || + nameLower.endsWith(".jpeg") || + nameLower.endsWith(".gif") || + nameLower.endsWith(".png")) { + + icon = new ImageIcon(name); + image = icon.getImage(); + scaleImage(); + repaint(); + } } } } @@ -86,6 +90,7 @@ public class ImagePreviewPanel extends JPanel image = image.getScaledInstance(width, height, Image.SCALE_DEFAULT); } + @Override public void paintComponent(Graphics g) { g.setColor(bg); diff --git a/core/src/net/sf/openrocket/gui/print/PrintUnit.java b/core/src/net/sf/openrocket/gui/print/PrintUnit.java index 734e433bd..6374bb1f0 100644 --- a/core/src/net/sf/openrocket/gui/print/PrintUnit.java +++ b/core/src/net/sf/openrocket/gui/print/PrintUnit.java @@ -8,52 +8,52 @@ package net.sf.openrocket.gui.print; */ public enum PrintUnit { FOOT { - public double toInches(double d) { return d*12; } - public double toMillis(double d) { return d/FEET_PER_MM; } - public double toCentis(double d) { return d/(FEET_PER_MM*TEN); } - public double toMeters(double d) { return d/(FEET_PER_MM*TEN*TEN*TEN); } - public double toPoints(double d) { return (d * POINTS_PER_INCH * 12); } - public double convert(double d, PrintUnit u) { return u.toInches(d)/12; } + @Override public double toInches(double d) { return d*12; } + @Override public double toMillis(double d) { return d/FEET_PER_MM; } + @Override public double toCentis(double d) { return d/(FEET_PER_MM*TEN); } + @Override public double toMeters(double d) { return d/(FEET_PER_MM*TEN*TEN*TEN); } + @Override public double toPoints(double d) { return (d * POINTS_PER_INCH * 12); } + @Override public double convert(double d, PrintUnit u) { return u.toInches(d)/12; } }, INCHES { - public double toInches(double d) { return d; } - public double toMillis(double d) { return d/INCHES_PER_MM; } - public double toCentis(double d) { return d/(INCHES_PER_MM*TEN); } - public double toMeters(double d) { return d/(INCHES_PER_MM*TEN*TEN*TEN); } - public double toPoints(double d) { return (d * POINTS_PER_INCH); } - public double convert(double d, PrintUnit u) { return u.toInches(d); } + @Override public double toInches(double d) { return d; } + @Override public double toMillis(double d) { return d/INCHES_PER_MM; } + @Override public double toCentis(double d) { return d/(INCHES_PER_MM*TEN); } + @Override public double toMeters(double d) { return d/(INCHES_PER_MM*TEN*TEN*TEN); } + @Override public double toPoints(double d) { return (d * POINTS_PER_INCH); } + @Override public double convert(double d, PrintUnit u) { return u.toInches(d); } }, MILLIMETERS { - public double toInches(double d) { return d * INCHES_PER_MM; } - public double toMillis(double d) { return d; } - public double toCentis(double d) { return d/TEN; } - public double toMeters(double d) { return d/(TEN*TEN*TEN); } - public double toPoints(double d) { return INCHES.toPoints(toInches(d)); } - public double convert(double d, PrintUnit u) { return u.toMillis(d); } + @Override public double toInches(double d) { return d * INCHES_PER_MM; } + @Override public double toMillis(double d) { return d; } + @Override public double toCentis(double d) { return d/TEN; } + @Override public double toMeters(double d) { return d/(TEN*TEN*TEN); } + @Override public double toPoints(double d) { return INCHES.toPoints(toInches(d)); } + @Override public double convert(double d, PrintUnit u) { return u.toMillis(d); } }, CENTIMETERS { - public double toInches(double d) { return d * INCHES_PER_MM * TEN; } - public double toMillis(double d) { return d * TEN; } - public double toCentis(double d) { return d; } - public double toMeters(double d) { return d/(TEN*TEN); } - public double toPoints(double d) { return INCHES.toPoints(toInches(d)); } - public double convert(double d, PrintUnit u) { return u.toCentis(d); } + @Override public double toInches(double d) { return d * INCHES_PER_MM * TEN; } + @Override public double toMillis(double d) { return d * TEN; } + @Override public double toCentis(double d) { return d; } + @Override public double toMeters(double d) { return d/(TEN*TEN); } + @Override public double toPoints(double d) { return INCHES.toPoints(toInches(d)); } + @Override public double convert(double d, PrintUnit u) { return u.toCentis(d); } }, METERS { - public double toInches(double d) { return d * INCHES_PER_MM * TEN * TEN * TEN; } - public double toMillis(double d) { return d * TEN * TEN * TEN; } - public double toCentis(double d) { return d * TEN * TEN; } - public double toMeters(double d) { return d; } - public double toPoints(double d) { return INCHES.toPoints(toInches(d)); } - public double convert(double d, PrintUnit u) { return u.toMeters(d); } + @Override public double toInches(double d) { return d * INCHES_PER_MM * TEN * TEN * TEN; } + @Override public double toMillis(double d) { return d * TEN * TEN * TEN; } + @Override public double toCentis(double d) { return d * TEN * TEN; } + @Override public double toMeters(double d) { return d; } + @Override public double toPoints(double d) { return INCHES.toPoints(toInches(d)); } + @Override public double convert(double d, PrintUnit u) { return u.toMeters(d); } }, POINTS { - public double toInches(double d) { return d/POINTS_PER_INCH; } - public double toMillis(double d) { return d/(POINTS_PER_INCH * INCHES_PER_MM); } - public double toCentis(double d) { return toMillis(d)/TEN; } - public double toMeters(double d) { return toMillis(d)/(TEN*TEN*TEN); } - public double toPoints(double d) { return d; } - public double convert(double d, PrintUnit u) { return u.toPoints(d); } + @Override public double toInches(double d) { return d/POINTS_PER_INCH; } + @Override public double toMillis(double d) { return d/(POINTS_PER_INCH * INCHES_PER_MM); } + @Override public double toCentis(double d) { return toMillis(d)/TEN; } + @Override public double toMeters(double d) { return toMillis(d)/(TEN*TEN*TEN); } + @Override public double toPoints(double d) { return d; } + @Override public double convert(double d, PrintUnit u) { return u.toPoints(d); } }; // Handy constants for conversion methods diff --git a/core/src/net/sf/openrocket/gui/print/components/CheckBoxNode.java b/core/src/net/sf/openrocket/gui/print/components/CheckBoxNode.java index 7fbab0a69..367dbd80d 100644 --- a/core/src/net/sf/openrocket/gui/print/components/CheckBoxNode.java +++ b/core/src/net/sf/openrocket/gui/print/components/CheckBoxNode.java @@ -71,6 +71,7 @@ public class CheckBoxNode { * * @return the text label */ + @Override public String toString () { return text; } diff --git a/core/src/net/sf/openrocket/gui/print/components/CheckTreeSelectionModel.java b/core/src/net/sf/openrocket/gui/print/components/CheckTreeSelectionModel.java index 9f34b4b54..71f05bb8c 100644 --- a/core/src/net/sf/openrocket/gui/print/components/CheckTreeSelectionModel.java +++ b/core/src/net/sf/openrocket/gui/print/components/CheckTreeSelectionModel.java @@ -103,6 +103,7 @@ public class CheckTreeSelectionModel extends DefaultTreeSelectionModel { * * @param pPaths an array of paths */ + @Override public void setSelectionPaths (TreePath[] pPaths) { TreePath selected[] = getSelectionPaths(); for (TreePath aSelected : selected) { @@ -118,6 +119,7 @@ public class CheckTreeSelectionModel extends DefaultTreeSelectionModel { * * @param paths an array of tree path nodes */ + @Override public void addSelectionPaths (TreePath[] paths) { // deselect all descendants of paths[] for (TreePath path : paths) { @@ -195,6 +197,7 @@ public class CheckTreeSelectionModel extends DefaultTreeSelectionModel { * * @param paths the array of path nodes */ + @Override public void removeSelectionPaths (TreePath[] paths) { for (TreePath path : paths) { if (path.getPathCount() == 1) { diff --git a/core/src/net/sf/openrocket/gui/print/components/Rule.java b/core/src/net/sf/openrocket/gui/print/components/Rule.java index b26d65280..92e781c39 100644 --- a/core/src/net/sf/openrocket/gui/print/components/Rule.java +++ b/core/src/net/sf/openrocket/gui/print/components/Rule.java @@ -43,6 +43,7 @@ public class Rule extends PrintableComponent { * * @param g the opaque graphics context */ + @Override public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g; diff --git a/core/src/net/sf/openrocket/models/atmosphere/InterpolatingAtmosphericModel.java b/core/src/net/sf/openrocket/models/atmosphere/InterpolatingAtmosphericModel.java index 6a416a9a0..6b383b513 100644 --- a/core/src/net/sf/openrocket/models/atmosphere/InterpolatingAtmosphericModel.java +++ b/core/src/net/sf/openrocket/models/atmosphere/InterpolatingAtmosphericModel.java @@ -13,6 +13,7 @@ public abstract class InterpolatingAtmosphericModel implements AtmosphericModel private AtmosphericConditions[] levels = null; + @Override public AtmosphericConditions getConditions(double altitude) { if (levels == null) computeLayers(); diff --git a/core/src/net/sf/openrocket/optimization/rocketoptimization/SimulationModifier.java b/core/src/net/sf/openrocket/optimization/rocketoptimization/SimulationModifier.java index 6ed85a6e7..1989ea074 100644 --- a/core/src/net/sf/openrocket/optimization/rocketoptimization/SimulationModifier.java +++ b/core/src/net/sf/openrocket/optimization/rocketoptimization/SimulationModifier.java @@ -106,5 +106,6 @@ public interface SimulationModifier extends ChangeSource { * another rocket instance (e.g. the same modification on another rocket component that * has the same component ID). */ + @Override public boolean equals(Object obj); } diff --git a/core/src/net/sf/openrocket/rocketcomponent/BodyTube.java b/core/src/net/sf/openrocket/rocketcomponent/BodyTube.java index 65317a3c2..6b33ff3a1 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/BodyTube.java +++ b/core/src/net/sf/openrocket/rocketcomponent/BodyTube.java @@ -395,6 +395,7 @@ public class BodyTube extends SymmetricComponent implements MotorMount, Coaxial fireComponentChangeEvent(ComponentChangeEvent.MOTOR_CHANGE); } + @Deprecated @Override public int getMotorCount() { return 1; diff --git a/core/src/net/sf/openrocket/simulation/EventQueue.java b/core/src/net/sf/openrocket/simulation/EventQueue.java index 1ac9fb821..41c27d81d 100644 --- a/core/src/net/sf/openrocket/simulation/EventQueue.java +++ b/core/src/net/sf/openrocket/simulation/EventQueue.java @@ -52,6 +52,7 @@ public class EventQueue extends PriorityQueue implements Monitorabl return super.remove(o); } + @Override public int getModID() { return modID; } diff --git a/core/src/net/sf/openrocket/simulation/listeners/SimulationComputationListener.java b/core/src/net/sf/openrocket/simulation/listeners/SimulationComputationListener.java index 3089d0539..15e1b98da 100644 --- a/core/src/net/sf/openrocket/simulation/listeners/SimulationComputationListener.java +++ b/core/src/net/sf/openrocket/simulation/listeners/SimulationComputationListener.java @@ -67,5 +67,6 @@ public interface SimulationComputationListener extends SimulationListener { public double postSimpleThrustCalculation(SimulationStatus status, double thrust) throws SimulationException; + @Override public FlightDataType[] getFlightDataTypes(); } diff --git a/core/src/net/sf/openrocket/simulation/listeners/example/DampingMoment.java b/core/src/net/sf/openrocket/simulation/listeners/example/DampingMoment.java index b9d2e463a..c432d983d 100644 --- a/core/src/net/sf/openrocket/simulation/listeners/example/DampingMoment.java +++ b/core/src/net/sf/openrocket/simulation/listeners/example/DampingMoment.java @@ -26,6 +26,7 @@ public class DampingMoment extends AbstractSimulationListener { private static final FlightDataType type = FlightDataType.getType("Damping moment coefficient", "Cdm", UnitGroup.UNITS_COEFFICIENT); private static final FlightDataType[] typeList = {type}; + @Override public String getName(){ return "Damping moment listener"; } @@ -33,6 +34,7 @@ public class DampingMoment extends AbstractSimulationListener { /** * Return a list of any flight data types this listener creates. */ + @Override public FlightDataType[] getFlightDataTypes(){ return typeList; } diff --git a/core/src/net/sf/openrocket/startup/SerializeMotors.java b/core/src/net/sf/openrocket/startup/SerializeMotors.java index 2ffe1b5ab..cf22958f5 100644 --- a/core/src/net/sf/openrocket/startup/SerializeMotors.java +++ b/core/src/net/sf/openrocket/startup/SerializeMotors.java @@ -42,15 +42,16 @@ public class SerializeMotors { if (iterator == null) { System.out.println("Can't find resources-src/thrustcurves directory"); System.exit(1); - } - while (iterator.hasNext()) { - Pair f = iterator.next(); - String fileName = f.getU(); - InputStream is = f.getV(); - - List motors = loader.load(is, fileName); - - allMotors.addAll(motors); + } else { + while (iterator.hasNext()) { + Pair f = iterator.next(); + String fileName = f.getU(); + InputStream is = f.getV(); + + List motors = loader.load(is, fileName); + + allMotors.addAll(motors); + } } oos.writeObject(allMotors); diff --git a/core/src/net/sf/openrocket/unit/FixedUnitGroup.java b/core/src/net/sf/openrocket/unit/FixedUnitGroup.java index 8cb6fde49..111da92dd 100644 --- a/core/src/net/sf/openrocket/unit/FixedUnitGroup.java +++ b/core/src/net/sf/openrocket/unit/FixedUnitGroup.java @@ -16,18 +16,22 @@ public class FixedUnitGroup extends UnitGroup { this.unitString = unitString; } + @Override public int getUnitCount(){ return 1; } + @Override public Unit getDefaultUnit(){ return new GeneralUnit(1, unitString); } + @Override public Unit getSIUnit(){ return new GeneralUnit(1, unitString); } + @Override public boolean contains(Unit u){ return true; }