/** * Returns the band at the given index, creating it if needed. * If the given index is out of range, then this method logs a warning and returns {@code null}. * * @param key the key without its band number. Used only for formatting warning messages. * @param index the band index. */ private DefaultBand band(final String key, int index) { if (index < 1 || index > BAND_NAMES.length) { listeners.warning(errors().getString(Errors.Keys.UnexpectedValueInElement_2, key + index, index), null); return null; } DefaultBand band = bands[--index]; if (band == null) { band = new DefaultBand(); band.setDescription(new SimpleInternationalString(BAND_NAMES[index])); band.setPeakResponse((double) WAVELENGTHS[index]); band.setBoundUnits(Units.NANOMETRE); bands[index] = band; } return band; }
/** * Returns the band at the given index, creating it if needed. * If the given index is out of range, then this method logs a warning and returns {@code null}. * * @param key the key without its band number. Used only for formatting warning messages. * @param index the band index. */ private DefaultBand band(final String key, int index) { if (index < 1 || index > BAND_NAMES.length) { listeners.warning(errors().getString(Errors.Keys.UnexpectedValueInElement_2, key + index, index), null); return null; } DefaultBand band = bands[--index]; if (band == null) { band = new DefaultBand(); band.setDescription(new SimpleInternationalString(BAND_NAMES[index])); band.setPeakResponse((double) WAVELENGTHS[index]); band.setBoundUnits(Units.NANOMETRE); bands[index] = band; } return band; }