Changeset 11376 in josm for trunk


Ignore:
Timestamp:
2016-12-10T06:47:17+01:00 (8 years ago)
Author:
Don-vip
Message:

findbugs - UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java

    r11374 r11376  
    6767    public static class JoinAreasResult {
    6868
    69         public boolean hasChanges;
    70 
    71         public List<Multipolygon> polygons;
     69        private final boolean hasChanges;
     70        private final List<Multipolygon> polygons;
     71
     72        /**
     73         * Constructs a new {@code JoinAreasResult}.
     74         * @param hasChanges whether the result has changes
     75         * @param polygons the result polygons, can be null
     76         */
     77        public JoinAreasResult(boolean hasChanges, List<Multipolygon> polygons) {
     78            this.hasChanges = hasChanges;
     79            this.polygons = polygons;
     80        }
     81
     82        /**
     83         * Determines if the result has changes.
     84         * @return {@code true} if the result has changes
     85         */
     86        public final boolean hasChanges() {
     87            return hasChanges;
     88        }
     89
     90        /**
     91         * Returns the result polygons, can be null.
     92         * @return the result polygons, can be null
     93         */
     94        public final List<Multipolygon> getPolygons() {
     95            return polygons;
     96        }
    7297    }
    7398
     
    545570    public JoinAreasResult joinAreas(List<Multipolygon> areas) throws UserCancelException {
    546571
    547         JoinAreasResult result = new JoinAreasResult();
    548         result.hasChanges = false;
     572        boolean hasChanges = false;
    549573
    550574        List<Way> allStartingWays = new ArrayList<>();
     
    565589
    566590        if (removedDuplicates) {
    567             result.hasChanges = true;
     591            hasChanges = true;
    568592            commitCommands(marktr("Removed duplicate nodes"));
    569593        }
     
    574598        //no intersections, return.
    575599        if (nodes.isEmpty())
    576             return result;
     600            return new JoinAreasResult(hasChanges, null);
    577601        commitCommands(marktr("Added node on all intersections"));
    578602
     
    655679        }
    656680
    657         result.hasChanges = true;
    658         result.polygons = polygons;
    659         return result;
     681        return new JoinAreasResult(true, polygons);
    660682    }
    661683
  • trunk/src/org/openstreetmap/josm/tools/RightAndLefthandTraffic.java

    r11374 r11376  
    111111            try {
    112112                JoinAreasResult result = new JoinAreasAction().joinAreas(areas);
    113                 if (result.hasChanges) {
    114                     for (Multipolygon mp : result.polygons) {
     113                if (result.hasChanges()) {
     114                    for (Multipolygon mp : result.getPolygons()) {
    115115                        optimizedWays.add(mp.outerWay);
    116116                    }
Note: See TracChangeset for help on using the changeset viewer.