/** * Returns an ordered sequence of numeric values in the specified unit of measure. This * convenience method apply unit conversion on the fly as needed. * * @param unit The unit of measure for the value to be returned. * @return The sequence of values represented by this parameter after conversion to type {@code * double} and conversion to {@code unit}. * @throws InvalidParameterTypeException if the value is not an array of {@code double}s. * @throws IllegalArgumentException if the specified unit is invalid for this parameter. * @see #getUnit * @see #setValue(double[],Unit) * @see #doubleValue(Unit) */ public double[] doubleValueList(final Unit<?> unit) throws InvalidParameterTypeException { if (this.unit == null) { throw unitlessParameter(descriptor); } ensureNonNull("unit", unit); final int expectedID = getUnitMessageID(this.unit); if (getUnitMessageID(unit) != expectedID) { throw new IllegalArgumentException(Errors.format(expectedID, unit)); } UnitConverter converter = Units.getConverterToAny(this.unit, unit); final double[] values = doubleValueList().clone(); for (int i = 0; i < values.length; i++) { values[i] = converter.convert(values[i]); } return values; }