Ignore:
Timestamp:
24.01.2012 21:52:43 (4 months ago)
Author:
jttt
Message:

Use final were appropriate

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/coor/LatLon.java

    r4580 r4869  
    11// License: GPL. Copyright 2007 by Immanuel Scholz and others 
    22package org.openstreetmap.josm.data.coor; 
    3  
    4 import static org.openstreetmap.josm.tools.I18n.trc; 
    53 
    64import static java.lang.Math.PI; 
     
    119import static java.lang.Math.sqrt; 
    1210import static java.lang.Math.toRadians; 
     11import static org.openstreetmap.josm.tools.I18n.trc; 
    1312 
    1413import java.math.BigDecimal; 
     
    3029public class LatLon extends Coordinate { 
    3130 
    32      
     31 
    3332    /** 
    3433     * Minimum difference in location to not be represented as the same position. 
     
    4140    private static DecimalFormat cDmsSecondFormatter = new DecimalFormat("00.0"); 
    4241    private static DecimalFormat cDmMinuteFormatter = new DecimalFormat("00.000"); 
    43     public static DecimalFormat cDdFormatter; 
     42    public static final DecimalFormat cDdFormatter; 
    4443    static { 
    4544        // Don't use the localized decimal separator. This way we can present 
     
    6867        return lon >= -180d && lon <= 180d; 
    6968    } 
    70                       
    71         /** 
    72         * Replies true if lat is in the range [-90,90] and lon is in the range [-180,180] 
    73          *  
    74         * @return true if lat is in the range [-90,90] and lon is in the range [-180,180] 
    75         */ 
    76         public boolean isValid() { 
    77                 return isValidLat(lat()) && isValidLon(lon()); 
    78         } 
    79          
     69 
     70    /** 
     71    * Replies true if lat is in the range [-90,90] and lon is in the range [-180,180] 
     72     * 
     73    * @return true if lat is in the range [-90,90] and lon is in the range [-180,180] 
     74    */ 
     75    public boolean isValid() { 
     76        return isValidLat(lat()) && isValidLon(lon()); 
     77    } 
     78 
    8079    public static double toIntervalLat(double value) { 
    8180        if (value < -90) 
     
    8887    /** 
    8988     * Returns a valid OSM longitude [-180,+180] for the given extended longitude value. 
    90      * For example, a value of -181 will return +179, a value of +181 will return -179.  
     89     * For example, a value of -181 will return +179, a value of +181 will return -179. 
    9190     * @param lon A longitude value not restricted to the [-180,+180] range. 
    9291     */ 
    9392    public static double toIntervalLon(double value) { 
    94         if (isValidLon(value)) { 
     93        if (isValidLon(value)) 
    9594            return value; 
    96         } else { 
     95        else { 
    9796            int n = (int) (value + Math.signum(value)*180.0) / 360; 
    9897            return value - n*360.0; 
    9998        } 
    10099    } 
    101          
     100 
    102101    /** 
    103102     * Replies the coordinate in degrees/minutes/seconds format 
     
    180179        Bounds b = Main.getProjection().getWorldBoundsLatLon(); 
    181180        return lat() < b.getMin().lat() || lat() > b.getMax().lat() || 
    182         lon() < b.getMin().lon() || lon() > b.getMax().lon(); 
     181                lon() < b.getMin().lon() || lon() > b.getMax().lon(); 
    183182    } 
    184183 
     
    220219     * http://math.stackexchange.com/questions/720/how-to-calculate-a-heading-on-the-earths-surface 
    221220     * for some hints how it is derived.) 
    222      *  
     221     * 
    223222     * @param other the "destination" position 
    224223     * @return heading in the range 0 <= hd < 2*PI 
     
    233232        } 
    234233        return hd; 
    235      } 
     234    } 
    236235 
    237236    /** 
     
    258257        return "LatLon[lat="+lat()+",lon="+lon()+"]"; 
    259258    } 
    260      
     259 
    261260    /** 
    262261     * Returns the value rounded to OSM precisions, i.e. to 
     
    278277    public static double roundToOsmPrecisionStrict(double value) { 
    279278        double absV = Math.abs(value); 
    280         int numOfDigits = MAX_SERVER_DIGITS + (absV < 1 ? 0 : (absV < 10 ? 1 : (absV < 100 ? 2 : 3)));  
     279        int numOfDigits = MAX_SERVER_DIGITS + (absV < 1 ? 0 : (absV < 10 ? 1 : (absV < 100 ? 2 : 3))); 
    281280        return BigDecimal.valueOf(value).round(new MathContext(numOfDigits)).doubleValue(); 
    282281    } 
     
    292291                roundToOsmPrecision(lat()), 
    293292                roundToOsmPrecision(lon()) 
    294         ); 
     293                ); 
    295294    } 
    296295 
     
    305304                roundToOsmPrecisionStrict(lat()), 
    306305                roundToOsmPrecisionStrict(lon()) 
    307         ); 
     306                ); 
    308307    } 
    309308 
Note: See TracChangeset for help on using the changeset viewer.