ISINGrid { public Point getGridPoint(int binIndex, Point gridPoint) { final int rowIndex = getRowIndex(binIndex); gridPoint.x = (rowIndex == -1) ? -1 : (binIndex - binOffsets[rowIndex]); gridPoint.y = rowIndex; return gridPoint; } ISINGrid(int rowCount); int getRowCount(); double getBinSize(); double getDeltaLat(); int getTotalBinCount(); double getLat(int rowIndex); double getDeltaLon(int rowIndex); int getRowLength(int rowIndex); int getBinOffset(int rowIndex); int getRowIndex(int binIndex); Point getGridPoint(int binIndex, Point gridPoint); int getBinIndex(Point gridPoint); int getColIndex(int rowIndex, double lon); int getBinIndex(int rowIndex, double lon); static int detectRowCount(String productName); static final double RE; static final int DEFAULT_ROW_COUNT; }
@Test public void test_getGridPoint() { final Point point = new Point(); assertEquals(new Point(2, 0), grid.getGridPoint((0) + 2, point)); assertEquals(new Point(7, 1), grid.getGridPoint((3) + 7, point)); assertEquals(new Point(11, 2), grid.getGridPoint((3 + 9) + 11, point)); assertEquals(new Point(19, 3), grid.getGridPoint((3 + 9 + 16) + 19, point)); assertEquals(new Point(25, 4), grid.getGridPoint((3 + 9 + 16 + 22) + 25, point)); assertEquals(new Point(632, 2160 / 2 - 1), grid.getGridPoint((5940422 / 2 - 4320) + 632, point)); assertEquals(new Point(1743, 2160 / 2), grid.getGridPoint((5940422 / 2) + 1743, point)); assertEquals(new Point(1, 2160 - 1 - 0), grid.getGridPoint(5940422 - (3) + 1, point)); assertEquals(new Point(6, 2160 - 1 - 1), grid.getGridPoint(5940422 - (3 + 9) + 6, point)); assertEquals(new Point(15, 2160 - 1 - 2), grid.getGridPoint(5940422 - (3 + 9 + 16) + 15, point)); assertEquals(new Point(20, 2160 - 1 - 3), grid.getGridPoint(5940422 - (3 + 9 + 16 + 22) + 20, point)); assertEquals(new Point(-1, -1), grid.getGridPoint(-1000, point)); assertEquals(new Point(-1, -1), grid.getGridPoint(-1, point)); assertEquals(new Point(-1, -1), grid.getGridPoint(5940422, point)); assertEquals(new Point(-1, -1), grid.getGridPoint(5940422 + 1000, point)); }