@Test public void getMaxTileNumberTest() { Assert.assertEquals(0, Tile.getMaxTileNumber((byte) 0)); Assert.assertEquals(1, Tile.getMaxTileNumber((byte) 1)); Assert.assertEquals(3, Tile.getMaxTileNumber((byte) 2)); Assert.assertEquals(7, Tile.getMaxTileNumber((byte) 3)); Assert.assertEquals(1023, Tile.getMaxTileNumber((byte) 10)); Assert.assertEquals(1048575, Tile.getMaxTileNumber((byte) 20)); Assert.assertEquals(1073741823, Tile.getMaxTileNumber((byte) 30)); verifyInvalidMaxTileNumber((byte) -1); verifyInvalidMaxTileNumber(Byte.MIN_VALUE); }
public static long getMaxTileNumber(byte zoomLevel) { if (zoomLevel < 0) { throw new IllegalArgumentException("zoomLevel must not be negative: " + zoomLevel); } else if (zoomLevel == 0) { return 0; } return (2 << zoomLevel - 1) - 1; }
Tile implements Serializable { public static long getMaxTileNumber(byte zoomLevel) { if (zoomLevel < 0) { throw new IllegalArgumentException("zoomLevel must not be negative: " + zoomLevel); } else if (zoomLevel == 0) { return 0; } return (2 << zoomLevel - 1) - 1; } }
Tile implements Serializable { public static long getMaxTileNumber(byte zoomLevel) { if (zoomLevel < 0) { throw new IllegalArgumentException("zoomLevel must not be negative: " + zoomLevel); } else if (zoomLevel == 0) { return 0; } return (2 << zoomLevel - 1) - 1; } Tile(long tileX, long tileY, byte zoomLevel); }
Tile implements Serializable { public static long getMaxTileNumber(byte zoomLevel) { if (zoomLevel < 0) { throw new IllegalArgumentException("zoomLevel must not be negative: " + zoomLevel); } else if (zoomLevel == 0) { return 0; } return (2 << zoomLevel - 1) - 1; } Tile(long tileX, long tileY, byte zoomLevel); static long getMaxTileNumber(byte zoomLevel); @Override boolean equals(Object obj); Tile getParent(); long getShiftX(Tile otherTile); long getShiftY(Tile otherTile); @Override int hashCode(); @Override String toString(); }
Tile implements Serializable { public static long getMaxTileNumber(byte zoomLevel) { if (zoomLevel < 0) { throw new IllegalArgumentException("zoomLevel must not be negative: " + zoomLevel); } else if (zoomLevel == 0) { return 0; } return (2 << zoomLevel - 1) - 1; } Tile(long tileX, long tileY, byte zoomLevel); static long getMaxTileNumber(byte zoomLevel); @Override boolean equals(Object obj); Tile getParent(); long getShiftX(Tile otherTile); long getShiftY(Tile otherTile); @Override int hashCode(); @Override String toString(); final long tileX; final long tileY; final byte zoomLevel; }