MosaicTileHandler { Point getRelativeTileIndex(TileIndexWritable key) { int tileX = key.getTileX() % mosaicGrid.getMacroTileSize(); int tileY = key.getTileY() % mosaicGrid.getMacroTileSize(); return new Point(tileX, tileY); } MosaicTileHandler(MosaicGrid mosaicGrid); void handleTile(TileIndexWritable key, TileDataWritable data); void close();  }
@Test public void testGetRelativeTileIndex() throws Exception { assertEquals(new Point(0, 0), tileHandler.getRelativeTileIndex(createKey(0, 0, 0, 0))); assertEquals(new Point(1, 0), tileHandler.getRelativeTileIndex(createKey(0, 0, 1, 0))); assertEquals(new Point(2, 1), tileHandler.getRelativeTileIndex(createKey(0, 0, 2, 1))); assertEquals(new Point(0, 0), tileHandler.getRelativeTileIndex(createKey(1, 2, 0, 0))); assertEquals(new Point(0, 0), tileHandler.getRelativeTileIndex(createKey(2, 1, 0, 0))); assertEquals(new Point(1, 0), tileHandler.getRelativeTileIndex(createKey(2, 1, 1, 0))); assertEquals(new Point(2, 1), tileHandler.getRelativeTileIndex(createKey(2, 1, 2, 1))); assertEquals(new Point(0, 0), tileHandler.getRelativeTileIndex(createKey(4, 10, 0, 0))); assertEquals(new Point(1, 0), tileHandler.getRelativeTileIndex(createKey(4, 10, 1, 0))); assertEquals(new Point(2, 1), tileHandler.getRelativeTileIndex(createKey(4, 10, 2, 1))); }