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