Ignore:
Timestamp:
2015-05-11T10:52:33+02:00 (10 years ago)
Author:
Don-vip
Message:

code style - Useless parentheses around expressions should be removed to prevent any misunderstanding

Location:
trunk/src/org/openstreetmap/josm/tools
Files:
5 edited

Legend:

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

    r6830 r8345  
    3232                    Integer.parseInt(html.substring(2,4),16),
    3333                    Integer.parseInt(html.substring(4,6),16),
    34                     (html.length() == 8 ? Integer.parseInt(html.substring(6,8),16) : 255));
     34                    html.length() == 8 ? Integer.parseInt(html.substring(6,8),16) : 255);
    3535        } catch (NumberFormatException e) {
    3636            return null;
  • trunk/src/org/openstreetmap/josm/tools/Geometry.java

    r8342 r8345  
    449449        CheckParameterUtil.ensureValidCoordinates(secondNode, "secondNode");
    450450
    451         double dy1 = (firstNode.getY() - commonNode.getY());
    452         double dy2 = (secondNode.getY() - commonNode.getY());
    453         double dx1 = (firstNode.getX() - commonNode.getX());
    454         double dx2 = (secondNode.getX() - commonNode.getX());
     451        double dy1 = firstNode.getY() - commonNode.getY();
     452        double dy2 = secondNode.getY() - commonNode.getY();
     453        double dx1 = firstNode.getX() - commonNode.getX();
     454        double dx2 = secondNode.getX() - commonNode.getX();
    455455
    456456        return dy1 * dx2 - dx1 * dy2 > 0;
     
    651651        dlat = lat2 - lat1;
    652652
    653         double a = (Math.pow(Math.sin(dlat/2), 2) + Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin(dlon/2), 2));
     653        double a = Math.pow(Math.sin(dlat/2), 2) + Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin(dlon/2), 2);
    654654        double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
    655655        return 6367000 * c;
     
    668668        dlat = lat2 - lat1;
    669669
    670         double a = (Math.pow(Math.sin(dlat/2), 2) + Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin(dlon/2), 2));
     670        double a = Math.pow(Math.sin(dlat/2), 2) + Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin(dlon/2), 2);
    671671        double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
    672672        return 6367000 * c;
  • trunk/src/org/openstreetmap/josm/tools/I18n.java

    r8292 r8345  
    694694        switch(pluralMode) {
    695695        case MODE_NOTONE: /* bg, da, de, el, en, en_GB, es, et, eu, fi, gl, is, it, iw_IL, nb, nl, sv */
    696             return ((n != 1) ? 1 : 0);
     696            return (n != 1) ? 1 : 0;
    697697        case MODE_NONE: /* id, ja, km, tr, zh_CN, zh_TW */
    698698            return 0;
    699699        case MODE_GREATERONE: /* fr, pt_BR */
    700             return ((n > 1) ? 1 : 0);
     700            return (n > 1) ? 1 : 0;
    701701        case MODE_CS:
    702             return ((n == 1) ? 0 : (((n >= 2) && (n <= 4)) ? 1 : 2));
     702            return (n == 1) ? 0 : (((n >= 2) && (n <= 4)) ? 1 : 2);
    703703        //case MODE_AR:
    704704        //    return ((n == 0) ? 0 : ((n == 1) ? 1 : ((n == 2) ? 2 : ((((n % 100) >= 3)
    705705        //            && ((n % 100) <= 10)) ? 3 : ((((n % 100) >= 11) && ((n % 100) <= 99)) ? 4 : 5)))));
    706706        case MODE_PL:
    707             return ((n == 1) ? 0 : (((((n % 10) >= 2) && ((n % 10) <= 4))
    708                     && (((n % 100) < 10) || ((n % 100) >= 20))) ? 1 : 2));
     707            return (n == 1) ? 0 : (((((n % 10) >= 2) && ((n % 10) <= 4))
     708                    && (((n % 100) < 10) || ((n % 100) >= 20))) ? 1 : 2);
    709709        //case MODE_RO:
    710710        //    return ((n == 1) ? 0 : ((((n % 100) > 19) || (((n % 100) == 0) && (n != 0))) ? 2 : 1));
    711711        case MODE_LT:
    712             return (((n % 10) == 1) && ((n % 100) != 11) ? 0 : (((n % 10) >= 2)
    713                     && (((n % 100) < 10) || ((n % 100) >= 20)) ? 1 : 2));
     712            return ((n % 10) == 1) && ((n % 100) != 11) ? 0 : (((n % 10) >= 2)
     713                    && (((n % 100) < 10) || ((n % 100) >= 20)) ? 1 : 2);
    714714        case MODE_RU:
    715             return ((((n % 10) == 1) && ((n % 100) != 11)) ? 0 : (((((n % 10) >= 2)
    716                     && ((n % 10) <= 4)) && (((n % 100) < 10) || ((n % 100) >= 20))) ? 1 : 2));
     715            return (((n % 10) == 1) && ((n % 100) != 11)) ? 0 : (((((n % 10) >= 2)
     716                    && ((n % 10) <= 4)) && (((n % 100) < 10) || ((n % 100) >= 20))) ? 1 : 2);
    717717        case MODE_SK:
    718             return ((n == 1) ? 1 : (((n >= 2) && (n <= 4)) ? 2 : 0));
     718            return (n == 1) ? 1 : (((n >= 2) && (n <= 4)) ? 2 : 0);
    719719        //case MODE_SL:
    720720        //    return (((n % 100) == 1) ? 1 : (((n % 100) == 2) ? 2 : ((((n % 100) == 3)
  • trunk/src/org/openstreetmap/josm/tools/OsmUrlToBounds.java

    r8338 r8345  
    291291    public static String getURL(double dlat, double dlon, int zoom) {
    292292        // Truncate lat and lon to something more sensible
    293         int decimals = (int) Math.pow(10, (zoom / 3));
    294         double lat = (Math.round(dlat * decimals));
     293        int decimals = (int) Math.pow(10, zoom / 3);
     294        double lat = Math.round(dlat * decimals);
    295295        lat /= decimals;
    296         double lon = (Math.round(dlon * decimals));
     296        double lon = Math.round(dlon * decimals);
    297297        lon /= decimals;
    298298        return Main.getOSMWebsite() + "/#map="+zoom+"/"+lat+"/"+lon;
  • trunk/src/org/openstreetmap/josm/tools/Shortcut.java

    r8338 r8345  
    148148    // create a shortcut object from an string as saved in the preferences
    149149    private Shortcut(String prefString) {
    150         List<String> s = (new ArrayList<>(Main.pref.getCollection(prefString)));
     150        List<String> s = new ArrayList<>(Main.pref.getCollection(prefString));
    151151        this.shortText = prefString.substring(15);
    152152        this.longText = s.get(0);
Note: See TracChangeset for help on using the changeset viewer.