Java Code Examples for tec.uom.se.AbstractUnit#ONE
The following examples show how to use
tec.uom.se.AbstractUnit#ONE .
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: QuantityType.java From openhab-core with Eclipse Public License 2.0 | 5 votes |
@Override public String toFullString() { if (quantity.getUnit() == AbstractUnit.ONE) { return quantity.getValue().toString(); } else { return quantity.toString(); } }
Example 2
Source File: QuantityType.java From smarthome with Eclipse Public License 2.0 | 5 votes |
@Override public String toFullString() { if (quantity.getUnit() == AbstractUnit.ONE) { return quantity.getValue().toString(); } else { return quantity.toString(); } }
Example 3
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; }