@Test public void getRecordIndices() throws Exception { double[] recordIndices; recordIndices = MetadataPlotPanel.getRecordIndices(3, 5, 10); assertArrayEquals(new double[]{3, 4, 5, 6, 7}, recordIndices, 1.0e-6); recordIndices = MetadataPlotPanel.getRecordIndices(3, 8, 10); assertArrayEquals(new double[]{3, 4, 5, 6, 7, 8, 9, 10}, recordIndices, 1.0e-6); recordIndices = MetadataPlotPanel.getRecordIndices(12, 8, 10); assertArrayEquals(new double[]{10}, recordIndices, 1.0e-6); }
static double[] getRecordIndices(int startIndex, int recordsPerPlot, int numRecords) { int clippedStartIndex = Math.max(1, Math.min(startIndex, numRecords)); int clippedEndIndex = Math.min(numRecords, Math.min((startIndex - 1) + recordsPerPlot, numRecords)); double[] indexArray = new double[clippedEndIndex - clippedStartIndex + 1]; Arrays.setAll(indexArray, index -> index + clippedStartIndex); return indexArray; }
MetadataPlotPanel extends ChartPagePanel { static double[] getRecordIndices(int startIndex, int recordsPerPlot, int numRecords) { int clippedStartIndex = Math.max(1, Math.min(startIndex, numRecords)); int clippedEndIndex = Math.min(numRecords, Math.min((startIndex - 1) + recordsPerPlot, numRecords)); double[] indexArray = new double[clippedEndIndex - clippedStartIndex + 1]; Arrays.setAll(indexArray, index -> index + clippedStartIndex); return indexArray; } }
MetadataPlotPanel extends ChartPagePanel { static double[] getRecordIndices(int startIndex, int recordsPerPlot, int numRecords) { int clippedStartIndex = Math.max(1, Math.min(startIndex, numRecords)); int clippedEndIndex = Math.min(numRecords, Math.min((startIndex - 1) + recordsPerPlot, numRecords)); double[] indexArray = new double[clippedEndIndex - clippedStartIndex + 1]; Arrays.setAll(indexArray, index -> index + clippedStartIndex); return indexArray; } MetadataPlotPanel(TopComponent parentComponent, String helpId); }
MetadataPlotPanel extends ChartPagePanel { static double[] getRecordIndices(int startIndex, int recordsPerPlot, int numRecords) { int clippedStartIndex = Math.max(1, Math.min(startIndex, numRecords)); int clippedEndIndex = Math.min(numRecords, Math.min((startIndex - 1) + recordsPerPlot, numRecords)); double[] indexArray = new double[clippedEndIndex - clippedStartIndex + 1]; Arrays.setAll(indexArray, index -> index + clippedStartIndex); return indexArray; } MetadataPlotPanel(TopComponent parentComponent, String helpId); @Override void nodeDataChanged(ProductNodeEvent event); }
MetadataPlotPanel extends ChartPagePanel { static double[] getRecordIndices(int startIndex, int recordsPerPlot, int numRecords) { int clippedStartIndex = Math.max(1, Math.min(startIndex, numRecords)); int clippedEndIndex = Math.min(numRecords, Math.min((startIndex - 1) + recordsPerPlot, numRecords)); double[] indexArray = new double[clippedEndIndex - clippedStartIndex + 1]; Arrays.setAll(indexArray, index -> index + clippedStartIndex); return indexArray; } MetadataPlotPanel(TopComponent parentComponent, String helpId); @Override void nodeDataChanged(ProductNodeEvent event); static final SimpleDateFormat SIMPLE_DATE_FORMAT; static final String TOOL_TIP_FORMAT; static final String ITEM_LABEL_FORMAT; }