Changeset 9074 in josm for trunk/src/org


Ignore:
Timestamp:
2015-11-30T23:30:47+01:00 (4 years ago)
Author:
Don-vip
Message:

pmd - Ternary operator with a boolean literal can be simplified with a boolean expression

Location:
trunk/src/org/openstreetmap/josm
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/Main.java

    r9059 r9074  
    16171617     */
    16181618    public static boolean addMapFrameListener(MapFrameListener listener, boolean fireWhenMapViewPresent) {
    1619         boolean changed = listener != null ? mapFrameListeners.add(listener) : false;
     1619        boolean changed = listener != null && mapFrameListeners.add(listener);
    16201620        if (fireWhenMapViewPresent && changed && map != null) {
    16211621            listener.mapFrameInitialized(null, map);
     
    16411641     */
    16421642    public static boolean removeMapFrameListener(MapFrameListener listener) {
    1643         return listener != null ? mapFrameListeners.remove(listener) : false;
     1643        return listener != null && mapFrameListeners.remove(listener);
    16441644    }
    16451645
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java

    r9067 r9074  
    15481548                    nearestAngle = getNearestAngle(angle);
    15491549                    if (getAngleDelta(nearestAngle, angle) < snapAngleTolerance) {
    1550                         active = (customBaseHeading >= 0) ? true : Math.abs(nearestAngle - 180) > 1e-3;
     1550                        active = customBaseHeading >= 0 || Math.abs(nearestAngle - 180) > 1e-3;
    15511551                        // if angle is to previous segment, exclude 180 degrees
    15521552                        lastAngle = nearestAngle;
  • trunk/src/org/openstreetmap/josm/data/Preferences.java

    r9070 r9074  
    788788    public synchronized boolean getBoolean(final String key) {
    789789        String s = get(key, null);
    790         return s == null ? false : Boolean.parseBoolean(s);
     790        return s != null && Boolean.parseBoolean(s);
    791791    }
    792792
  • trunk/src/org/openstreetmap/josm/gui/HelpAwareOptionPane.java

    r9059 r9074  
    102102
    103103        private boolean addChangeListener(ChangeListener listener) {
    104             return listener != null ? listeners.add(listener) : false;
     104            return listener != null && listeners.add(listener);
    105105        }
    106106    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java

    r8958 r9074  
    762762    protected void setIsDocked(boolean val) {
    763763        if (buttonsPanel != null) {
    764             buttonsPanel.setVisible(val ? buttonHiding != ButtonHidingType.ALWAYS_HIDDEN : true);
     764            buttonsPanel.setVisible(!val || buttonHiding != ButtonHidingType.ALWAYS_HIDDEN);
    765765        }
    766766        isDocked = val;
  • trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java

    r8958 r9074  
    792792
    793793            if (canEnable) {
    794                 cbActive = new JCheckBox(tr("active"), e != null ? e.active : true);
     794                cbActive = new JCheckBox(tr("active"), e == null || e.active);
    795795                p.add(cbActive, GBC.eol().insets(15, 0, 5, 0));
    796796            }
  • trunk/src/org/openstreetmap/josm/gui/widgets/MultiSplitLayout.java

    r8870 r9074  
    11151115        public final boolean isVertical() {
    11161116            Split parent = parent_get();
    1117             return (parent != null) ? parent.isRowLayout() : false;
     1117            return parent != null && parent.isRowLayout();
    11181118        }
    11191119
  • trunk/src/org/openstreetmap/josm/tools/MultiMap.java

    r8846 r9074  
    148148    public boolean contains(A key, B value) {
    149149        Set<B> values = get(key);
    150         return (values == null) ? false : values.contains(value);
     150        return values != null && values.contains(value);
    151151    }
    152152
Note: See TracChangeset for help on using the changeset viewer.