systems.uom.common.USCustomary Java Examples
The following examples show how to use
systems.uom.common.USCustomary.
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: CommonSystemService.java From uom-systems with BSD 3-Clause "New" or "Revised" License | 5 votes |
public CommonSystemService() { souMap.put("Imperial", Imperial.getInstance()); souMap.put(DEFAULT_SYSTEM_NAME, USCustomary.getInstance()); souMap.put("CGS", CGS.getInstance()); aliases.put("US", DEFAULT_SYSTEM_NAME); aliases.put("Centimetre–gram–second", "CGS"); }
Example #2
Source File: GeometryUtils.java From geowave with Apache License 2.0 | 5 votes |
public static Unit<Length> lookup(final String name) { final String lowerCaseName = name.toLowerCase(); Unit<Length> unit = lookup(SI.class, lowerCaseName); if (unit != null) { return unit; } unit = lookup(NonSI.class, lowerCaseName); if (unit != null) { return unit; } if (lowerCaseName.endsWith("s")) { return lookup(lowerCaseName.substring(0, lowerCaseName.length() - 1)); } if (lowerCaseName.startsWith("kilo") && (lowerCaseName.length() > 4)) { final Unit<Length> u = lookup(lowerCaseName.substring(4)); if (u != null) { return u.multiply(1000); } } // if we get here, try some aliases if (lowerCaseName.equals("feet")) { return USCustomary.FOOT; } // if we get here, try some aliases if (lowerCaseName.equals("meter")) { return Units.METRE; } if (lowerCaseName.equals("unity")) { return (Unit) AbstractUnit.ONE; } return null; }