Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove display unit storage in class and resource bundle #5

Open
averbraeck opened this issue Jan 28, 2023 · 0 comments
Open

Remove display unit storage in class and resource bundle #5

averbraeck opened this issue Jan 28, 2023 · 0 comments
Assignees
Labels
simplification Simplification o code

Comments

@averbraeck
Copy link
Owner

averbraeck commented Jan 28, 2023

At the moment, all display units are stored in the quantity's unit class:

    public static final SpeedUnit KM_PER_HOUR = SI.deriveLinear(factorLD(LengthUnit.KILOMETER, 
            DurationUnit.HOUR), "km/h", "kilometer per hour", UnitSystem.SI_ACCEPTED, 
            "km/h", "km/h", "km/hr", "km/hour");

while the same information about the display units is also available in the language resource bundle:

Speed.km/h = km/h | kilometer per hour | km/hr | km/hour

For maintainability and flexibility uses, this information should be stored in only one place, preferably the resource bundle, since that information is now used to parse Locale-dependent input. This makes storage in the class superfluous.

@averbraeck averbraeck added the simplification Simplification o code label Jan 28, 2023
@averbraeck averbraeck self-assigned this Aug 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
simplification Simplification o code
Projects
None yet
Development

No branches or pull requests

1 participant