package org.djunits.demo.examples; import java.util.Locale; import org.djunits.locale.DefaultLocale; import org.djunits.unit.DurationUnit; import org.djunits.unit.util.UNITS; import org.djunits.value.vdouble.scalar.Duration; /** * This Java code demonstrates conversions between related unit using DJUNITS. *
* Copyright (c) 2015-2022 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
* BSD-style license. See DJUNITS License.
*
* @version $Revision: 672 $, $LastChangedDate: 2019-10-18 14:32:01 +0200 (Fri, 18 Oct 2019) $, by $Author: averbraeck $,
* initial version 3 sep. 2015
* @author Alexander Verbraeck
* @author Peter Knoppers
*/
public final class LocaleDemo implements UNITS
{
/** */
private LocaleDemo()
{
// utility constructor.
}
/**
* Create some scalar values to demonstrate conversion from and to related units.
* @param args String[]; the command line arguments; not used
*/
public static void main(final String[] args)
{
DefaultLocale.setLocale(Locale.forLanguageTag("NL"));
Duration hour = new Duration(3.0, DurationUnit.HOUR);
System.out.println(hour.toTextualString());
System.out.println(hour);
DefaultLocale.setLocale(Locale.US);
System.out.println(hour.toTextualString());
System.out.println(hour);
}
}