Ignore:
Timestamp:
2014-10-18T23:07:52+02:00 (10 years ago)
Author:
donvip
Message:

[josm_plugins] fix Java 7 / unused code warnings

Location:
applications/editors/josm/plugins/pdfimport/src/pdfimport
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/pdfimport/src/pdfimport/DuplicateNodesFinder.java

    r25349 r30737  
    2020         */
    2121        public static Map<Point2D, Point2D> findDuplicateNodes(Collection<Point2D> nodes, final double tolerance){
    22                 List<Point2D> points = new ArrayList<Point2D>(nodes);
     22                List<Point2D> points = new ArrayList<>(nodes);
    2323                Collections.sort(points, new Comparator<Point2D>(){
    2424                        public int compare(Point2D o1, Point2D o2) {
     
    2828                });
    2929
    30                 Map<Point2D, Point2D> result = new HashMap<Point2D, Point2D>();
    31                 TreeMap<Point2D, Point2D> sweepLine = new TreeMap<Point2D, Point2D>(new Comparator<Point2D>(){
     30                Map<Point2D, Point2D> result = new HashMap<>();
     31                TreeMap<Point2D, Point2D> sweepLine = new TreeMap<>(new Comparator<Point2D>(){
    3232                        public int compare(Point2D o1, Point2D o2) {
    3333                                double diff = o1.getX() - o2.getX();
  • applications/editors/josm/plugins/pdfimport/src/pdfimport/LayerContents.java

    r25349 r30737  
    1010public class LayerContents{
    1111
    12         List<Point2D> points = new ArrayList<Point2D>();
    13         List<PdfPath> paths = new ArrayList<PdfPath>();
    14         List<PdfMultiPath> multiPaths = new ArrayList<PdfMultiPath>();
     12        List<Point2D> points = new ArrayList<>();
     13        List<PdfPath> paths = new ArrayList<>();
     14        List<PdfMultiPath> multiPaths = new ArrayList<>();
    1515        LayerInfo info;
    1616}
  • applications/editors/josm/plugins/pdfimport/src/pdfimport/OsmBuilder.java

    r25349 r30737  
    6666
    6767        private void addLayer(DataSet target, LayerContents layer) {
    68                 Map<Point2D, Node> point2Node = new HashMap<Point2D, Node>();
     68                Map<Point2D, Node> point2Node = new HashMap<>();
    6969
    7070                this.fillName = this.printColor(layer.info.fill);
     
    8282
    8383                //insert ways
    84                 Map<PdfPath, Way> path2Way = new HashMap<PdfPath, Way>();
     84                Map<PdfPath, Way> path2Way = new HashMap<>();
    8585
    8686                for (PdfPath path: layer.paths){
     
    105105                                Relation rel = new Relation();
    106106
    107                                 Map<String, String> keys = new HashMap<String, String>();
     107                                Map<String, String> keys = new HashMap<>();
    108108                                keys.put("type", "multipolygon");
    109109                                keys.put("area", "yes");
     
    128128                this.monitorPos ++;
    129129
    130                 List<Node> nodes = new ArrayList<Node>(path.points.size());
     130                List<Node> nodes = new ArrayList<>(path.points.size());
    131131
    132132                for (Point2D point: path.points) {
     
    139139                }
    140140
    141                 Map<String, String> keys = new HashMap<String, String>();
     141                Map<String, String> keys = new HashMap<>();
    142142
    143143                if (this.mode != Mode.Draft) {
  • applications/editors/josm/plugins/pdfimport/src/pdfimport/ParallelSegmentsFinder.java

    r25349 r30737  
    1616        public double angleSum;
    1717        public int refCount;
    18         public List<PdfPath> paths = new ArrayList<PdfPath>();
     18        public List<PdfPath> paths = new ArrayList<>();
    1919
    2020        public void addPath(PdfPath path, double angle2) {
     
    3030                tr.rotate(-angle);
    3131
    32                 final Map<PdfPath, Point2D> positions = new HashMap<PdfPath, Point2D>();
     32                final Map<PdfPath, Point2D> positions = new HashMap<>();
    3333                Point2D src = new Point2D.Double();
    3434
     
    5555
    5656                //process sweep
    57                 List<ParallelSegmentsFinder> result = new ArrayList<ParallelSegmentsFinder>();
     57                List<ParallelSegmentsFinder> result = new ArrayList<>();
    5858
    59                 Map<PdfPath, ParallelSegmentsFinder> sweepLine = new HashMap<PdfPath, ParallelSegmentsFinder>();
     59                Map<PdfPath, ParallelSegmentsFinder> sweepLine = new HashMap<>();
    6060
    61                 Set<ParallelSegmentsFinder> adjacentClustersSet = new HashSet<ParallelSegmentsFinder>();
    62                 List<ParallelSegmentsFinder> adjacentClusters = new ArrayList<ParallelSegmentsFinder>();
    63                 List<PdfPath> pathsToRemove = new ArrayList<PdfPath>();
     61                Set<ParallelSegmentsFinder> adjacentClustersSet = new HashSet<>();
     62                List<ParallelSegmentsFinder> adjacentClusters = new ArrayList<>();
     63                List<PdfPath> pathsToRemove = new ArrayList<>();
    6464
    6565                for (PdfPath path: paths){
  • applications/editors/josm/plugins/pdfimport/src/pdfimport/PathOptimizer.java

    r29913 r30737  
    2727        public PathOptimizer(double _pointsTolerance, Color _color, boolean _splitOnColorChange)
    2828        {
    29                 uniquePointMap = new HashMap<Point2D, Point2D>();
    30                 uniquePoints = new ArrayList<Point2D>();
    31                 layerMap = new HashMap<LayerInfo, LayerContents>();
    32                 layers = new ArrayList<LayerContents>();
     29                uniquePointMap = new HashMap<>();
     30                uniquePoints = new ArrayList<>();
     31                layerMap = new HashMap<>();
     32                layers = new ArrayList<>();
    3333                pointsTolerance = _pointsTolerance;
    3434                color = _color;
     
    6767
    6868                //optimize the paths
    69                 Set<Point2D> points = new HashSet<Point2D>();
     69                Set<Point2D> points = new HashSet<>();
    7070                for(PdfPath path: paths) {
    7171                        points.addAll(path.points);
     
    148148
    149149        public void splitLayersBySimilarShapes(double tolerance) {
    150                 List<LayerContents> newLayers = new ArrayList<LayerContents>();
     150                List<LayerContents> newLayers = new ArrayList<>();
    151151                for(LayerContents l: this.layers) {
    152152                        List<LayerContents> splitResult = splitBySimilarGroups(l);
     
    160160
    161161        public void splitLayersByPathKind(boolean closed, boolean single, boolean orthogonal) {
    162                 List<LayerContents> newLayers = new ArrayList<LayerContents>();
     162                List<LayerContents> newLayers = new ArrayList<>();
    163163                for(LayerContents l: this.layers) {
    164164                        List<LayerContents> splitResult = splitBySegmentKind(l, closed, single, orthogonal);
     
    211211
    212212        private void finalizeLayer(LayerContents layer){
    213                 Set<Point2D> points = new HashSet<Point2D>();
    214                 layer.points = new ArrayList<Point2D>();
     213                Set<Point2D> points = new HashSet<>();
     214                layer.points = new ArrayList<>();
    215215
    216216                for(PdfPath pp: layer.paths){
     
    242242        private void fixPoints(LayerContents layer, Map<Point2D, Point2D> pointMap) {
    243243
    244                 List<PdfPath> newPaths = new ArrayList<PdfPath>(layer.paths.size());
     244                List<PdfPath> newPaths = new ArrayList<>(layer.paths.size());
    245245
    246246                for(PdfPath path: layer.paths) {
     
    265265        private List<Point2D> fixPoints(List<Point2D> points, Map<Point2D, Point2D> pointMap) {
    266266
    267                 List<Point2D> newPoints = new ArrayList<Point2D>(points.size());
     267                List<Point2D> newPoints = new ArrayList<>(points.size());
    268268                Point2D prevPoint = null;
    269269
     
    287287
    288288        private void removeSmallObjects(LayerContents layer, double min, double max) {
    289                 List<PdfPath> newPaths = new ArrayList<PdfPath>(layer.paths.size());
     289                List<PdfPath> newPaths = new ArrayList<>(layer.paths.size());
    290290
    291291                for(PdfPath path: layer.paths) {
     
    300300                layer.paths = newPaths;
    301301
    302                 List<PdfMultiPath> newMPaths = new ArrayList<PdfMultiPath>(layer.multiPaths.size());
     302                List<PdfMultiPath> newMPaths = new ArrayList<>(layer.multiPaths.size());
    303303
    304304                for (PdfMultiPath mp: layer.multiPaths){
     
    341341
    342342                //filter paths by direction
    343                 List<ParallelSegmentsFinder> angles = new ArrayList<ParallelSegmentsFinder>();
     343                List<ParallelSegmentsFinder> angles = new ArrayList<>();
    344344
    345345                for(PdfPath path: layer.paths) {
     
    371371                }
    372372
    373                 Set<PdfPath> pathsToRemove = new HashSet<PdfPath>();
     373                Set<PdfPath> pathsToRemove = new HashSet<>();
    374374
    375375                //process each direction
     
    389389
    390390                //generate new path list
    391                 List<PdfPath> result = new ArrayList<PdfPath>(layer.paths.size() - pathsToRemove.size());
     391                List<PdfPath> result = new ArrayList<>(layer.paths.size() - pathsToRemove.size());
    392392
    393393                for(PdfPath path: layer.paths) {
     
    406406         */
    407407        private void concatenatePaths(LayerContents layer) {
    408                 Map<Point2D, List<PdfPath>> pathEndpoints = new HashMap<Point2D, List<PdfPath>>();
    409                 Set<PdfPath> mergedPaths = new HashSet<PdfPath>();
    410                 List<PdfPath> newPaths = new ArrayList<PdfPath>();
     408                Map<Point2D, List<PdfPath>> pathEndpoints = new HashMap<>();
     409                Set<PdfPath> mergedPaths = new HashSet<>();
     410                List<PdfPath> newPaths = new ArrayList<>();
    411411
    412412                //fill pathEndpoints map
     
    419419                        List<PdfPath> paths = pathEndpoints.get(pp.firstPoint());
    420420                        if (paths == null){
    421                                 paths = new ArrayList<PdfPath>(2);
     421                                paths = new ArrayList<>(2);
    422422                                pathEndpoints.put(pp.firstPoint(), paths);
    423423                        }
     
    426426                        paths = pathEndpoints.get(pp.lastPoint());
    427427                        if (paths == null){
    428                                 paths = new ArrayList<PdfPath>(2);
     428                                paths = new ArrayList<>(2);
    429429                                pathEndpoints.put(pp.lastPoint(), paths);
    430430                        }
     
    432432                }
    433433
    434                 List<PdfPath> pathChain = new ArrayList<PdfPath>(2);
    435                 Set<Point2D> pointsInPath = new HashSet<Point2D>();
     434                List<PdfPath> pathChain = new ArrayList<>(2);
     435                Set<Point2D> pointsInPath = new HashSet<>();
    436436
    437437                //join the paths
     
    567567        private boolean isSubpathOf(PdfPath main, PdfPath sub) {
    568568
    569                 Set<Point2D> points = new HashSet<Point2D>(main.points);
     569                Set<Point2D> points = new HashSet<>(main.points);
    570570
    571571                for(Point2D point: sub.points) {
     
    586586                OrthogonalShapesFilter of = new OrthogonalShapesFilter(10);
    587587
    588                 List<PdfPath> singleSegmentPaths = new ArrayList<PdfPath>();
    589                 List<PdfPath> multiSegmentPaths = new ArrayList<PdfPath>();
    590                 List<PdfPath> closedPaths = new ArrayList<PdfPath>();
    591                 List<PdfPath> orthogonalPaths = new ArrayList<PdfPath>();
    592                 List<PdfPath> orthogonalClosedPaths = new ArrayList<PdfPath>();
     588                List<PdfPath> singleSegmentPaths = new ArrayList<>();
     589                List<PdfPath> multiSegmentPaths = new ArrayList<>();
     590                List<PdfPath> closedPaths = new ArrayList<>();
     591                List<PdfPath> orthogonalPaths = new ArrayList<>();
     592                List<PdfPath> orthogonalClosedPaths = new ArrayList<>();
    593593
    594594                for(PdfPath path: layer.paths) {
     
    621621                }
    622622
    623                 List<LayerContents> layers = new ArrayList<LayerContents>();
     623                List<LayerContents> layers = new ArrayList<>();
    624624
    625625                if (multiSegmentPaths.size() > 0) {
     
    665665
    666666        private List<LayerContents> splitBySimilarGroups(LayerContents layer) {
    667                 List<List<PdfPath>> subparts = new ArrayList<List<PdfPath>>();
     667                List<List<PdfPath>> subparts = new ArrayList<>();
    668668
    669669                //split into similar parts
     
    680680
    681681                        if (sublayer == null) {
    682                                 sublayer = new ArrayList<PdfPath>();
     682                                sublayer = new ArrayList<>();
    683683                                subparts.add(sublayer);
    684684                        }
     
    690690                int minGroupTreshold = 10;
    691691
    692                 List<PdfPath> independantPaths = new ArrayList<PdfPath>();
    693                 List<LayerContents> result = new ArrayList<LayerContents>();
     692                List<PdfPath> independantPaths = new ArrayList<>();
     693                List<LayerContents> result = new ArrayList<>();
    694694
    695695                for(List<PdfPath> list: subparts){
  • applications/editors/josm/plugins/pdfimport/src/pdfimport/ProjectionInfo.java

    r28448 r30737  
    1111
    1212public class ProjectionInfo {
    13     private static Map<String, ProjectionChoice> allCodesPC = new HashMap<String, ProjectionChoice>();
    14     private static Map<String, Projection> allCodes = new HashMap<String, Projection>();
     13    private static Map<String, ProjectionChoice> allCodesPC = new HashMap<>();
     14    private static Map<String, Projection> allCodes = new HashMap<>();
    1515
    1616    static {
  • applications/editors/josm/plugins/pdfimport/src/pdfimport/pdfbox/GraphicsProcessor.java

    r30701 r30737  
    7676
    7777        private List<PdfPath> parsePath(Shape s, boolean closed) {
    78                 List<PdfPath> result = new ArrayList<PdfPath>(2);
    79                 List<Point2D> points = new ArrayList<Point2D>(2);
     78                List<PdfPath> result = new ArrayList<>(2);
     79                List<Point2D> points = new ArrayList<>(2);
    8080
    8181                PathIterator iter = s.getPathIterator(null);
     
    9191                                        result.add(new PdfPath(points));
    9292                                }
    93                                 points = new ArrayList<Point2D>(2);
     93                                points = new ArrayList<>(2);
    9494                        } else if (type == PathIterator.SEG_CUBICTO) {
    9595                                //cubic curve
     
    104104                                        result.add(new PdfPath(points));
    105105                                }
    106                                 points = new ArrayList<Point2D>(2);
     106                                points = new ArrayList<>(2);
    107107                                this.addPoint(points, this.parsePoint(coords, 0));
    108108                        }
Note: See TracChangeset for help on using the changeset viewer.