@Test public void inMemoryTileCacheTestTest() { for (int tileSize : TILE_SIZES) { TileCache tileCache = new InMemoryTileCache(1); Assert.assertEquals(1, tileCache.getCapacity()); Tile tile1 = new Tile(1, 1, (byte) 1); Tile tile2 = new Tile(2, 2, (byte) 2); TileSource tileSource = OpenStreetMapMapnik.INSTANCE; File mapFile = new File("map.file"); XmlRenderTheme xmlRenderTheme = InternalRenderTheme.OSMARENDER; Job job1 = new DownloadJob(tile1, tileSize, tileSource); Job job2 = new RendererJob(tile2, mapFile, xmlRenderTheme, new DisplayModel(), 1, false); Assert.assertFalse(tileCache.containsKey(job1)); Assert.assertFalse(tileCache.containsKey(job2)); Assert.assertNull(tileCache.get(job1)); Assert.assertNull(tileCache.get(job2)); TileBitmap bitmap1 = GRAPHIC_FACTORY.createTileBitmap(tileSize, true); tileCache.put(job1, bitmap1); Assert.assertTrue(tileCache.containsKey(job1)); Assert.assertFalse(tileCache.containsKey(job2)); Assert.assertEquals(bitmap1, tileCache.get(job1)); Assert.assertNull(tileCache.get(job2)); TileBitmap bitmap2 = GRAPHIC_FACTORY.createTileBitmap(tileSize, true); tileCache.put(job2, bitmap2); Assert.assertFalse(tileCache.containsKey(job1)); Assert.assertTrue(tileCache.containsKey(job2)); Assert.assertNull(tileCache.get(job1)); Assert.assertEquals(bitmap2, tileCache.get(job2)); tileCache.destroy(); Assert.assertFalse(tileCache.containsKey(job1)); Assert.assertFalse(tileCache.containsKey(job2)); Assert.assertNull(tileCache.get(job1)); Assert.assertNull(tileCache.get(job2)); } }
public InMemoryTileCache(int capacity) { this.lruCache = new BitmapLRUCache(capacity); }
InMemoryTileCache implements TileCache { public InMemoryTileCache(int capacity) { this.lruCache = new BitmapLRUCache(capacity); } }
InMemoryTileCache implements TileCache { public InMemoryTileCache(int capacity) { this.lruCache = new BitmapLRUCache(capacity); } InMemoryTileCache(int capacity); }
InMemoryTileCache implements TileCache { public InMemoryTileCache(int capacity) { this.lruCache = new BitmapLRUCache(capacity); } InMemoryTileCache(int capacity); @Override synchronized boolean containsKey(Job key); @Override synchronized void destroy(); @Override synchronized TileBitmap get(Job key); @Override synchronized int getCapacity(); @Override synchronized void put(Job key, TileBitmap bitmap); synchronized void setCapacity(int capacity); }
InMemoryTileCache implements TileCache { public InMemoryTileCache(int capacity) { this.lruCache = new BitmapLRUCache(capacity); } InMemoryTileCache(int capacity); @Override synchronized boolean containsKey(Job key); @Override synchronized void destroy(); @Override synchronized TileBitmap get(Job key); @Override synchronized int getCapacity(); @Override synchronized void put(Job key, TileBitmap bitmap); synchronized void setCapacity(int capacity);  }