当前位置: 首页>>代码示例>>Java>>正文


Java SystemOfUnits类代码示例

本文整理汇总了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());
   }
 
开发者ID:unitsofmeasurement,项目名称:uom-systems,代码行数:22,代码来源:SystemOfUnitsServiceTest.java

示例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);
   }
 
开发者ID:unitsofmeasurement,项目名称:uom-systems,代码行数:9,代码来源:CLDRSystemService.java

示例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());
   }
 
开发者ID:unitsofmeasurement,项目名称:uom-systems,代码行数:13,代码来源:SystemOfUnitsServiceTest.java

示例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);
   }
 
开发者ID:unitsofmeasurement,项目名称:uom-systems,代码行数:16,代码来源:SystemOfUnitsServiceTest.java

示例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());
   }
 
开发者ID:unitsofmeasurement,项目名称:uom-systems,代码行数:12,代码来源:SystemOfUnitsServiceTest.java

示例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());
   }
 
开发者ID:unitsofmeasurement,项目名称:uom-systems,代码行数:12,代码来源:SystemOfUnitsServiceTest.java

示例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);
   }
 
开发者ID:unitsofmeasurement,项目名称:uom-systems,代码行数:15,代码来源:SystemOfUnitsServiceTest.java

示例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);
   }
 
开发者ID:unitsofmeasurement,项目名称:uom-systems,代码行数:9,代码来源:CommonSystemService.java

示例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());
   }
 
开发者ID:unitsofmeasurement,项目名称:uom-systems,代码行数:12,代码来源:SystemOfUnitsServiceTest.java

示例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());
   }
 
开发者ID:unitsofmeasurement,项目名称:uom-systems,代码行数:12,代码来源:SystemOfUnitsServiceTest.java

示例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);
    }
}
   }
 
开发者ID:unitsofmeasurement,项目名称:uom-lib,代码行数:13,代码来源:SystemOfUnitsReporter.java

示例12: getAvailableSystemsOfUnits

import javax.measure.spi.SystemOfUnits; //导入依赖的package包/类
public Collection<SystemOfUnits> getAvailableSystemsOfUnits() {
return souMap.values();
   }
 
开发者ID:unitsofmeasurement,项目名称:uom-systems,代码行数:4,代码来源:CLDRSystemService.java

示例13: main

import javax.measure.spi.SystemOfUnits; //导入依赖的package包/类
public static void main(String... args) {
	SystemOfUnits sou = Units.getInstance();
	testSoU(sou);
}
 
开发者ID:unitsofmeasurement,项目名称:uom-demos,代码行数:5,代码来源:SystemsDemo.java

示例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);
	}
}
 
开发者ID:unitsofmeasurement,项目名称:uom-demos,代码行数:7,代码来源:SystemsDemo.java

示例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();
	}
}
 
开发者ID:unitsofmeasurement,项目名称:uom-demos,代码行数:7,代码来源:SystemsDemo.java


注:本文中的javax.measure.spi.SystemOfUnits类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。