@Test public void testDetermineDestinationOffsets_met_tx() { int[][] expected_met_tx_DestinationOffsets = {{0, 780000, 1560000, 2340000, 3120000}, {260000, 1040000, 1820000, 2600000, 3380000}, {520000, 1300000, 2080000, 2860000, 3640000}}; int[] sectionSizes_met_tx = new int[]{260000, 260000, 260000}; int[] rowOffsets = new int[]{0, 2000, 4000}; int[] numberOfRows = new int[]{2000, 2000, 2000}; int[][] sourceOffsets = new int[][]{{0, 260000, 520000, 780000, 1040000}, {0, 260000, 520000, 780000, 1040000}, {0, 260000, 520000, 780000, 1040000}}; final int[][] actual_met_tx_DestinationOffsets = NcFileStitcher.determineDestinationOffsets(rowOffsets, numberOfRows, sectionSizes_met_tx, sourceOffsets); for (int i = 0; i < expected_met_tx_DestinationOffsets.length; i++) { assertArrayEquals(expected_met_tx_DestinationOffsets[i], actual_met_tx_DestinationOffsets[i]); } }
static int[][] determineDestinationOffsets(int[] rowOffsets, int[] numberOfRows, int[] sectionSizes, int[][] sourceOffsets) { int[][] destinationOffsets = new int[sectionSizes.length][]; int allSectionsSize = 0; for (int sectionSize : sectionSizes) { allSectionsSize += sectionSize; } for (int i = 0; i < sectionSizes.length; i++) { final int fileOffset = rowOffsets[i] * (sectionSizes[i] / numberOfRows[i]); destinationOffsets[i] = new int[sourceOffsets[i].length]; for (int j = 0; j < sourceOffsets[i].length; j++) { destinationOffsets[i][j] = fileOffset + j * allSectionsSize; } } return destinationOffsets; }
NcFileStitcher { static int[][] determineDestinationOffsets(int[] rowOffsets, int[] numberOfRows, int[] sectionSizes, int[][] sourceOffsets) { int[][] destinationOffsets = new int[sectionSizes.length][]; int allSectionsSize = 0; for (int sectionSize : sectionSizes) { allSectionsSize += sectionSize; } for (int i = 0; i < sectionSizes.length; i++) { final int fileOffset = rowOffsets[i] * (sectionSizes[i] / numberOfRows[i]); destinationOffsets[i] = new int[sourceOffsets[i].length]; for (int j = 0; j < sourceOffsets[i].length; j++) { destinationOffsets[i][j] = fileOffset + j * allSectionsSize; } } return destinationOffsets; } }
NcFileStitcher { static int[][] determineDestinationOffsets(int[] rowOffsets, int[] numberOfRows, int[] sectionSizes, int[][] sourceOffsets) { int[][] destinationOffsets = new int[sectionSizes.length][]; int allSectionsSize = 0; for (int sectionSize : sectionSizes) { allSectionsSize += sectionSize; } for (int i = 0; i < sectionSizes.length; i++) { final int fileOffset = rowOffsets[i] * (sectionSizes[i] / numberOfRows[i]); destinationOffsets[i] = new int[sourceOffsets[i].length]; for (int j = 0; j < sourceOffsets[i].length; j++) { destinationOffsets[i][j] = fileOffset + j * allSectionsSize; } } return destinationOffsets; }  }
NcFileStitcher { static int[][] determineDestinationOffsets(int[] rowOffsets, int[] numberOfRows, int[] sectionSizes, int[][] sourceOffsets) { int[][] destinationOffsets = new int[sectionSizes.length][]; int allSectionsSize = 0; for (int sectionSize : sectionSizes) { allSectionsSize += sectionSize; } for (int i = 0; i < sectionSizes.length; i++) { final int fileOffset = rowOffsets[i] * (sectionSizes[i] / numberOfRows[i]); destinationOffsets[i] = new int[sourceOffsets[i].length]; for (int j = 0; j < sourceOffsets[i].length; j++) { destinationOffsets[i][j] = fileOffset + j * allSectionsSize; } } return destinationOffsets; }   }
NcFileStitcher { static int[][] determineDestinationOffsets(int[] rowOffsets, int[] numberOfRows, int[] sectionSizes, int[][] sourceOffsets) { int[][] destinationOffsets = new int[sectionSizes.length][]; int allSectionsSize = 0; for (int sectionSize : sectionSizes) { allSectionsSize += sectionSize; } for (int i = 0; i < sectionSizes.length; i++) { final int fileOffset = rowOffsets[i] * (sectionSizes[i] / numberOfRows[i]); destinationOffsets[i] = new int[sourceOffsets[i].length]; for (int j = 0; j < sourceOffsets[i].length; j++) { destinationOffsets[i][j] = fileOffset + j * allSectionsSize; } } return destinationOffsets; }    }