@Test public void test_getRowIndex() { assertEquals(0, grid.getRowIndex(0)); assertEquals(1, grid.getRowIndex(3)); assertEquals(2, grid.getRowIndex(3 + 9)); assertEquals(3, grid.getRowIndex(3 + 9 + 16)); assertEquals(4, grid.getRowIndex(3 + 9 + 16 + 22)); assertEquals(2160 / 2 - 1, grid.getRowIndex(5940422 / 2 - 4320)); assertEquals(2160 / 2, grid.getRowIndex(5940422 / 2)); assertEquals(2160 - 1 - 1, grid.getRowIndex(5940422 - (3) - 1)); assertEquals(2160 - 1 - 0, grid.getRowIndex(5940422 - (3))); assertEquals(2160 - 1 - 0, grid.getRowIndex(5940422 - (3) + 1)); assertEquals(2160 - 1 - 0, grid.getRowIndex(5940422 - (3) + 2)); assertEquals(2160 - 1 - 1, grid.getRowIndex(5940422 - (3 + 9))); assertEquals(2160 - 1 - 1, grid.getRowIndex(5940422 - (3 + 9) + 1)); assertEquals(2160 - 1 - 2, grid.getRowIndex(5940422 - (3 + 9 + 16))); assertEquals(2160 - 1 - 3, grid.getRowIndex(5940422 - (3 + 9 + 16 + 22))); assertEquals(-1, grid.getRowIndex(-1000)); assertEquals(-1, grid.getRowIndex(-1)); assertEquals(-1, grid.getRowIndex(5940422)); assertEquals(-1, grid.getRowIndex(5940422 + 1000)); }
public int getRowIndex(int binIndex) { final int[] binOffsets = this.binOffsets; final int totalBinCount = this.totalBinCount; int iL = 0; int iU = rowCount - 1; int iM; if (binIndex < 0 || binIndex >= totalBinCount) { return -1; } do { iM = (iL + iU - 1) / 2; if (binIndex < binOffsets[iM]) { iU = iM; } else if (binIndex >= binOffsets[iM + 1]) { iL = iM + 1; } else { return iM; } } while (iL != iU); return iL; }
ISINGrid { public int getRowIndex(int binIndex) { final int[] binOffsets = this.binOffsets; final int totalBinCount = this.totalBinCount; int iL = 0; int iU = rowCount - 1; int iM; if (binIndex < 0 || binIndex >= totalBinCount) { return -1; } do { iM = (iL + iU - 1) / 2; if (binIndex < binOffsets[iM]) { iU = iM; } else if (binIndex >= binOffsets[iM + 1]) { iL = iM + 1; } else { return iM; } } while (iL != iU); return iL; } }
ISINGrid { public int getRowIndex(int binIndex) { final int[] binOffsets = this.binOffsets; final int totalBinCount = this.totalBinCount; int iL = 0; int iU = rowCount - 1; int iM; if (binIndex < 0 || binIndex >= totalBinCount) { return -1; } do { iM = (iL + iU - 1) / 2; if (binIndex < binOffsets[iM]) { iU = iM; } else if (binIndex >= binOffsets[iM + 1]) { iL = iM + 1; } else { return iM; } } while (iL != iU); return iL; } ISINGrid(int rowCount); }
ISINGrid { public int getRowIndex(int binIndex) { final int[] binOffsets = this.binOffsets; final int totalBinCount = this.totalBinCount; int iL = 0; int iU = rowCount - 1; int iM; if (binIndex < 0 || binIndex >= totalBinCount) { return -1; } do { iM = (iL + iU - 1) / 2; if (binIndex < binOffsets[iM]) { iU = iM; } else if (binIndex >= binOffsets[iM + 1]) { iL = iM + 1; } else { return iM; } } while (iL != iU); return iL; } 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); }
ISINGrid { public int getRowIndex(int binIndex) { final int[] binOffsets = this.binOffsets; final int totalBinCount = this.totalBinCount; int iL = 0; int iU = rowCount - 1; int iM; if (binIndex < 0 || binIndex >= totalBinCount) { return -1; } do { iM = (iL + iU - 1) / 2; if (binIndex < binOffsets[iM]) { iU = iM; } else if (binIndex >= binOffsets[iM + 1]) { iL = iM + 1; } else { return iM; } } while (iL != iU); return iL; } 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; }