Skip to content

Provide a Measurement/Quantity List structure #3

@keilw

Description

@keilw

While it probably won't be more than an optional type in a module like "util" (similar to others like Range) how do you consider a "List Pattern" similar to Unicode CLDR:
http://cldr.unicode.org/index/downloads/cldr-24#TOC-Enhanced-units-structure

A new element specifies patterns for time durations involving combinations of hours, minutes, and seconds, such as "Video >length: 93:45".
or
These are intended to be used for constructing formats such as "2 hours, 5 minutes", "2 hrs, 5 mins", or "2h 5m"
Essentially it is similar to TemporalAmount: http://docs.oracle.com/javase/8/docs/api/java/time/temporal/TemporalAmount.html
in JSR 310, but unlike 310 there is no structural "array" of units in ICU4J.
Instead, e.g. MeasureFormat: http://icu-project.org/apiref/icu4j/com/ibm/icu/text/MeasureFormat.html allows formatting more than one measurement:
MeasureFormat fmtEn = MeasureFormat.getInstance(ULocale.ENGLISH, FormatWidth.WIDE);
// Output: 1 inch, 2 feet
fmtEn.formatMeasures(
new Measure(1, MeasureUnit.INCH),
new Measure(2, MeasureUnit.FOOT));
So it could be handled by Formatting/Parsing similar to ICU4J, where at most an array or collection of individual measurements is used, or via a structural type similar to JSR 310. I don't think we should overcomplicate the Measurement/Quantity type similar to TemporalAmount, but as with Range it could be provided in an optional module (or even just on RI level) if there's value to it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions