Ignore:
Timestamp:
2012-01-24T21:52:43+01:00 (12 years ago)
Author:
jttt
Message:

Use final were appropriate

Location:
trunk/src/org/openstreetmap/josm/data
Files:
23 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
  • trunk/src/org/openstreetmap/josm/data/imagery/OffsetBookmark.java

    r4126 r4869  
    2020
    2121public class OffsetBookmark {
    22     public static List<OffsetBookmark> allBookmarks = new ArrayList<OffsetBookmark>();
     22    public static final List<OffsetBookmark> allBookmarks = new ArrayList<OffsetBookmark>();
    2323
    2424    public Projection proj;
  • trunk/src/org/openstreetmap/josm/data/osm/QuadBuckets.java

    r4409 r4869  
    5757    }
    5858
    59     public static int MAX_OBJECTS_PER_LEVEL = 16;
     59    public static final int MAX_OBJECTS_PER_LEVEL = 16;
    6060    class QBLevel
    6161    {
     
    312312                    continue;
    313313                }
    314                 if (found_me) {
     314                if (found_me)
    315315                    /*if (debug) {
    316316                        out("[" + this.level + "] next sibling was child nr: " + nr);
    317317                    }*/
    318318                    return sibling;
    319                 }
    320                 /*if (debug) {
    321                     out("[" + this.level + "] nr: " + nr + " is before me, ignoring...");
    322                 }*/
    323319            }
    324320            return null;
     
    405401                System.out.print("[" + level + "] qb bbox: " + this.bbox() + " ");
    406402            }*/
    407             if (!this.bbox().intersects(search_bbox)) {
     403            if (!this.bbox().intersects(search_bbox))
    408404                /*if (debug) {
    409405                    out("miss " + Long.toHexString(this.quad));
     
    411407                }*/
    412408                return;
    413             } else if (bbox().bounds(search_bbox)) {
     409            else if (bbox().bounds(search_bbox)) {
    414410                search_cache = this;
    415411            }
     
    632628        public boolean hasNext()
    633629        {
    634             if (this.peek() == null) {
     630            if (this.peek() == null)
    635631                /*if (debug) {
    636632                    out(this + " no hasNext(), but iterated over so far: " + iterated_over);
    637633                }*/
    638634                return false;
    639             }
    640635            return true;
    641636        }
    642637        T peek()
    643638        {
    644             if (current_node == null) {
     639            if (current_node == null)
    645640                /*if (debug) {
    646641                    out("null current leaf, nowhere to go");
    647642                }*/
    648643                return null;
    649             }
    650644            while((current_node.content == null) ||
    651645                    (content_index >= current_node.content.size())) {
     
    659653                }
    660654            }
    661             if (current_node == null || current_node.content == null) {
     655            if (current_node == null || current_node.content == null)
    662656                /*if (debug) {
    663657                    out("late nowhere to go " + current_node);
    664658                }*/
    665659                return null;
    666             }
    667660            return current_node.content.get(content_index);
    668661        }
  • trunk/src/org/openstreetmap/josm/data/projection/GaussKrueger.java

    r4304 r4869  
    2222public class GaussKrueger extends AbstractProjection implements ProjectionSubPrefs {
    2323
    24     public static int DEFAULT_ZONE = 2;
     24    public static final int DEFAULT_ZONE = 2;
    2525    private int zone;
    26    
    27     private static Bounds[] bounds = { 
     26
     27    private static Bounds[] bounds = {
    2828        new Bounds(new LatLon(-5, 3.5), new LatLon(85, 8.5)),
    2929        new Bounds(new LatLon(-5, 6.5), new LatLon(85, 11.5)),
     
    3333
    3434    private static NTV2GridShiftFile BETA2007 = null;
    35    
     35
    3636    private static String[] zones = { "2", "3", "4", "5" };
    3737
     
    4545                String gridFileName = "BETA2007.gsb";
    4646                InputStream is = Main.class.getResourceAsStream("/data/"+gridFileName);
    47                 if (is == null) {
     47                if (is == null)
    4848                    throw new RuntimeException(tr("Error: failed to open input stream for resource ''/data/{0}''.", gridFileName));
    49                 }
    5049                BETA2007 = new NTV2GridShiftFile();
    5150                BETA2007.loadGridShiftFile(is, false);
     
    7069    }
    7170
    72     @Override 
     71    @Override
    7372    public String toString() {
    7473        return tr("Gau\u00DF-Kr\u00FCger");
    7574    }
    76    
     75
    7776    @Override
    7877    public Integer getEpsgCode() {
     
    8988        return bounds[zone-2];
    9089    }
    91    
     90
    9291    @Override
    9392    public void setupPreferencePanel(JPanel p, ActionListener listener) {
     
    106105        }
    107106    }
    108    
     107
    109108    @Override
    110109    public Collection<String> getPreferences(JPanel p) {
     
    115114        return Collections.singleton(Integer.toString(zone+2));
    116115    }
    117    
     116
    118117    @Override
    119118    public void setPreferences(Collection<String> args) {
     
    133132        updateParameters(zone);
    134133    }
    135    
     134
    136135    @Override
    137136    public String[] allCodes() {
     
    154153        return null;
    155154    }
    156    
     155
    157156}
  • trunk/src/org/openstreetmap/josm/data/projection/datum/GRS80Datum.java

    r4285 r4869  
    1313public class GRS80Datum extends AbstractDatum {
    1414
    15     public static GRS80Datum INSTANCE = new GRS80Datum();
    16    
     15    public final static GRS80Datum INSTANCE = new GRS80Datum();
     16
    1717    private GRS80Datum() {
    1818        super(tr("GRS80"), null, Ellipsoid.GRS80);
    1919    }
    20    
     20
    2121    @Override
    2222    public LatLon fromWGS84(LatLon ll) {
  • trunk/src/org/openstreetmap/josm/data/projection/datum/WGS84Datum.java

    r4285 r4869  
    1212public class WGS84Datum extends AbstractDatum {
    1313
    14     public static WGS84Datum INSTANCE = new WGS84Datum();
     14    public static final WGS84Datum INSTANCE = new WGS84Datum();
    1515
    1616    private WGS84Datum() {
  • trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java

    r4682 r4869  
    7272    public static double griddetail;
    7373
    74     public static Collection<String> ignoredErrors = new TreeSet<String>();
     74    public static final Collection<String> ignoredErrors = new TreeSet<String>();
    7575
    7676    /**
  • trunk/src/org/openstreetmap/josm/data/validation/tests/BuildingInBuilding.java

    r4806 r4869  
    2424public class BuildingInBuilding extends Test {
    2525
    26     protected static int BUILDING_INSIDE_BUILDING = 2001;
     26    protected static final int BUILDING_INSIDE_BUILDING = 2001;
    2727    protected List<OsmPrimitive> primitivesToCheck = new LinkedList<OsmPrimitive>();
    2828    protected QuadBuckets<Way> index = new QuadBuckets<Way>();
     
    5757        // Check that all nodes of w are in polygon
    5858        for (Node n : w.getNodes()) {
    59             if (!isInPolygon(n, polygon)) {
     59            if (!isInPolygon(n, polygon))
    6060                return false;
    61             }
    6261        }
    6362        // All nodes can be inside polygon and still, w outside:
     
    7372        for (int i=1; i<w.getNodesCount(); i++) {
    7473            LatLon center = w.getNode(i).getCoor().getCenter(w.getNode(i-1).getCoor());
    75             if (center != null && !isInPolygon(new Node(center), polygon)) {
     74            if (center != null && !isInPolygon(new Node(center), polygon))
    7675                return false;
    77             }
    7876        }
    7977        return true;
     
    8684                @Override
    8785                public boolean evaluate(Way object) {
    88                     if (p.equals(object)) {
     86                    if (p.equals(object))
    8987                        return false;
    90                     } else if (p instanceof Node) {
     88                    else if (p instanceof Node)
    9189                        return isInPolygon((Node) p, object.getNodes()) || object.getNodes().contains(p);
    92                     } else if (p instanceof Way) {
     90                    else if (p instanceof Way)
    9391                        return isInPolygon((Way) p, object.getNodes()) && !isInInnerWay((Way)p, object);
    94                     } else {
     92                    else
    9593                        return false;
    96                     }
    9794                }
    9895            });
     
    103100        }
    104101    }
    105    
     102
    106103    private boolean isInInnerWay(Way w, Way outer) {
    107104        for (OsmPrimitive r : outer.getReferrers()) {
     
    113110                        if (isInPolygon(inner, outer.getNodes())) {
    114111                            // If the tested way is inside this inner, outer is a false positive
    115                             if (isInPolygon(w, inner.getNodes())) {
     112                            if (isInPolygon(w, inner.getNodes()))
    116113                                return true;
    117                             }
    118114                        }
    119115                    }
  • trunk/src/org/openstreetmap/josm/data/validation/tests/Coastlines.java

    r4806 r4869  
    3131public class Coastlines extends Test {
    3232
    33     protected static int UNORDERED_COASTLINE = 901;
    34     protected static int REVERSED_COASTLINE = 902;
    35     protected static int UNCONNECTED_COASTLINE = 903;
     33    protected static final int UNORDERED_COASTLINE = 901;
     34    protected static final int REVERSED_COASTLINE = 902;
     35    protected static final int UNCONNECTED_COASTLINE = 903;
    3636
    3737    private List<Way> coastlines;
  • trunk/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java

    r4806 r4869  
    2929 */
    3030public class CrossingWays extends Test {
    31     protected static int CROSSING_WAYS = 601;
     31    protected static final int CROSSING_WAYS = 601;
    3232
    3333    /** All way segments, grouped by cells */
     
    4343    public CrossingWays() {
    4444        super(tr("Crossing ways"),
    45               tr("This test checks if two roads, railways, waterways or buildings crosses in the same layer, but are not connected by a node."));
     45                tr("This test checks if two roads, railways, waterways or buildings crosses in the same layer, but are not connected by a node."));
    4646    }
    4747
     
    8282
    8383        String layer1 = w.get("layer");
    84         if ("0".equals(layer1)) layer1 = null; //0 is default value
     84        if ("0".equals(layer1)) {
     85            layer1 = null; //0 is default value
     86        }
    8587
    8688        int nodesSize = w.getNodesCount();
     
    9496                    List<WaySegment> highlight;
    9597
    96                     if (errorSegments.contains(ws) && errorSegments.contains(es2.ws))
    97                         continue;
     98                    if (errorSegments.contains(ws) && errorSegments.contains(es2.ws)) {
     99                        continue;
     100                    }
    98101
    99102                    String layer2 = es2.layer;
    100103                    String railway2 = es2.railway;
    101104                    boolean isCoastline2 = es2.coastline;
    102                     if (layer1 == null ? layer2 != null : !layer1.equals(layer2))
    103                         continue;
    104 
    105                     if (!es1.intersects(es2) ) continue;
    106                     if (isSubway1 && "subway".equals(railway2)) continue;
    107                     if (isTram1 && "tram".equals(railway2)) continue;
    108 
    109                     if (isCoastline1 != isCoastline2) continue;
     105                    if (layer1 == null ? layer2 != null : !layer1.equals(layer2)) {
     106                        continue;
     107                    }
     108
     109                    if (!es1.intersects(es2) ) {
     110                        continue;
     111                    }
     112                    if (isSubway1 && "subway".equals(railway2)) {
     113                        continue;
     114                    }
     115                    if (isTram1 && "tram".equals(railway2)) {
     116                        continue;
     117                    }
     118
     119                    if (isCoastline1 != isCoastline2) {
     120                        continue;
     121                    }
    110122                    if (("river".equals(waterway1) && "riverbank".equals(es2.waterway))
    111                             || ("riverbank".equals(waterway1) && "river".equals(es2.waterway))) continue;
     123                            || ("riverbank".equals(waterway1) && "river".equals(es2.waterway))) {
     124                        continue;
     125                    }
    112126
    113127                    if ((es1.railway != null && es1.railway.equals("abandoned"))
    114                             || (railway2 != null && railway2.equals("abandoned"))) continue;
     128                            || (railway2 != null && railway2.equals("abandoned"))) {
     129                        continue;
     130                    }
    115131
    116132                    prims = Arrays.asList(es1.ws.way, es2.ws.way);
     
    131147
    132148                        errors.add(new TestError(this, Severity.WARNING,
    133                             message,
    134                             CROSSING_WAYS,
    135                             prims,
    136                             highlight));
     149                                message,
     150                                CROSSING_WAYS,
     151                                prims,
     152                                highlight));
    137153                        ways_seen.put(prims, highlight);
    138154                    } else {
     
    147163
    148164    /**
    149     * Returns all the cells this segment crosses.  Each cell contains the list
    150     * of segments already processed
    151     *
    152     * @param n1 The first node
    153     * @param n2 The second node
    154     * @return A list with all the cells the segment crosses
    155     */
     165     * Returns all the cells this segment crosses.  Each cell contains the list
     166     * of segments already processed
     167     *
     168     * @param n1 The first node
     169     * @param n2 The second node
     170     * @return A list with all the cells the segment crosses
     171     */
    156172    public List<List<ExtendedSegment>> getSegments(Node n1, Node n2) {
    157173
     
    218234
    219235            return Line2D.linesIntersect(
    220                 n1.getEastNorth().east(), n1.getEastNorth().north(),
    221                 n2.getEastNorth().east(), n2.getEastNorth().north(),
    222                 s2.n1.getEastNorth().east(), s2.n1.getEastNorth().north(),
    223                 s2.n2.getEastNorth().east(), s2.n2.getEastNorth().north());
     236                    n1.getEastNorth().east(), n1.getEastNorth().north(),
     237                    n2.getEastNorth().east(), n2.getEastNorth().north(),
     238                    s2.n1.getEastNorth().east(), s2.n1.getEastNorth().north(),
     239                    s2.n2.getEastNorth().east(), s2.n2.getEastNorth().north());
    224240        }
    225241    }
  • trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateNode.java

    r4806 r4869  
    55import static org.openstreetmap.josm.tools.I18n.tr;
    66
    7 import java.awt.GridBagLayout;
    8 import java.awt.geom.Area;
    97import java.util.ArrayList;
    108import java.util.Collection;
     
    1614import java.util.Map;
    1715import java.util.Set;
    18 
    19 import javax.swing.JLabel;
    20 import javax.swing.JOptionPane;
    21 import javax.swing.JPanel;
    2216
    2317import org.openstreetmap.josm.Main;
     
    3529import org.openstreetmap.josm.data.validation.Test;
    3630import org.openstreetmap.josm.data.validation.TestError;
    37 import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil;
    3831import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    3932import org.openstreetmap.josm.tools.MultiMap;
     
    5447                    Math.round(o.getCoor().lat() / precision) * precision,
    5548                    Math.round(o.getCoor().lon() / precision) * precision
    56             );
     49                    );
    5750        }
    5851
     
    8275    }
    8376
    84     protected static int DUPLICATE_NODE = 1;
    85     protected static int DUPLICATE_NODE_MIXED = 2;
    86     protected static int DUPLICATE_NODE_OTHER = 3;
    87     protected static int DUPLICATE_NODE_UNCLOSED = 4;
    88     protected static int DUPLICATE_NODE_BUILDING = 10;
    89     protected static int DUPLICATE_NODE_BOUNDARY = 11;
    90     protected static int DUPLICATE_NODE_HIGHWAY = 12;
    91     protected static int DUPLICATE_NODE_LANDUSE = 13;
    92     protected static int DUPLICATE_NODE_NATURAL = 14;
    93     protected static int DUPLICATE_NODE_POWER = 15;
    94     protected static int DUPLICATE_NODE_RAILWAY = 16;
    95     protected static int DUPLICATE_NODE_WATERWAY = 17;
     77    protected final static int DUPLICATE_NODE = 1;
     78    protected final static int DUPLICATE_NODE_MIXED = 2;
     79    protected final static int DUPLICATE_NODE_OTHER = 3;
     80    protected final static int DUPLICATE_NODE_UNCLOSED = 4;
     81    protected final static int DUPLICATE_NODE_BUILDING = 10;
     82    protected final static int DUPLICATE_NODE_BOUNDARY = 11;
     83    protected final static int DUPLICATE_NODE_HIGHWAY = 12;
     84    protected final static int DUPLICATE_NODE_LANDUSE = 13;
     85    protected final static int DUPLICATE_NODE_NATURAL = 14;
     86    protected final static int DUPLICATE_NODE_POWER = 15;
     87    protected final static int DUPLICATE_NODE_RAILWAY = 16;
     88    protected final static int DUPLICATE_NODE_WATERWAY = 17;
    9689
    9790    /** The map of potential duplicates.
     
    204197                            DUPLICATE_NODE_UNCLOSED,
    205198                            mm.get(tagSet)
    206                     ));
     199                            ));
    207200                } else if (nbType>1) {
    208201                    String msg = marktr("Mixed type duplicated nodes");
     
    215208                            DUPLICATE_NODE_MIXED,
    216209                            mm.get(tagSet)
    217                     ));
     210                            ));
    218211                } else if (typeMap.get("highway")) {
    219212                    String msg = marktr("Highway duplicated nodes");
     
    226219                            DUPLICATE_NODE_HIGHWAY,
    227220                            mm.get(tagSet)
    228                     ));
     221                            ));
    229222                } else if (typeMap.get("railway")) {
    230223                    String msg = marktr("Railway duplicated nodes");
     
    237230                            DUPLICATE_NODE_RAILWAY,
    238231                            mm.get(tagSet)
    239                     ));
     232                            ));
    240233                } else if (typeMap.get("waterway")) {
    241234                    String msg = marktr("Waterway duplicated nodes");
     
    248241                            DUPLICATE_NODE_WATERWAY,
    249242                            mm.get(tagSet)
    250                     ));
     243                            ));
    251244                } else if (typeMap.get("boundary")) {
    252245                    String msg = marktr("Boundary duplicated nodes");
     
    259252                            DUPLICATE_NODE_BOUNDARY,
    260253                            mm.get(tagSet)
    261                     ));
     254                            ));
    262255                } else if (typeMap.get("power")) {
    263256                    String msg = marktr("Power duplicated nodes");
     
    270263                            DUPLICATE_NODE_POWER,
    271264                            mm.get(tagSet)
    272                     ));
     265                            ));
    273266                } else if (typeMap.get("natural")) {
    274267                    String msg = marktr("Natural duplicated nodes");
     
    281274                            DUPLICATE_NODE_NATURAL,
    282275                            mm.get(tagSet)
    283                     ));
     276                            ));
    284277                } else if (typeMap.get("building")) {
    285278                    String msg = marktr("Building duplicated nodes");
     
    292285                            DUPLICATE_NODE_BUILDING,
    293286                            mm.get(tagSet)
    294                     ));
     287                            ));
    295288                } else if (typeMap.get("landuse")) {
    296289                    String msg = marktr("Landuse duplicated nodes");
     
    303296                            DUPLICATE_NODE_LANDUSE,
    304297                            mm.get(tagSet)
    305                     ));
     298                            ));
    306299                } else {
    307300                    String msg = marktr("Other duplicated nodes");
     
    314307                            DUPLICATE_NODE_OTHER,
    315308                            mm.get(tagSet)
    316                     ));
     309                            ));
    317310
    318311                }
     
    336329                        DUPLICATE_NODE,
    337330                        duplicates
    338                 ));
     331                        ));
    339332            }
    340333        }
  • trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateRelation.java

    r4806 r4869  
    122122    }
    123123
    124     protected static int DUPLICATE_RELATION = 1901;
    125     protected static int SAME_RELATION = 1902;
     124    protected static final int DUPLICATE_RELATION = 1901;
     125    protected static final int SAME_RELATION = 1902;
    126126
    127127    /** MultiMap of all relations */
  • trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateWay.java

    r4806 r4869  
    7373    }
    7474
    75     protected static int DUPLICATE_WAY = 1401;
    76     protected static int SAME_WAY = 1402;
     75    protected static final int DUPLICATE_WAY = 1401;
     76    protected static final int SAME_WAY = 1402;
    7777
    7878    /** Bag of all ways */
     
    8787    public DuplicateWay() {
    8888        super(tr("Duplicated ways"),
    89               tr("This test checks that there are no ways with same node coordinates and optionally also same tags."));
     89                tr("This test checks that there are no ways with same node coordinates and optionally also same tags."));
    9090    }
    9191
     
    127127                    }
    128128                }
    129                 if (skip) continue;
     129                if (skip) {
     130                    continue;
     131                }
    130132                TestError testError = new TestError(this, Severity.WARNING, tr("Ways with same position"), SAME_WAY, sameway);
    131133                errors.add(testError);
     
    137139
    138140    /**
    139      * Remove uninteresting keys, like created_by to normalize the tags 
     141     * Remove uninteresting keys, like created_by to normalize the tags
    140142     */
    141143    public void removeUninterestingKeys(Map<String, String> wkeys) {
  • trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicatedWayNodes.java

    r4806 r4869  
    1818
    1919public class DuplicatedWayNodes extends Test {
    20     protected static int DUPLICATE_WAY_NODE = 501;
     20    protected static final int DUPLICATE_WAY_NODE = 501;
    2121
    2222    public DuplicatedWayNodes() {
    2323        super(tr("Duplicated way nodes"),
    24             tr("Checks for ways with identical consecutive nodes."));
     24                tr("Checks for ways with identical consecutive nodes."));
    2525    }
    2626
     
    3737            if (lastN == n) {
    3838                errors.add(new TestError(this, Severity.ERROR, tr("Duplicated way nodes"), DUPLICATE_WAY_NODE,
    39                     Arrays.asList(w), Arrays.asList(n)));
     39                        Arrays.asList(w), Arrays.asList(n)));
    4040                break;
    4141            }
     
    5959            lastN = n;
    6060        }
    61         if (wnew.getNodesCount() < 2) {
     61        if (wnew.getNodesCount() < 2)
    6262            // Empty way, delete
    6363            return DeleteCommand.delete(Main.map.mapView.getEditLayer(), Collections.singleton(w));
    64         } else {
     64        else
    6565            return new ChangeCommand(w, wnew);
    66         }
    6766    }
    6867
  • trunk/src/org/openstreetmap/josm/data/validation/tests/NodesWithSameName.java

    r3671 r4869  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
    6 import java.util.Map;
    7 import java.util.List;
     6import java.util.ArrayList;
    87import java.util.HashMap;
    98import java.util.HashSet;
    10 import java.util.ArrayList;
     9import java.util.List;
     10import java.util.Map;
    1111
    1212import org.openstreetmap.josm.data.osm.Node;
     
    1717
    1818public class NodesWithSameName extends Test {
    19     protected static int SAME_NAME = 801;
     19    protected static final int SAME_NAME = 801;
    2020
    2121    private Map<String, List<Node>> namesToNodes;
     
    2323    public NodesWithSameName() {
    2424        super(tr("Nodes with same name"),
    25             tr("This test finds nodes that have the same name (might be duplicates)."));
     25                tr("This test finds nodes that have the same name (might be duplicates)."));
    2626    }
    2727
  • trunk/src/org/openstreetmap/josm/data/validation/tests/OverlappingAreas.java

    r4806 r4869  
    55import java.util.Collection;
    66import java.util.Collections;
     7
    78import org.openstreetmap.josm.data.osm.QuadBuckets;
    89import org.openstreetmap.josm.data.osm.Way;
     
    1718public class OverlappingAreas extends Test {
    1819
    19     protected static int OVERLAPPING_AREAS = 2201;
     20    protected static final int OVERLAPPING_AREAS = 2201;
    2021    protected QuadBuckets<Way> index = new QuadBuckets<Way>();
    2122
     
    4041                        @Override
    4142                        public boolean evaluate(Way wi) {
    42                             if (w.equals(wi)) {
     43                            if (w.equals(wi))
    4344                                return false;
    44                             } else {
     45                            else
    4546                                return Geometry.polygonIntersection(w.getNodes(), wi.getNodes())
    4647                                        == Geometry.PolygonIntersection.CROSSING;
    47                             }
    4848                        }
    4949                    });
  • trunk/src/org/openstreetmap/josm/data/validation/tests/OverlappingWays.java

    r4806 r4869  
    2929 */
    3030public class OverlappingWays extends Test {
    31    
     31
    3232    /** Bag of all way segments */
    3333    MultiMap<Pair<Node,Node>, WaySegment> nodePairs;
    3434
    35     protected static int OVERLAPPING_HIGHWAY = 101;
    36     protected static int OVERLAPPING_RAILWAY = 102;
    37     protected static int OVERLAPPING_WAY = 103;
    38     protected static int OVERLAPPING_HIGHWAY_AREA = 111;
    39     protected static int OVERLAPPING_RAILWAY_AREA = 112;
    40     protected static int OVERLAPPING_WAY_AREA = 113;
    41     protected static int OVERLAPPING_AREA = 120;
     35    protected static final int OVERLAPPING_HIGHWAY = 101;
     36    protected static final int OVERLAPPING_RAILWAY = 102;
     37    protected static final int OVERLAPPING_WAY = 103;
     38    protected static final int OVERLAPPING_HIGHWAY_AREA = 111;
     39    protected static final int OVERLAPPING_RAILWAY_AREA = 112;
     40    protected static final int OVERLAPPING_WAY_AREA = 113;
     41    protected static final int OVERLAPPING_AREA = 120;
    4242
    4343    /** Constructor */
    4444    public OverlappingWays() {
    4545        super(tr("Overlapping ways"),
    46               tr("This test checks that a connection between two nodes "
    47                 + "is not used by more than one way."));
     46                tr("This test checks that a connection between two nodes "
     47                        + "is not used by more than one way."));
    4848    }
    4949
     
    125125                    }
    126126
    127                     errors.add(new TestError(this, 
     127                    errors.add(new TestError(this,
    128128                            type < OVERLAPPING_HIGHWAY_AREA ? Severity.WARNING : Severity.OTHER,
    129                             errortype, type, prims, duplicated));
     129                                    errortype, type, prims, duplicated));
    130130                    ways_seen.put(current_ways, duplicated);
    131131                } else { /* way seen, mark highlight layer only */
     
    151151            }
    152152            nodePairs.put(Pair.sort(new Pair<Node,Node>(lastN, n)),
    153                 new WaySegment(w, i));
     153                    new WaySegment(w, i));
    154154            lastN = n;
    155155        }
  • trunk/src/org/openstreetmap/josm/data/validation/tests/RelationChecker.java

    r4806 r4869  
    2828public class RelationChecker extends Test {
    2929
    30     protected static int ROLE_UNKNOWN      = 1701;
    31     protected static int ROLE_EMPTY        = 1702;
    32     protected static int WRONG_TYPE        = 1703;
    33     protected static int HIGH_COUNT        = 1704;
    34     protected static int LOW_COUNT         = 1705;
    35     protected static int ROLE_MISSING      = 1706;
    36     protected static int RELATION_UNKNOWN  = 1707;
    37     protected static int RELATION_EMPTY    = 1708;
     30    protected static final int ROLE_UNKNOWN      = 1701;
     31    protected static final int ROLE_EMPTY        = 1702;
     32    protected static final int WRONG_TYPE        = 1703;
     33    protected static final int HIGH_COUNT        = 1704;
     34    protected static final int LOW_COUNT         = 1705;
     35    protected static final int ROLE_MISSING      = 1706;
     36    protected static final int RELATION_UNKNOWN  = 1707;
     37    protected static final int RELATION_EMPTY    = 1708;
    3838
    3939    /**
  • trunk/src/org/openstreetmap/josm/data/validation/tests/SelfIntersectingWay.java

    r3671 r4869  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
     6import java.util.Arrays;
    67import java.util.HashSet;
    7 import java.util.Arrays;
    88
     9import org.openstreetmap.josm.data.osm.Node;
    910import org.openstreetmap.josm.data.osm.Way;
    10 import org.openstreetmap.josm.data.osm.Node;
    1111import org.openstreetmap.josm.data.validation.Severity;
    1212import org.openstreetmap.josm.data.validation.Test;
     
    1717 */
    1818public class SelfIntersectingWay extends Test {
    19    
    20     protected static int SELF_INTERSECT = 401;
     19
     20    protected static final int SELF_INTERSECT = 401;
    2121
    2222    public SelfIntersectingWay() {
    2323        super(tr("Self-intersecting ways"),
    24               tr("This test checks for ways " +
    25                 "that contain some of their nodes more than once."));
     24                tr("This test checks for ways " +
     25                        "that contain some of their nodes more than once."));
    2626    }
    2727
     
    3333            if (nodes.contains(n)) {
    3434                errors.add(new TestError(this,
    35                     Severity.WARNING, tr("Self-intersecting ways"), SELF_INTERSECT,
    36                     Arrays.asList(w), Arrays.asList(n)));
     35                        Severity.WARNING, tr("Self-intersecting ways"), SELF_INTERSECT,
     36                        Arrays.asList(w), Arrays.asList(n)));
    3737                break;
    3838            } else {
  • trunk/src/org/openstreetmap/josm/data/validation/tests/SimilarNamedWays.java

    r4806 r4869  
    2828public class SimilarNamedWays extends Test {
    2929
    30     protected static int SIMILAR_NAMED = 701;
     30    protected static final int SIMILAR_NAMED = 701;
    3131
    3232    /** All ways, grouped by cells */
  • trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java

    r4812 r4869  
    4949import org.openstreetmap.josm.data.osm.Relation;
    5050import org.openstreetmap.josm.data.osm.Way;
    51 import org.openstreetmap.josm.data.validation.OsmValidator;
    5251import org.openstreetmap.josm.data.validation.Severity;
    5352import org.openstreetmap.josm.data.validation.Test;
    5453import org.openstreetmap.josm.data.validation.TestError;
    5554import org.openstreetmap.josm.data.validation.util.Entities;
     55import org.openstreetmap.josm.gui.preferences.TaggingPresetPreference;
    5656import org.openstreetmap.josm.gui.preferences.ValidatorPreference;
    57 import org.openstreetmap.josm.gui.preferences.TaggingPresetPreference;
    5857import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    5958import org.openstreetmap.josm.gui.tagging.TaggingPreset;
     
    7978    protected static MultiMap<String, String> presetsValueData;
    8079    /** The TagChecker data */
    81     protected static List<CheckerData> checkerData = new ArrayList<CheckerData>();
    82     protected static List<String> ignoreDataStartsWith = new ArrayList<String>();
    83     protected static List<String> ignoreDataEquals = new ArrayList<String>();
    84     protected static List<String> ignoreDataEndsWith = new ArrayList<String>();
    85     protected static List<IgnoreKeyPair> ignoreDataKeyPair = new ArrayList<IgnoreKeyPair>();
    86     protected static List<IgnoreTwoKeyPair> ignoreDataTwoKeyPair = new ArrayList<IgnoreTwoKeyPair>();
     80    protected static final List<CheckerData> checkerData = new ArrayList<CheckerData>();
     81    protected static final List<String> ignoreDataStartsWith = new ArrayList<String>();
     82    protected static final List<String> ignoreDataEquals = new ArrayList<String>();
     83    protected static final List<String> ignoreDataEndsWith = new ArrayList<String>();
     84    protected static final List<IgnoreKeyPair> ignoreDataKeyPair = new ArrayList<IgnoreKeyPair>();
     85    protected static final List<IgnoreTwoKeyPair> ignoreDataTwoKeyPair = new ArrayList<IgnoreTwoKeyPair>();
    8786
    8887    /** The preferences prefix */
     
    129128    protected JButton deleteSrcButton;
    130129
    131     protected static int EMPTY_VALUES      = 1200;
    132     protected static int INVALID_KEY       = 1201;
    133     protected static int INVALID_VALUE     = 1202;
    134     protected static int FIXME             = 1203;
    135     protected static int INVALID_SPACE     = 1204;
    136     protected static int INVALID_KEY_SPACE = 1205;
    137     protected static int INVALID_HTML      = 1206; /* 1207 was PAINT */
    138     protected static int LONG_VALUE        = 1208;
    139     protected static int LONG_KEY          = 1209;
    140     protected static int LOW_CHAR_VALUE    = 1210;
    141     protected static int LOW_CHAR_KEY      = 1211;
     130    protected static final int EMPTY_VALUES      = 1200;
     131    protected static final int INVALID_KEY       = 1201;
     132    protected static final int INVALID_VALUE     = 1202;
     133    protected static final int FIXME             = 1203;
     134    protected static final int INVALID_SPACE     = 1204;
     135    protected static final int INVALID_KEY_SPACE = 1205;
     136    protected static final int INVALID_HTML      = 1206; /* 1207 was PAINT */
     137    protected static final int LONG_VALUE        = 1208;
     138    protected static final int LONG_KEY          = 1209;
     139    protected static final int LOW_CHAR_VALUE    = 1210;
     140    protected static final int LOW_CHAR_KEY      = 1211;
    142141    /** 1250 and up is used by tagcheck */
    143142
     
    145144    protected JList sourcesList;
    146145
    147     protected static Entities entities = new Entities();
     146    protected static final Entities entities = new Entities();
    148147
    149148    /**
     
    626625                                tr("Information"),
    627626                                JOptionPane.INFORMATION_MESSAGE
    628                         );
     627                                );
    629628                    }
    630629                } else {
     
    713712    public void handlePrefEnable() {
    714713        boolean selected = prefCheckKeys.isSelected() || prefCheckKeysBeforeUpload.isSelected()
    715                     || prefCheckComplex.isSelected() || prefCheckComplexBeforeUpload.isSelected();
     714                || prefCheckComplex.isSelected() || prefCheckComplexBeforeUpload.isSelected();
    716715        sourcesList.setEnabled( selected );
    717716        addSrcButton.setEnabled(selected);
     
    792791        if (commands.size() == 1)
    793792            return commands.get(0);
    794        
     793
    795794        return new SequenceCommand(tr("Fix properties"), commands);
    796795    }
     
    825824        private int code;
    826825        protected Severity severity;
    827         protected static int TAG_CHECK_ERROR  = 1250;
    828         protected static int TAG_CHECK_WARN   = 1260;
    829         protected static int TAG_CHECK_INFO   = 1270;
     826        protected static final int TAG_CHECK_ERROR  = 1250;
     827        protected static final int TAG_CHECK_WARN   = 1260;
     828        protected static final int TAG_CHECK_INFO   = 1270;
    830829
    831830        private static class CheckerElement {
  • trunk/src/org/openstreetmap/josm/data/validation/tests/UnconnectedWays.java

    r4806 r4869  
    3939public class UnconnectedWays extends Test {
    4040
    41     protected static int UNCONNECTED_WAYS = 1301;
     41    protected static final int UNCONNECTED_WAYS = 1301;
    4242    protected static final String PREFIX = ValidatorPreference.PREFIX + "." + UnconnectedWays.class.getSimpleName();
    4343
     
    314314        public boolean isArea() {
    315315            return w.hasKey("landuse")
    316             || w.hasKey("leisure")
    317             || w.hasKey("amenity")
    318             || w.hasKey("building");
     316                    || w.hasKey("leisure")
     317                    || w.hasKey("amenity")
     318                    || w.hasKey("building");
    319319        }
    320320    }
  • trunk/src/org/openstreetmap/josm/data/validation/tests/WronglyOrderedWays.java

    r4806 r4869  
    1919public class WronglyOrderedWays extends Test {
    2020
    21     protected static int WRONGLY_ORDERED_COAST = 1001;
     21    protected static final int WRONGLY_ORDERED_COAST = 1001;
    2222    //protected static int WRONGLY_ORDERED_WATER = 1002;
    23     protected static int WRONGLY_ORDERED_LAND  = 1003;
     23    protected static final int WRONGLY_ORDERED_LAND  = 1003;
    2424
    2525    /**
     
    2828    public WronglyOrderedWays() {
    2929        super(tr("Wrongly Ordered Ways"),
    30               tr("This test checks the direction of water, land and coastline ways."));
     30                tr("This test checks the direction of water, land and coastline ways."));
    3131    }
    3232
     
    3838
    3939        String natural = w.get("natural");
    40         if (natural == null) {
     40        if (natural == null)
    4141            return;
    42         } else if ("coastline".equals(natural) && Geometry.isClockwise(w)) {
     42        else if ("coastline".equals(natural) && Geometry.isClockwise(w)) {
    4343            reportError(w, tr("Reversed coastline: land not on left side"), WRONGLY_ORDERED_COAST);
    44         /*} else if ("water".equals(natural) && !Geometry.isClockwise(w)) {
     44            /*} else if ("water".equals(natural) && !Geometry.isClockwise(w)) {
    4545            reportError(w, tr("Reversed water: land not on left side"), WRONGLY_ORDERED_WATER);*/
    4646        } else if ("land".equals(natural) && Geometry.isClockwise(w)) {
    4747            reportError(w, tr("Reversed land: land not on left side"), WRONGLY_ORDERED_LAND);
    48         } else {
     48        } else
    4949            return;
    50         }
    5150
    5251    }
Note: See TracChangeset for help on using the changeset viewer.