本文整理汇总了Java中javax.measure.spi.SystemOfUnits类的典型用法代码示例。如果您正苦于以下问题:Java SystemOfUnits类的具体用法?Java SystemOfUnits怎么用?Java SystemOfUnits使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SystemOfUnits类属于javax.measure.spi包,在下文中一共展示了SystemOfUnits类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testUnitSystemServiceAlias
import javax.measure.spi.SystemOfUnits; //导入依赖的package包/类
@Test
// TODO consolidate asserts
public void testUnitSystemServiceAlias() {
assertNotNull(defaultService);
assertEquals("systems.uom.common.internal.CommonSystemService", defaultService.getClass().getName());
SystemOfUnits system = defaultService.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 = defaultService.getSystemOfUnits("US");
assertEquals(system, system2);
system = defaultService.getSystemOfUnits("CGS");
assertNotNull(system);
assertEquals("Centimetre–gram–second System of Units", system.getName());
system2 = defaultService.getSystemOfUnits("Centimetre–gram–second");
assertEquals(system, system2);
assertEquals(NUM_OF_UNITS_CGS, system.getUnits().size());
}
示例2: getSystemOfUnits
import javax.measure.spi.SystemOfUnits; //导入依赖的package包/类
@Override
public SystemOfUnits getSystemOfUnits(String name) {
String alias = aliases.get(name);
if (alias != null && alias.length() > 0) {
return souMap.get(alias);
}
return souMap.get(name);
}
示例3: testDefaultUnitSystemService
import javax.measure.spi.SystemOfUnits; //导入依赖的package包/类
@Test
public void testDefaultUnitSystemService() {
assertNotNull(defaultService);
assertEquals("systems.uom.unicode.internal.CLDRSystemService",
defaultService.getClass().getName());
SystemOfUnits system = defaultService.getSystemOfUnits();
assertNotNull(system);
assertEquals("systems.uom.unicode.CLDR", system.getClass().getName());
assertEquals("Unicode CLDR", system.getName());
assertNotNull(system.getUnits());
assertEquals(NUM_OF_UNITS, system.getUnits().size());
}
示例4: testUnitSystemServiceAlias
import javax.measure.spi.SystemOfUnits; //导入依赖的package包/类
@Test
// TODO consolidate asserts
public void testUnitSystemServiceAlias() {
assertNotNull(defaultService);
assertEquals("systems.uom.unicode.internal.CLDRSystemService",
defaultService.getClass().getName());
SystemOfUnits system = defaultService.getSystemOfUnits("CLDR");
assertNotNull(system);
assertEquals("systems.uom.unicode.CLDR", system.getClass().getName());
assertEquals("Unicode CLDR", system.getName());
assertNotNull(system.getUnits());
assertEquals(NUM_OF_UNITS, system.getUnits().size());
SystemOfUnits system2 = defaultService.getSystemOfUnits("Unicode");
assertEquals(system, system2);
}
示例5: testDefaultUnitSystemService
import javax.measure.spi.SystemOfUnits; //导入依赖的package包/类
@Test
public void testDefaultUnitSystemService() {
assertNotNull(defaultService);
assertEquals("systems.uom.common.internal.CommonSystemService", defaultService.getClass().getName());
SystemOfUnits system = defaultService.getSystemOfUnits();
assertNotNull(system);
assertEquals("systems.uom.common.USCustomary", system.getClass().getName());
assertEquals(EXPECTED_SYSTEM_NAME, system.getName());
assertNotNull(system.getUnits());
assertEquals(NUM_OF_UNITS_US, system.getUnits().size());
}
示例6: testDefaultUnitSystemService
import javax.measure.spi.SystemOfUnits; //导入依赖的package包/类
@Test
public void testDefaultUnitSystemService() {
assertNotNull(defaultService);
assertEquals("systems.uom.ucum.internal.UCUMSystemService", defaultService.getClass().getName());
SystemOfUnits system = defaultService.getSystemOfUnits();
assertNotNull(system);
assertEquals("systems.uom.ucum.UCUM", system.getClass().getName());
assertEquals(EXPECTED_SYSTEM_NAME, system.getName());
assertNotNull(system.getUnits());
assertEquals(NUM_OF_UNITS, system.getUnits().size());
}
示例7: testUnitSystemServiceAlias
import javax.measure.spi.SystemOfUnits; //导入依赖的package包/类
@Test
// TODO consolidate asserts
public void testUnitSystemServiceAlias() {
assertNotNull(defaultService);
assertEquals("systems.uom.ucum.internal.UCUMSystemService", defaultService.getClass().getName());
SystemOfUnits system = defaultService.getSystemOfUnits("UCUM");
assertNotNull(system);
assertEquals("systems.uom.ucum.UCUM", system.getClass().getName());
assertEquals("Unified Code for Units of Measure", system.getName());
assertNotNull(system.getUnits());
assertEquals(NUM_OF_UNITS, system.getUnits().size());
SystemOfUnits system2 = defaultService.getSystemOfUnits("Unified Code for Units of Measure");
assertEquals(system, system2);
}
示例8: getSystemOfUnits
import javax.measure.spi.SystemOfUnits; //导入依赖的package包/类
@Override
public SystemOfUnits getSystemOfUnits(String name) {
String alias = aliases.get(name);
if (alias != null && alias.length()>0) {
return souMap.get(alias);
}
return souMap.get(name);
}
示例9: testDefaultUnitSystemService
import javax.measure.spi.SystemOfUnits; //导入依赖的package包/类
@Test
public void testDefaultUnitSystemService() {
assertNotNull(defaultService);
assertEquals("systems.uom.common.internal.CommonSystemService", defaultService.getClass().getName());
SystemOfUnits system = defaultService.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());
}
示例10: testDefaultUnitSystemService
import javax.measure.spi.SystemOfUnits; //导入依赖的package包/类
@Test
public void testDefaultUnitSystemService() {
assertNotNull(defaultService);
assertEquals("systems.uom.unicode.internal.CLDRSystemService", defaultService.getClass().getName());
SystemOfUnits system = defaultService.getSystemOfUnits();
assertNotNull(system);
assertEquals("systems.uom.unicode.CLDR", system.getClass().getName());
assertEquals("Unicode CLDR", system.getName());
assertNotNull(system.getUnits());
assertEquals(NUM_OF_UNITS, system.getUnits().size());
}
示例11: printSoU
import javax.measure.spi.SystemOfUnits; //导入依赖的package包/类
private static void printSoU(final SystemOfUnits sou, final boolean showIndex) {
int index = 0;
System.out.println("Reporting " + sou.getName());
for (Unit<?> u : sou.getUnits()) {
index++;
if (showIndex) {
System.out.println(index + "; " + u.getName() + "; " + u.getSymbol() + "; " + u);
} else {
System.out.println(u.getName() + "; " + u.getSymbol() + "; " + u);
}
}
}
示例12: getAvailableSystemsOfUnits
import javax.measure.spi.SystemOfUnits; //导入依赖的package包/类
public Collection<SystemOfUnits> getAvailableSystemsOfUnits() {
return souMap.values();
}
示例13: main
import javax.measure.spi.SystemOfUnits; //导入依赖的package包/类
public static void main(String... args) {
SystemOfUnits sou = Units.getInstance();
testSoU(sou);
}
示例14: testSoU
import javax.measure.spi.SystemOfUnits; //导入依赖的package包/类
private static void testSoU(final SystemOfUnits sou) {
System.out.println("Testing " + sou.getName());
for (Unit<?> u : sou.getUnits()) {
System.out.println(u.getName() + "; " + u.getSymbol() + "; " + u);
}
}
示例15: main
import javax.measure.spi.SystemOfUnits; //导入依赖的package包/类
public static void main(String... args) {
for (SystemOfUnits s : ServiceProvider.current().getSystemOfUnitsService().getAvailableSystemsOfUnits()) {
SystemOfUnitsReporter.of(s).report(true);
System.out.println();
}
}