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

Use final were appropriate

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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    }
Note: See TracChangeset for help on using the changeset viewer.