javax.measure.spi.SystemOfUnitsService Java Examples
The following examples show how to use
javax.measure.spi.SystemOfUnitsService.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SystemOfUnitsServiceTest.java From uom-systems with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Test // TODO consolidate asserts public void testUnitSystemServiceAlias() { final ServiceProvider cldrProvider = ServiceProvider.of("Unicode"); assertNotNull(cldrProvider); final SystemOfUnitsService cldrService = cldrProvider.getSystemOfUnitsService(); assertNotNull(cldrService); assertEquals("systems.uom.unicode.spi.CLDRSystemService", cldrService.getClass().getName()); SystemOfUnits system = cldrService.getSystemOfUnits("CLDR"); assertNotNull(system); assertEquals("systems.uom.unicode.CLDR", system.getClass().getName()); assertEquals("Unicode CLDR", system.getName()); assertNotNull(system.getUnits()); assertEquals(NUM_OF_UNITS_CLDR, system.getUnits().size()); SystemOfUnits system2 = cldrService.getSystemOfUnits("Unicode"); assertEquals(system, system2); }
Example #2
Source File: SystemOfUnitsServiceTest.java From uom-systems with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Test // TODO consolidate asserts public void testCommonUnitSystemServiceAlias() { final ServiceProvider commonProvider = ServiceProvider.of("Common"); assertNotNull(commonProvider); final SystemOfUnitsService commonService = commonProvider.getSystemOfUnitsService(); assertNotNull(commonService); assertEquals(COMMON_SERVICE_CLASSNAME, commonService.getClass().getName()); SystemOfUnits system = commonService.getSystemOfUnits("USCustomary"); assertNotNull(system); assertEquals("systems.uom.common.USCustomary", system.getClass().getName()); assertEquals("United States Customary Units", system.getName()); assertNotNull(system.getUnits()); assertEquals(NUM_OF_UNITS_US, system.getUnits().size()); SystemOfUnits system2 = commonService.getSystemOfUnits("US"); assertEquals(system, system2); system = commonService.getSystemOfUnits("CGS"); assertNotNull(system); assertEquals("Centimetre–gram–second System of Units", system.getName()); system2 = commonService.getSystemOfUnits("Centimetre–gram–second"); assertEquals(system, system2); assertEquals(NUM_OF_UNITS_CGS, system.getUnits().size()); }
Example #3
Source File: SystemOfUnitsServiceTest.java From uom-systems with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Test public void testCLDRUnitSystemService() { final ServiceProvider cldrProvider = ServiceProvider.of("Unicode"); assertNotNull(cldrProvider); final SystemOfUnitsService cldrService = cldrProvider.getSystemOfUnitsService(); assertNotNull(cldrService); assertEquals("systems.uom.unicode.spi.CLDRSystemService", cldrService.getClass().getName()); SystemOfUnits system = cldrService.getSystemOfUnits(); assertNotNull(system); assertEquals("systems.uom.unicode.CLDR", system.getClass().getName()); assertEquals("Unicode CLDR", system.getName()); assertNotNull(system.getUnits()); assertEquals(NUM_OF_UNITS_CLDR, system.getUnits().size()); }
Example #4
Source File: SystemOfUnitsServiceTest.java From uom-systems with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Test public void testCommonUnitSystemService() { final ServiceProvider commonProvider = ServiceProvider.of("Common"); assertNotNull(commonProvider); final SystemOfUnitsService commonService = commonProvider.getSystemOfUnitsService(); assertNotNull(commonService); assertEquals("systems.uom.common.spi.CommonSystemService", commonService.getClass().getName()); SystemOfUnits system = commonService.getSystemOfUnits(); assertNotNull(system); assertEquals("systems.uom.common.USCustomary", system.getClass().getName()); assertEquals("United States Customary Units", system.getName()); assertNotNull(system.getUnits()); assertEquals(NUM_OF_UNITS_US, system.getUnits().size()); }
Example #5
Source File: UnicodeServiceProvider.java From uom-systems with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public SystemOfUnitsService getSystemOfUnitsService() { return new CLDRSystemService(); }
Example #6
Source File: UCUMServiceProvider.java From uom-systems with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public SystemOfUnitsService getSystemOfUnitsService() { return new UCUMSystemService(); }
Example #7
Source File: CommonServiceProvider.java From uom-systems with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public SystemOfUnitsService getSystemOfUnitsService() { return new CommonSystemService(); }
Example #8
Source File: UnitServices.java From sis with Apache License 2.0 | 2 votes |
/** * Returns the service to obtain a {@link SystemOfUnits} instances. * The default implementation returns {@code this} since this {@code UnitServices} class * implements directly all relevant interfaces. The methods related to system of units are: * * <ul> * <li>{@link #getSystemOfUnits()}</li> * <li>{@link #getSystemOfUnits(String)}</li> * <li>{@link #getAvailableSystemsOfUnits()}</li> * </ul> * * @return the service to obtain a {@link SystemOfUnits}, or {@code null} if none. */ @Override public SystemOfUnitsService getSystemOfUnitsService() { return this; }