MosaicTileHandler { Point[] getMissingTileIndices(Point start, Point stop) { List<Point> missing = new ArrayList<Point>(indices.length); boolean insert = (start == null); for (Point index : indices) { if (index.equals(stop)) { break; } else if (index.equals(start)) { insert = true; } else if (insert) { missing.add(index); } } return missing.toArray(new Point[missing.size()]); } MosaicTileHandler(MosaicGrid mosaicGrid); void handleTile(TileIndexWritable key, TileDataWritable data); void close();  }
@Test public void testGetMissingTileIndices() throws Exception { Point[] missingIndices = tileHandler.getMissingTileIndices(new Point(0, 0), new Point(2, 0)); assertNotNull(missingIndices); assertEquals(1, missingIndices.length); assertEquals(new Point(1, 0), missingIndices[0]); missingIndices = tileHandler.getMissingTileIndices(new Point(1, 0), new Point(2, 0)); assertNotNull(missingIndices); assertEquals(0, missingIndices.length); missingIndices = tileHandler.getMissingTileIndices(new Point(1, 0), new Point(2, 1)); assertNotNull(missingIndices); assertEquals(3, missingIndices.length); assertEquals(new Point(2, 0), missingIndices[0]); assertEquals(new Point(0, 1), missingIndices[1]); assertEquals(new Point(1, 1), missingIndices[2]); missingIndices = tileHandler.getMissingTileIndices(null, new Point(1, 1)); assertNotNull(missingIndices); assertEquals(4, missingIndices.length); assertEquals(new Point(0, 0), missingIndices[0]); assertEquals(new Point(1, 0), missingIndices[1]); assertEquals(new Point(2, 0), missingIndices[2]); assertEquals(new Point(0, 1), missingIndices[3]); missingIndices = tileHandler.getMissingTileIndices(new Point(0, 2), null); assertNotNull(missingIndices); assertEquals(2, missingIndices.length); assertEquals(new Point(1, 2), missingIndices[0]); assertEquals(new Point(2, 2), missingIndices[1]); }