Changeset 9976 in josm for trunk/src/org/openstreetmap/josm


Ignore:
Timestamp:
2016-03-13T00:38:12+01:00 (8 years ago)
Author:
Don-vip
Message:

sonar - code simplification

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/BBox.java

    r9372 r9976  
    153153     */
    154154    public boolean bounds(BBox b) {
    155         if (!(xmin <= b.xmin) ||
    156                 !(xmax >= b.xmax) ||
    157                 !(ymin <= b.ymin) ||
    158                 !(ymax >= b.ymax))
    159             return false;
    160         return true;
     155        return xmin <= b.xmin && xmax >= b.xmax
     156            && ymin <= b.ymin && ymax >= b.ymax;
    161157    }
    162158
     
    167163     */
    168164    public boolean bounds(LatLon c) {
    169         if ((xmin <= c.lon()) &&
    170                 (xmax >= c.lon()) &&
    171                 (ymin <= c.lat()) &&
    172                 (ymax >= c.lat()))
    173             return true;
    174         return false;
     165        return xmin <= c.lon() && xmax >= c.lon()
     166            && ymin <= c.lat() && ymax >= c.lat();
    175167    }
    176168
  • trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java

    r9954 r9976  
    13231323     * @param osm node to check
    13241324     * @param p point clicked
    1325      * @param use_selected whether to prefer selected nodes
     1325     * @param useSelected whether to prefer selected nodes
    13261326     * @return true, if the node fulfills the properties of the function body
    13271327     */
    1328     private boolean isPrecedenceNode(Node osm, Point p, boolean use_selected) {
     1328    private boolean isPrecedenceNode(Node osm, Point p, boolean useSelected) {
    13291329        if (osm != null) {
    1330             if (!(p.distanceSq(getPoint2D(osm)) > (4)*(4))) return true;
     1330            if (p.distanceSq(getPoint2D(osm)) <= (4*4)) return true;
    13311331            if (osm.isTagged()) return true;
    1332             if (use_selected && osm.isSelected()) return true;
     1332            if (useSelected && osm.isSelected()) return true;
    13331333        }
    13341334        return false;
  • trunk/src/org/openstreetmap/josm/gui/preferences/imagery/CacheContentsPanel.java

    r9078 r9976  
    243243
    244244    private static DefaultTableModel getTableModel(final CacheAccess<String, BufferedImageCacheEntry> cache) {
    245         final DefaultTableModel tableModel = new DefaultTableModel(
     245        return new DefaultTableModel(
    246246                getCacheStats(cache),
    247247                new String[]{tr("Cache name"), tr("Object Count"), tr("Clear")}) {
     
    251251            }
    252252        };
    253         return tableModel;
    254253    }
    255254}
Note: See TracChangeset for help on using the changeset viewer.