Browse Source

Fix some more stupid if statements (and one stupid switch!)

Change-Id: I730c5ff1a917dde84994870d6495c473609a62b4
Reviewed-on: http://gerrit.dmdirc.com/341
Reviewed-by: Gregory Holmes <greboid@dmdirc.com>
Tested-by: Gregory Holmes <greboid@dmdirc.com>
tags/0.6.3
Chris Smith 14 years ago
parent
commit
92d0ecd612

+ 1
- 6
src/com/dmdirc/addons/parser_twitter/Twitter.java View File

472
     /** {@inheritDoc} */
472
     /** {@inheritDoc} */
473
     @Override
473
     @Override
474
     public boolean isUserSettable(final char mode) {
474
     public boolean isUserSettable(final char mode) {
475
-        switch (mode) {
476
-            case 'b':
477
-                return true;
478
-            default:
479
-                return false;
480
-        }
475
+        return mode == 'b';
481
     }
476
     }
482
 
477
 
483
     /** {@inheritDoc} */
478
     /** {@inheritDoc} */

+ 2
- 5
src/com/dmdirc/addons/ui_swing/components/addonbrowser/AddonFilter.java View File

76
             Entry<? extends DefaultTableModel, ? extends Integer> entry) {
76
             Entry<? extends DefaultTableModel, ? extends Integer> entry) {
77
         AddonInfo info = ((AddonInfoLabel) entry.getModel().getValueAt(entry.
77
         AddonInfo info = ((AddonInfoLabel) entry.getModel().getValueAt(entry.
78
                 getIdentifier(), 0)).getAddonInfo();
78
                 getIdentifier(), 0)).getAddonInfo();
79
-        if ((!verifiedBox.isSelected() && info.isVerified()) ||
79
+        return !((!verifiedBox.isSelected() && info.isVerified()) ||
80
                 (!unverifiedBox.isSelected() && !info.isVerified()) ||
80
                 (!unverifiedBox.isSelected() && !info.isVerified()) ||
81
                 (!installedBox.isSelected() && info.isInstalled()) ||
81
                 (!installedBox.isSelected() && info.isInstalled()) ||
82
                 (!notinstalledBox.isSelected() &&
82
                 (!notinstalledBox.isSelected() &&
86
                 AddonType.TYPE_THEME) ||
86
                 AddonType.TYPE_THEME) ||
87
                 (!actionsBox.isSelected() && info.getType() ==
87
                 (!actionsBox.isSelected() && info.getType() ==
88
                 AddonType.TYPE_ACTION_PACK) || (!searchBox.getText().
88
                 AddonType.TYPE_ACTION_PACK) || (!searchBox.getText().
89
-                isEmpty() && !info.matches(searchBox.getText()))) {
90
-            return false;
91
-        }
92
-        return true;
89
+                isEmpty() && !info.matches(searchBox.getText())));
93
     }
90
     }
94
 }
91
 }

+ 3
- 13
src/com/dmdirc/addons/ui_swing/components/reorderablelist/ArrayListTransferHandler.java View File

204
     /** {@inheritDoc} */
204
     /** {@inheritDoc} */
205
     @Override
205
     @Override
206
     public boolean canImport(final JComponent comp, final DataFlavor[] transferFlavors) {
206
     public boolean canImport(final JComponent comp, final DataFlavor[] transferFlavors) {
207
-        if (!(comp instanceof JList) || !(((JList) comp).getModel() instanceof DefaultListModel)) {
208
-            return false;
209
-        }
210
-
211
-        if (hasLocalArrayListFlavor(transferFlavors)) {
212
-            return true;
213
-        }
214
-
215
-        if (hasSerialArrayListFlavor(transferFlavors)) {
216
-            return true;
217
-        }
218
-
219
-        return false;
207
+        return comp instanceof JList && ((JList) comp).getModel() instanceof DefaultListModel
208
+                && (hasLocalArrayListFlavor(transferFlavors)
209
+                || hasSerialArrayListFlavor(transferFlavors));
220
     }
210
     }
221
 
211
 
222
     /** {@inheritDoc} */
212
     /** {@inheritDoc} */

+ 2
- 9
src/com/dmdirc/addons/ui_swing/components/reorderablelist/ArrayListTransferable.java View File

84
     /** {@inheritDoc} */
84
     /** {@inheritDoc} */
85
     @Override
85
     @Override
86
     public boolean isDataFlavorSupported(final DataFlavor flavor) {
86
     public boolean isDataFlavorSupported(final DataFlavor flavor) {
87
-        if (localArrayListFlavor.equals(flavor)) {
88
-            return true;
89
-        }
90
-        
91
-        if (serialArrayListFlavor.equals(flavor)) {
92
-            return true;
93
-        }
94
-        
95
-        return false;
87
+        return localArrayListFlavor.equals(flavor)
88
+                || serialArrayListFlavor.equals(flavor);
96
     }
89
     }
97
 }
90
 }

+ 1
- 9
src/com/dmdirc/addons/ui_swing/dialogs/actioneditor/StringTransferable.java View File

71
     /** {@inheritDoc} */
71
     /** {@inheritDoc} */
72
     @Override
72
     @Override
73
     public boolean isDataFlavorSupported(final DataFlavor flavor) {
73
     public boolean isDataFlavorSupported(final DataFlavor flavor) {
74
-        if (localStringFlavor.equals(flavor)) {
75
-            return true;
76
-        }
77
-
78
-        if (serialStringFlavor.equals(flavor)) {
79
-            return true;
80
-        }
81
-
82
-        return false;
74
+        return localStringFlavor.equals(flavor) || serialStringFlavor.equals(flavor);
83
     }
75
     }
84
 
76
 
85
     /** 
77
     /** 

Loading…
Cancel
Save