Ignore:
Timestamp:
2014-04-29T00:12:00+02:00 (11 years ago)
Author:
donvip
Message:

see #josm8465 - update code to Java 7

Location:
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/AbstractLayer.java

    r30240 r30426  
    7272    public static <E> List<E> add(List<E> list, E element) {
    7373        if(element!=null){
    74             if(list==null) list = new ArrayList<E>();
     74            if(list==null) list = new ArrayList<>();
    7575            if(!list.contains(element)) list.add(element);
    7676        }
  • applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/AttributionSupport.java

    r30223 r30426  
    3232
    3333    static {
    34         HashMap<TextAttribute, Integer> aUnderline = new HashMap<TextAttribute, Integer>();
     34        HashMap<TextAttribute, Integer> aUnderline = new HashMap<>();
    3535        aUnderline.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
    3636        ATTR_LINK_FONT = ATTR_FONT.deriveFont(aUnderline);
  • applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/Demo.java

    r30244 r30426  
    9494            }
    9595        });
    96         JComboBox tileSourceSelector = new JComboBox(new TileSource[] { new OsmTileSource.Mapnik(),
     96        JComboBox<TileSource> tileSourceSelector = new JComboBox<>(new TileSource[] { new OsmTileSource.Mapnik(),
    9797                new OsmTileSource.CycleMap(), new BingAerialTileSource(), new MapQuestOsmTileSource(), new MapQuestOpenAerialTileSource() });
    9898        tileSourceSelector.addItemListener(new ItemListener() {
     
    101101            }
    102102        });
    103         JComboBox tileLoaderSelector;
     103        JComboBox<TileLoader> tileLoaderSelector;
    104104        try {
    105             tileLoaderSelector = new JComboBox(new TileLoader[] { new OsmFileCacheTileLoader(map()),
    106                     new OsmTileLoader(map()) });
     105            tileLoaderSelector = new JComboBox<>(new TileLoader[] { new OsmFileCacheTileLoader(map()), new OsmTileLoader(map()) });
    107106        } catch (IOException e) {
    108             tileLoaderSelector = new JComboBox(new TileLoader[] { new OsmTileLoader(map()) });
     107            tileLoaderSelector = new JComboBox<>(new TileLoader[] { new OsmTileLoader(map()) });
    109108        }
    110109        tileLoaderSelector.addItemListener(new ItemListener() {
  • applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java

    r30403 r30426  
    110110        tileSource = new OsmTileSource.Mapnik();
    111111        tileController = new TileController(tileSource, tileCache, this);
    112         mapMarkerList = new LinkedList<MapMarker>();
    113         mapPolygonList = new LinkedList<MapPolygon>();
    114         mapRectangleList = new LinkedList<MapRectangle>();
     112        mapMarkerList = new LinkedList<>();
     113        mapPolygonList = new LinkedList<>();
     114        mapRectangleList = new LinkedList<>();
    115115        mapMarkersVisible = true;
    116116        mapRectanglesVisible = true;
     
    712712        List<? extends ICoordinate> coords = polygon.getPoints();
    713713        if (coords != null && coords.size() >= 3) {
    714             List<Point> points = new LinkedList<Point>();
     714            List<Point> points = new LinkedList<>();
    715715            for (ICoordinate c : coords) {
    716716                Point p = getMapPosition(c, false);
     
    724724                int tilesize = tileSource.getTileSize();
    725725                int mapSize = tilesize << zoom;
    726                 List<Point> pointsWrapped = new LinkedList<Point>(points);
     726                List<Point> pointsWrapped = new LinkedList<>(points);
    727727                boolean keepWrapping = true;
    728728                while (keepWrapping) {
     
    735735                    polygon.paint(g, pointsWrapped);
    736736                }
    737                 pointsWrapped = new LinkedList<Point>(points);
     737                pointsWrapped = new LinkedList<>(points);
    738738                keepWrapping = true;
    739739                while (keepWrapping) {
  • applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/JobDispatcher.java

    r30223 r30426  
    3232    }
    3333
    34     protected BlockingDeque<TileJob> jobQueue = new LinkedBlockingDeque<TileJob>();
     34    protected BlockingDeque<TileJob> jobQueue = new LinkedBlockingDeque<>();
    3535
    3636    protected static int workerThreadMaxCount = 8;
  • applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/MemoryTileCache.java

    r30223 r30426  
    3333
    3434    public MemoryTileCache() {
    35         hash = new HashMap<String, CacheEntry>(cacheSize);
     35        hash = new HashMap<>(cacheSize);
    3636        lruTiles = new CacheLinkedListElement();
    3737    }
  • applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/OsmFileCacheTileLoader.java

    r30270 r30426  
    100100        log.finest("Tile cache directory: " + cacheDir);
    101101        cacheDirBase = cacheDir.getAbsolutePath();
    102         sourceCacheDirMap = new HashMap<TileSource, File>();
     102        sourceCacheDirMap = new HashMap<>();
    103103    }
    104104
  • applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/OsmTileLoader.java

    r30223 r30426  
    2525     * Holds the HTTP headers. Insert e.g. User-Agent here when default should not be used.
    2626     */
    27     public Map<String, String> headers = new HashMap<String, String>();
     27    public Map<String, String> headers = new HashMap<>();
    2828
    2929    public int timeoutConnect = 0;
  • applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/Tile.java

    r30223 r30426  
    297297        }
    298298        if (metadata == null) {
    299             metadata = new HashMap<String,String>();
     299            metadata = new HashMap<>();
    300300        }
    301301        metadata.put(key, value);
  • applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/BingAerialTileSource.java

    r30223 r30426  
    108108
    109109            NodeList imageryProviderNodes = (NodeList) xpath.compile("//ImageryMetadata/ImageryProvider").evaluate(document, XPathConstants.NODESET);
    110             List<Attribution> attributions = new ArrayList<Attribution>(imageryProviderNodes.getLength());
     110            List<Attribution> attributions = new ArrayList<>(imageryProviderNodes.getLength());
    111111            for (int i = 0; i < imageryProviderNodes.getLength(); i++) {
    112112                Node providerNode = imageryProviderNodes.item(i);
  • applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/TemplatedTMSTileSource.java

    r30377 r30426  
    1212    private Random rand = null;
    1313    private String[] randomParts = null;
    14     private Map<String, String> headers = new HashMap<String, String>();
     14    private Map<String, String> headers = new HashMap<>();
    1515
    1616    public static final String PATTERN_ZOOM    = "\\{(?:(\\d+)-)?z(?:oom)?([+-]\\d+)?\\}";
Note: See TracChangeset for help on using the changeset viewer.