New Branch for Java 6/7
Signed-off-by: Werner Keil <werner.keil@gmx.net>
diff --git a/.gitignore b/.gitignore
index bf13b40..74c1e3e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,6 @@
-target/
-eclipse_config/
-.settings/
-thirdparty/
-bin/
-*.class
+target/
+eclipse_config/
+.settings/
+thirdparty/
+bin/
+*.class
diff --git a/bundles/.gitignore b/bundles/.gitignore
index 834befa..95cea85 100644
--- a/bundles/.gitignore
+++ b/bundles/.gitignore
@@ -1,3 +1,3 @@
-/src
-/.settings
-/target
+/src
+/.settings
+/target
diff --git a/bundles/org.eclipse.uomo.business.tests/.classpath b/bundles/org.eclipse.uomo.business.tests/.classpath
index 0b1bcf9..9bc33d3 100644
--- a/bundles/org.eclipse.uomo.business.tests/.classpath
+++ b/bundles/org.eclipse.uomo.business.tests/.classpath
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src/"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src/"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/bundles/org.eclipse.uomo.business.tests/.gitignore b/bundles/org.eclipse.uomo.business.tests/.gitignore
index ea8c4bf..0b42d2d 100644
--- a/bundles/org.eclipse.uomo.business.tests/.gitignore
+++ b/bundles/org.eclipse.uomo.business.tests/.gitignore
@@ -1 +1 @@
-/target
+/target
diff --git a/bundles/org.eclipse.uomo.business.tests/.settings/.gitignore b/bundles/org.eclipse.uomo.business.tests/.settings/.gitignore
index 0924da4..c14d360 100644
--- a/bundles/org.eclipse.uomo.business.tests/.settings/.gitignore
+++ b/bundles/org.eclipse.uomo.business.tests/.settings/.gitignore
@@ -1 +1 @@
-/org.eclipse.m2e.core.prefs
+/org.eclipse.m2e.core.prefs
diff --git a/bundles/org.eclipse.uomo.business.tests/META-INF/MANIFEST.MF b/bundles/org.eclipse.uomo.business.tests/META-INF/MANIFEST.MF
index 5767b13..8f1cb1a 100644
--- a/bundles/org.eclipse.uomo.business.tests/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.uomo.business.tests/META-INF/MANIFEST.MF
@@ -1,9 +1,9 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: UOMo Business Tests
-Bundle-SymbolicName: org.eclipse.uomo.business.tests
-Bundle-Version: 0.7.0.qualifier
-Bundle-Vendor: Eclipse Org
-Fragment-Host: org.eclipse.uomo.business;bundle-version="0.7.0"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Require-Bundle: org.junit;bundle-version="4.11.0"
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: UOMo Business Tests
+Bundle-SymbolicName: org.eclipse.uomo.business.tests
+Bundle-Version: 0.7.0.qualifier
+Bundle-Vendor: Eclipse Org
+Fragment-Host: org.eclipse.uomo.business;bundle-version="0.7.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: org.junit;bundle-version="4.11.0"
diff --git a/bundles/org.eclipse.uomo.business.tests/build.properties b/bundles/org.eclipse.uomo.business.tests/build.properties
index 34d2e4d..41eb6ad 100644
--- a/bundles/org.eclipse.uomo.business.tests/build.properties
+++ b/bundles/org.eclipse.uomo.business.tests/build.properties
@@ -1,4 +1,4 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/bundles/org.eclipse.uomo.business/.classpath b/bundles/org.eclipse.uomo.business/.classpath
index a625c7f..23d1b61 100644
--- a/bundles/org.eclipse.uomo.business/.classpath
+++ b/bundles/org.eclipse.uomo.business/.classpath
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src/main/java/"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src/main/java/"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/bundles/org.eclipse.uomo.business/.gitignore b/bundles/org.eclipse.uomo.business/.gitignore
index e7da900..1a315ce 100644
--- a/bundles/org.eclipse.uomo.business/.gitignore
+++ b/bundles/org.eclipse.uomo.business/.gitignore
@@ -1,3 +1,3 @@
-/target
-/.settings
-/target
+/target
+/.settings
+/target
diff --git a/bundles/org.eclipse.uomo.business/META-INF/MANIFEST.MF b/bundles/org.eclipse.uomo.business/META-INF/MANIFEST.MF
index ad457ac..c6b0579 100644
--- a/bundles/org.eclipse.uomo.business/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.uomo.business/META-INF/MANIFEST.MF
@@ -1,9 +1,9 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: UOMo Business
-Bundle-SymbolicName: org.eclipse.uomo.business
-Bundle-Version: 0.7.0.qualifier
-Bundle-Vendor: Eclipse.org
-Require-Bundle: org.eclipse.uomo.core;bundle-version="0.7.0",
- org.eclipse.uomo.units;bundle-version="0.5.0"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: UOMo Business
+Bundle-SymbolicName: org.eclipse.uomo.business
+Bundle-Version: 0.7.0.qualifier
+Bundle-Vendor: Eclipse.org
+Require-Bundle: org.eclipse.uomo.core;bundle-version="0.7.0",
+ org.eclipse.uomo.units;bundle-version="0.5.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/money/MoneyAmount.java b/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/money/MoneyAmount.java
index e62041b..dfb8d2c 100644
--- a/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/money/MoneyAmount.java
+++ b/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/money/MoneyAmount.java
@@ -1,713 +1,713 @@
-/**
- * Copyright (c) 2005, 2014, Werner Keil and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Werner Keil, Jean-Marie Dautelle - initial API and implementation
- */
-package org.eclipse.uomo.business.money;
-
-import java.math.BigInteger;
-import java.math.MathContext;
-import java.text.FieldPosition;
-import java.text.NumberFormat;
-
-import org.eclipse.uomo.business.internal.CurrencyUnit;
-import org.eclipse.uomo.business.internal.MonetaryAmount;
-import org.eclipse.uomo.business.internal.MonetaryOperator;
-import org.eclipse.uomo.business.types.IMoney;
-import org.eclipse.uomo.core.UOMoRuntimeException;
-import org.eclipse.uomo.units.AbstractConverter;
-import org.eclipse.uomo.units.IMeasure;
-import org.eclipse.uomo.units.QuantityAmount;
-import org.eclipse.uomo.units.impl.converter.RationalConverter;
-import org.unitsofmeasurement.unit.IncommensurableException;
-import org.unitsofmeasurement.unit.UnconvertibleException;
-import org.unitsofmeasurement.unit.Unit;
-import org.unitsofmeasurement.unit.UnitConverter;
-
-import com.ibm.icu.math.BigDecimal;
-import com.ibm.icu.util.Currency;
-
-/**
- * This class represents an amount of money specified in a given
- * {@link Currency} (convenience method).
- *
- * @author <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
- * @author <a href="mailto:units@catmedia.us">Werner Keil</a>
- * @version 0.7, $Date: 2014-08-03 $
- */
-public class MoneyAmount extends QuantityAmount<IMoney> implements IMoney, MonetaryAmount,
- Comparable<MonetaryAmount> {
-
- /**
- * Holds the base unit for money quantities (symbol "$").
- */
- public final static MoneyUnit<IMoney> UNIT = new MoneyUnit<IMoney>(
- "$");
-
- /**
- * Creates a money amount always on the heap independently from the current
- * {@link javolution.context.AllocatorContext allocator context}. To allow
- * for custom object allocation policies, static factory methods
- * <code>valueOf(...)</code> are recommended.
- *
- * @param value
- * the value stated in the specified currency.
- * @param currency
- * the currency in which the value is stated.
- */
- public MoneyAmount(Number value, MoneyUnit unit) {
- super(value, unit);
- }
-
- /**
- * Returns the money amount corresponding to the specified Number value
- * and currency.
- *
- * @param value
- * the value stated in the specified currency.
- * @param currency
- * the currency in which the value is stated.
- * @return the corresponding amount.
- */
- public static MoneyAmount of(Number value, CurrencyUnit currency) {
- return new MoneyAmount(value, (MoneyUnit)currency);
- }
-
- /**
- * Returns the money amount corresponding to the specified Number value
- * and currency.
- *
- * @param value
- * the value stated in the specified currency.
- * @param currency
- * the currency in which the value is stated.
- * @return the corresponding amount.
- */
-// static MoneyAmount of(Number value, java.util.Currency currency) {
-// MoneyAmount amount = new MoneyAmount(value, currency);
-// return amount;
-// }
-
- /**
- * Returns the money amount corresponding to the specified Number value
- * and currency.
- *
- * @param value
- * the value stated in the specified currency.
- * @param currency
- * the currency in which the value is stated.
- * @return the corresponding amount.
- */
- public static MoneyAmount of(Number value, Unit<?> currency) {
- return new MoneyAmount(value, (MoneyUnit) currency);
- }
-
- /**
- * Returns the money amount corresponding to the specified value and cents.
- *
- * @param value
- * the integer value in the specified currency.
- * @param cents
- * the cents value in the specified currency.
- * @param currency
- * the currency in which the value and cents are stated.
- * @return the corresponding amount.
- */
- public static MoneyAmount of(long value, int cents, Currency currency) {
- return new MoneyAmount(BigDecimal.valueOf(value * 100
- + cents, -2), (MoneyUnit) currency);
- }
-
- /**
- * Returns the money amount corresponding to the specified generic amount.
- *
- * @param amount
- * the raw amount.
- * @return the corresponding money amount stated in an existing
- * {@link Currency}.
- * @throws ClassCastException
- * if the SI unit of the specified amount is not a
- * {@link Currency}.
- */
- public static MoneyAmount of(QuantityAmount<IMoney> amount) {
- // MoneyAmount amountSI = amount.toSI();
- return MoneyAmount.of(BigDecimal.valueOf(amount.getValue()
- .doubleValue()), amount.unit().getSystemUnit());
- }
-
-
- /**
- * Returns the money amount corresponding to the specified Number value
- * and currency code.
- *
- * @param value
- * the value stated in the specified currency.
- * @param currency
- * the currency in which the value is stated.
- * @return the corresponding amount.
- */
- public static MoneyAmount of(String code, Number value) {
- return new MoneyAmount(value, MoneyUnit.of(code));
- }
-
- /**
- * Overrides the default {@link #toString()} to show only the currency
- * {@link Currency#getFractionDigits() fraction digits} of the associated
- * currency (e.g. rounding to closest cents).
- *
- * @return the string representation of this money amount.
- */
- public String toStringLocale() {
- BigDecimal value = (BigDecimal) this.getNumber();
- // int digits = ((Currency) this.getUnit()).getDefaultFractionDigits();
- // int exponent = value.getExponent();
- // LargeInteger significand = value.getSignificand();
- // int scale = exponent + digits;
- // significand = significand.E(scale);
- // exponent -= scale;
- // value = BigDecimal.valueOf(significand, exponent);
- NumberFormat numberFormat = NumberFormat.getInstance();
- StringBuffer tmp = new StringBuffer();
- numberFormat.format(value, tmp, new FieldPosition(0));
- tmp.append(' ');
- tmp.append(this.unit().toString());
- return tmp.toString();
- }
-
- // public MoneyAmount opposite() {
- // return MoneyAmount.valueOf(_value.opposite(), getCurrency());
- // }
-
- protected MoneyAmount plus(IMoney that) {
- // Measure<BigDecimal, ?> amount = that.to((Unit) getCurrency());
- return MoneyAmount.of(this.getNumber().doubleValue()
- + that.value().doubleValue(), getCurrency());
- }
-
- protected MoneyAmount plus(MoneyAmount that) {
- // Measure<BigDecimal, ?> amount = that.to((Unit) getCurrency());
- return MoneyAmount.of(this.getNumber().doubleValue()
- + that.getNumber().doubleValue(), getCurrency());
- }
-
- protected MoneyAmount minus(MoneyAmount that) {
- // MoneyAmount amount = that.to((Unit) getCurrency());
- return MoneyAmount.of(this.getNumber().doubleValue()
- - that.getNumber().doubleValue(), getCurrency());
- }
-
- public MoneyAmount multiply(Number that) {
- return MoneyAmount.of(
- getNumber().doubleValue() * that.doubleValue(), getCurrency());
- }
-
- public MoneyAmount multiply(long n) {
- return MoneyAmount.of(getNumber().longValue() * n,
- getCurrency());
- }
-
- public MoneyAmount multiply(MonetaryAmount that) {
- MoneyAmount ma = (MoneyAmount)that;
- return times(ma);
- }
-
- protected MoneyAmount times(MoneyAmount that) {
- Unit<?> unit = unit().multiply(that.unit());
- return MoneyAmount.of(((BigDecimal) getNumber())
- .multiply((BigDecimal) that.getNumber()), unit);
- }
-
- public MoneyAmount pow(int exp) {
- return MoneyAmount.of(((BigDecimal) getNumber()).pow(BigDecimal
- .valueOf(exp)), unit().pow(exp));
- }
-
- // protected MoneyAmount inverse() {
- // return MoneyAmount.valueOf(((BigDecimal) getNumber()).inverse(),
- // unit().inverse());
- // }
-
- public MoneyAmount divide(long n) {
- return MoneyAmount.of(getNumber().longValue() / n,
- getCurrency());
- }
-
- protected MoneyAmount divide(MoneyAmount that) {
- Unit<?> unit = unit().divide(that.unit());
- return MoneyAmount.of(((BigDecimal) getNumber())
- .divide((BigDecimal) that.getNumber()), unit);
- }
-
- public MoneyAmount copy() {
- return MoneyAmount.of(getNumber(), getCurrency());
- }
-
- /**
- * Get the unit (convenience to avoid cast).
- *
- * @draft UOMo 0.5
- * @provisional This API might change or be removed in a future release.
- */
- @SuppressWarnings("unchecked")
- public MoneyUnit<IMoney> unit() {
- return (MoneyUnit<IMoney>) getUnit();
- }
-
- public int compareTo(IMoney o) {
- // TODO Auto-generated method stub
- return 0;
- }
-
- public double doubleValue(Unit<IMoney> unit) {
- Unit<IMoney> myUnit = unit();
- try {
- UnitConverter converter = unit.getConverterToAny(myUnit);
- return converter.convert(getNumber().doubleValue());
- } catch (UnconvertibleException e) {
- throw e;
- } catch (IncommensurableException e) {
- throw new IllegalArgumentException(e.getMessage());
- }
- }
-
- public long longValue(Unit<IMoney> unit) throws ArithmeticException {
- Unit<IMoney> myUnit = unit();
- try {
- UnitConverter converter = unit.getConverterToAny(myUnit);
- return (converter.convert(BigDecimal.valueOf(super.getNumber()
- .longValue())).longValue());
- } catch (UnconvertibleException e) {
- throw e;
- } catch (IncommensurableException e) {
- throw new IllegalArgumentException(e.getMessage());
- }
- }
-
- public IMeasure<IMoney> divide(IMeasure<?> that) {
- return divide((MoneyAmount) that);
- }
-
- public IMeasure<IMoney> multiply(IMeasure<?> that) {
- return multiply((MonetaryAmount) that);
- }
-
- public IMeasure<IMoney> to(Unit<IMoney> unit) {
- return to(unit, MathContext.DECIMAL32);
- }
-
- protected IMeasure<IMoney> to(Unit<IMoney> unit, MathContext ctx) {
- if (this.unit().equals(unit))
- return this;
- UnitConverter cvtr = this.unit().getConverterTo(unit);
- if (cvtr == AbstractConverter.IDENTITY)
- return (IMeasure<IMoney>) of(this.getNumber(), unit);
- return (IMeasure<IMoney>) of(convert(this.getNumber(), cvtr, ctx),
- unit);
- }
-
- // Try to convert the specified value.
- private static Number convert(Number value, UnitConverter cvtr,
- MathContext ctx) {
- if (cvtr instanceof RationalConverter) { // Try converting through Field
- // methods.
- RationalConverter rCvtr = (RationalConverter) cvtr;
- BigInteger dividend = rCvtr.getDividend();
- BigInteger divisor = rCvtr.getDivisor();
- if (dividend.abs().compareTo(BigInteger.valueOf(Long.MAX_VALUE)) > 0)
- throw new ArithmeticException("Multiplier overflow");
- if (divisor.compareTo(BigInteger.valueOf(Long.MAX_VALUE)) > 0)
- throw new ArithmeticException("Divisor overflow");
- return (value.longValue() * dividend.longValue())
- / (divisor.longValue());
- } else if (cvtr instanceof AbstractConverter.Compound
- && cvtr.isLinear()) { // Do it in two parts.
- AbstractConverter.Compound compound = (AbstractConverter.Compound) cvtr;
- Number firstConversion = convert(value, compound.getRight(), ctx);
- Number secondConversion = convert(firstConversion,
- compound.getLeft(), ctx);
- return secondConversion;
- } else { // Try using BigDecimal as intermediate.
- BigDecimal decimalValue = BigDecimal.valueOf(value.doubleValue());
- Number newValue = cvtr.convert(decimalValue.toBigDecimal(), ctx);
- return newValue;
- // if (((FieldNumber)value) instanceof Decimal)
- // return (N)((FieldNumber)Decimal.valueOf(newValue));
- // if (((FieldNumber)value) instanceof Float64)
- // return (N)((FieldNumber)Float64.valueOf(newValue.doubleValue()));
- // throw new ArithmeticException(
- // "Generic amount conversion not implemented for amount of type " +
- // value.getClass());
- }
- }
-
- private final BigDecimal bigNumber() {
- if (getNumber() instanceof BigDecimal) {
- return (BigDecimal)getNumber();
- } else {
- throw new UOMoRuntimeException(
- new IllegalArgumentException("Cannot represent as BigDecimal"));
- }
- }
-
- /**
- * Generate a 'preference neutral' string from Money value.
- *
- * @return java.lang.String
- */
- public String serialize() {
- return null;
- }
-
- public Number value() {
- return getNumber();
- }
-
- public IMeasure<? extends IMeasure<IMoney>> inverse() {
- final IMeasure<? extends IMeasure<IMoney>> m = of(value(), unit()
- .inverse());
- return m;
- }
-
- public int compareTo(MonetaryAmount o) {
- // TODO Auto-generated method stub
- return 0;
- }
-
-
- public MonetaryAmount abs() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public MonetaryAmount add(Number augend) {
- // TODO Auto-generated method stub
- return null;
- }
-
-
- public MonetaryAmount divide(MonetaryAmount divisor) {
- // TODO Auto-generated method stub
- return null;
- }
-
-
- public MonetaryAmount divide(Number divisor) {
- // TODO Auto-generated method stub
- //return of((BigDecimal)value()).divide((BigDecimal)divisor));
- return null;
- }
-
-
- public MonetaryAmount[] divideAndRemainder(MonetaryAmount divisor) {
- // TODO Auto-generated method stub
- return null;
- }
-
-
- public MonetaryAmount[] divideAndRemainder(Number divisor) {
- // TODO Auto-generated method stub
- return null;
- }
-
-
- public MonetaryAmount divideToIntegralValue(MonetaryAmount divisor) {
- // TODO Auto-generated method stub
- return null;
- }
-
-
- public MonetaryAmount divideToIntegralValue(Number divisor) {
- // TODO Auto-generated method stub
- return null;
- }
-
-
- public MonetaryAmount negate() {
- // TODO Auto-generated method stub
- return null;
- }
-
-
- public MonetaryAmount plus() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public MonetaryAmount subtract(Number subtrahend) {
- // TODO Auto-generated method stub
- return null;
- }
-
-
- public MonetaryAmount ulp() {
- // TODO Auto-generated method stub
- return null;
- }
-
-
- public MonetaryAmount remainder(MonetaryAmount divisor) {
- // TODO Auto-generated method stub
- return null;
- }
-
-
- public MonetaryAmount remainder(Number divisor) {
- // TODO Auto-generated method stub
- return null;
- }
-
-
- public MonetaryAmount scaleByPowerOfTen(int n) {
- // TODO Auto-generated method stub
- return null;
- }
-
-
- public boolean isZero() {
- // TODO Auto-generated method stub
- return false;
- }
-
-
- public boolean isPositive() {
- // TODO Auto-generated method stub
- return false;
- }
-
-
- public boolean isPositiveOrZero() {
- // TODO Auto-generated method stub
- return false;
- }
-
-
- public boolean isNegative() {
- // TODO Auto-generated method stub
- return false;
- }
-
-
- public boolean isNegativeOrZero() {
- // TODO Auto-generated method stub
- return false;
- }
-
- public MonetaryAmount from(Number amount) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public MonetaryAmount from(CurrencyUnit currency, Number amount) {
- // TODO Auto-generated method stub
- return null;
- }
-
-
- public MonetaryAmount with(MonetaryOperator operator) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see MonetaryAmount#getScale()
- */
- public int getScale() {
- return this.bigNumber().scale();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see MonetaryAmount#getPrecision()
- */
- public int getPrecision() {
- return bigNumber().toBigDecimal().precision();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see MonetaryAmount#intValue()
- */
- public int intValue() {
- return this.getNumber().intValue();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see MonetaryAmount#intValueExact()
- */
- public int intValueExact() {
- return bigNumber().intValueExact();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see MonetaryAmount#longValue()
- */
- public long longValue() {
- return this.getNumber().longValue();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see MonetaryAmount#longValueExact()
- */
- public long longValueExact() {
- return bigNumber().longValueExact();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see MonetaryAmount#floatValue()
- */
- public float floatValue() {
- return this.getNumber().floatValue();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see MonetaryAmount#doubleValue()
- */
- public double doubleValue() {
- return this.getNumber().doubleValue();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see MonetaryAmount#byteValue()
- */
- public byte byteValue() {
- return this.getNumber().byteValue();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see MonetaryAmount#shortValue()
- */
- public short shortValue() {
- return getNumber().shortValue();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see MonetaryAmount#shortValueExact()
- */
- public short shortValueExact() {
- return bigNumber().shortValueExact();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see MonetaryAmount#signum()
- */
-
- public int signum() {
- return bigNumber().signum();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see MonetaryAmount#toEngineeringString()
- */
- public String toEngineeringString() {
- return getCurrency().getCurrencyCode() + ' '
- + bigNumber().toBigDecimal().toEngineeringString();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see MonetaryAmount#toPlainString()
- */
- public String toPlainString() {
- return getCurrency().getCurrencyCode() + ' '
- + bigNumber().toBigDecimal().toPlainString();
- }
-
- public boolean isLessThan(MonetaryAmount amount) {
- // TODO Auto-generated method stub
- return false;
- }
-
-
- public boolean isLessThanOrEqualTo(MonetaryAmount amount) {
- // TODO Auto-generated method stub
- return false;
- }
-
-
- public boolean isGreaterThan(MonetaryAmount amount) {
- // TODO Auto-generated method stub
- return false;
- }
-
-
- public boolean isGreaterThanOrEqualTo(MonetaryAmount amount) {
- // TODO Auto-generated method stub
- return false;
- }
-
-
- public boolean isEqualTo(MonetaryAmount amount) {
- // TODO Auto-generated method stub
- return false;
- }
-
-
- public boolean isNotEqualTo(MonetaryAmount amount) {
- return !getNumber().equals(amount);
- }
-
- public <T> T asType(Class<T> type) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Class<?> getNumberType() {
- return getNumber().getClass();
- }
-
- public CurrencyUnit getCurrency() {
- return (CurrencyUnit)unit();
- }
-
- @Override
- public IMoney add(IMeasure<IMoney> that) {
- return plus((IMoney) that);
- }
-
- @Override
- public MonetaryAmount add(MonetaryAmount augend) {
- return plus((MoneyAmount) augend);
- }
-
- @Override
- public IMeasure<IMoney> subtract(IMeasure<IMoney> that) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public MonetaryAmount subtract(MonetaryAmount subtrahend) {
- // TODO Auto-generated method stub
- return null;
- }
+/**
+ * Copyright (c) 2005, 2014, Werner Keil and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Werner Keil, Jean-Marie Dautelle - initial API and implementation
+ */
+package org.eclipse.uomo.business.money;
+
+import java.math.BigInteger;
+import java.math.MathContext;
+import java.text.FieldPosition;
+import java.text.NumberFormat;
+
+import org.eclipse.uomo.business.internal.CurrencyUnit;
+import org.eclipse.uomo.business.internal.MonetaryAmount;
+import org.eclipse.uomo.business.internal.MonetaryOperator;
+import org.eclipse.uomo.business.types.IMoney;
+import org.eclipse.uomo.core.UOMoRuntimeException;
+import org.eclipse.uomo.units.AbstractConverter;
+import org.eclipse.uomo.units.IMeasure;
+import org.eclipse.uomo.units.QuantityAmount;
+import org.eclipse.uomo.units.impl.converter.RationalConverter;
+import org.unitsofmeasurement.unit.IncommensurableException;
+import org.unitsofmeasurement.unit.UnconvertibleException;
+import org.unitsofmeasurement.unit.Unit;
+import org.unitsofmeasurement.unit.UnitConverter;
+
+import com.ibm.icu.math.BigDecimal;
+import com.ibm.icu.util.Currency;
+
+/**
+ * This class represents an amount of money specified in a given
+ * {@link Currency} (convenience method).
+ *
+ * @author <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
+ * @author <a href="mailto:units@catmedia.us">Werner Keil</a>
+ * @version 0.7, $Date: 2014-08-03 $
+ */
+public class MoneyAmount extends QuantityAmount<IMoney> implements IMoney, MonetaryAmount,
+ Comparable<MonetaryAmount> {
+
+ /**
+ * Holds the base unit for money quantities (symbol "$").
+ */
+ public final static MoneyUnit<IMoney> UNIT = new MoneyUnit<IMoney>(
+ "$");
+
+ /**
+ * Creates a money amount always on the heap independently from the current
+ * {@link javolution.context.AllocatorContext allocator context}. To allow
+ * for custom object allocation policies, static factory methods
+ * <code>valueOf(...)</code> are recommended.
+ *
+ * @param value
+ * the value stated in the specified currency.
+ * @param currency
+ * the currency in which the value is stated.
+ */
+ public MoneyAmount(Number value, MoneyUnit unit) {
+ super(value, unit);
+ }
+
+ /**
+ * Returns the money amount corresponding to the specified Number value
+ * and currency.
+ *
+ * @param value
+ * the value stated in the specified currency.
+ * @param currency
+ * the currency in which the value is stated.
+ * @return the corresponding amount.
+ */
+ public static MoneyAmount of(Number value, CurrencyUnit currency) {
+ return new MoneyAmount(value, (MoneyUnit)currency);
+ }
+
+ /**
+ * Returns the money amount corresponding to the specified Number value
+ * and currency.
+ *
+ * @param value
+ * the value stated in the specified currency.
+ * @param currency
+ * the currency in which the value is stated.
+ * @return the corresponding amount.
+ */
+// static MoneyAmount of(Number value, java.util.Currency currency) {
+// MoneyAmount amount = new MoneyAmount(value, currency);
+// return amount;
+// }
+
+ /**
+ * Returns the money amount corresponding to the specified Number value
+ * and currency.
+ *
+ * @param value
+ * the value stated in the specified currency.
+ * @param currency
+ * the currency in which the value is stated.
+ * @return the corresponding amount.
+ */
+ public static MoneyAmount of(Number value, Unit<?> currency) {
+ return new MoneyAmount(value, (MoneyUnit) currency);
+ }
+
+ /**
+ * Returns the money amount corresponding to the specified value and cents.
+ *
+ * @param value
+ * the integer value in the specified currency.
+ * @param cents
+ * the cents value in the specified currency.
+ * @param currency
+ * the currency in which the value and cents are stated.
+ * @return the corresponding amount.
+ */
+ public static MoneyAmount of(long value, int cents, Currency currency) {
+ return new MoneyAmount(BigDecimal.valueOf(value * 100
+ + cents, -2), (MoneyUnit) currency);
+ }
+
+ /**
+ * Returns the money amount corresponding to the specified generic amount.
+ *
+ * @param amount
+ * the raw amount.
+ * @return the corresponding money amount stated in an existing
+ * {@link Currency}.
+ * @throws ClassCastException
+ * if the SI unit of the specified amount is not a
+ * {@link Currency}.
+ */
+ public static MoneyAmount of(QuantityAmount<IMoney> amount) {
+ // MoneyAmount amountSI = amount.toSI();
+ return MoneyAmount.of(BigDecimal.valueOf(amount.getValue()
+ .doubleValue()), amount.unit().getSystemUnit());
+ }
+
+
+ /**
+ * Returns the money amount corresponding to the specified Number value
+ * and currency code.
+ *
+ * @param value
+ * the value stated in the specified currency.
+ * @param currency
+ * the currency in which the value is stated.
+ * @return the corresponding amount.
+ */
+ public static MoneyAmount of(String code, Number value) {
+ return new MoneyAmount(value, MoneyUnit.of(code));
+ }
+
+ /**
+ * Overrides the default {@link #toString()} to show only the currency
+ * {@link Currency#getFractionDigits() fraction digits} of the associated
+ * currency (e.g. rounding to closest cents).
+ *
+ * @return the string representation of this money amount.
+ */
+ public String toStringLocale() {
+ BigDecimal value = (BigDecimal) this.getNumber();
+ // int digits = ((Currency) this.getUnit()).getDefaultFractionDigits();
+ // int exponent = value.getExponent();
+ // LargeInteger significand = value.getSignificand();
+ // int scale = exponent + digits;
+ // significand = significand.E(scale);
+ // exponent -= scale;
+ // value = BigDecimal.valueOf(significand, exponent);
+ NumberFormat numberFormat = NumberFormat.getInstance();
+ StringBuffer tmp = new StringBuffer();
+ numberFormat.format(value, tmp, new FieldPosition(0));
+ tmp.append(' ');
+ tmp.append(this.unit().toString());
+ return tmp.toString();
+ }
+
+ // public MoneyAmount opposite() {
+ // return MoneyAmount.valueOf(_value.opposite(), getCurrency());
+ // }
+
+ protected MoneyAmount plus(IMoney that) {
+ // Measure<BigDecimal, ?> amount = that.to((Unit) getCurrency());
+ return MoneyAmount.of(this.getNumber().doubleValue()
+ + that.value().doubleValue(), getCurrency());
+ }
+
+ protected MoneyAmount plus(MoneyAmount that) {
+ // Measure<BigDecimal, ?> amount = that.to((Unit) getCurrency());
+ return MoneyAmount.of(this.getNumber().doubleValue()
+ + that.getNumber().doubleValue(), getCurrency());
+ }
+
+ protected MoneyAmount minus(MoneyAmount that) {
+ // MoneyAmount amount = that.to((Unit) getCurrency());
+ return MoneyAmount.of(this.getNumber().doubleValue()
+ - that.getNumber().doubleValue(), getCurrency());
+ }
+
+ public MoneyAmount multiply(Number that) {
+ return MoneyAmount.of(
+ getNumber().doubleValue() * that.doubleValue(), getCurrency());
+ }
+
+ public MoneyAmount multiply(long n) {
+ return MoneyAmount.of(getNumber().longValue() * n,
+ getCurrency());
+ }
+
+ public MoneyAmount multiply(MonetaryAmount that) {
+ MoneyAmount ma = (MoneyAmount)that;
+ return times(ma);
+ }
+
+ protected MoneyAmount times(MoneyAmount that) {
+ Unit<?> unit = unit().multiply(that.unit());
+ return MoneyAmount.of(((BigDecimal) getNumber())
+ .multiply((BigDecimal) that.getNumber()), unit);
+ }
+
+ public MoneyAmount pow(int exp) {
+ return MoneyAmount.of(((BigDecimal) getNumber()).pow(BigDecimal
+ .valueOf(exp)), unit().pow(exp));
+ }
+
+ // protected MoneyAmount inverse() {
+ // return MoneyAmount.valueOf(((BigDecimal) getNumber()).inverse(),
+ // unit().inverse());
+ // }
+
+ public MoneyAmount divide(long n) {
+ return MoneyAmount.of(getNumber().longValue() / n,
+ getCurrency());
+ }
+
+ protected MoneyAmount divide(MoneyAmount that) {
+ Unit<?> unit = unit().divide(that.unit());
+ return MoneyAmount.of(((BigDecimal) getNumber())
+ .divide((BigDecimal) that.getNumber()), unit);
+ }
+
+ public MoneyAmount copy() {
+ return MoneyAmount.of(getNumber(), getCurrency());
+ }
+
+ /**
+ * Get the unit (convenience to avoid cast).
+ *
+ * @draft UOMo 0.5
+ * @provisional This API might change or be removed in a future release.
+ */
+ @SuppressWarnings("unchecked")
+ public MoneyUnit<IMoney> unit() {
+ return (MoneyUnit<IMoney>) getUnit();
+ }
+
+ public int compareTo(IMoney o) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public double doubleValue(Unit<IMoney> unit) {
+ Unit<IMoney> myUnit = unit();
+ try {
+ UnitConverter converter = unit.getConverterToAny(myUnit);
+ return converter.convert(getNumber().doubleValue());
+ } catch (UnconvertibleException e) {
+ throw e;
+ } catch (IncommensurableException e) {
+ throw new IllegalArgumentException(e.getMessage());
+ }
+ }
+
+ public long longValue(Unit<IMoney> unit) throws ArithmeticException {
+ Unit<IMoney> myUnit = unit();
+ try {
+ UnitConverter converter = unit.getConverterToAny(myUnit);
+ return (converter.convert(BigDecimal.valueOf(super.getNumber()
+ .longValue())).longValue());
+ } catch (UnconvertibleException e) {
+ throw e;
+ } catch (IncommensurableException e) {
+ throw new IllegalArgumentException(e.getMessage());
+ }
+ }
+
+ public IMeasure<IMoney> divide(IMeasure<?> that) {
+ return divide((MoneyAmount) that);
+ }
+
+ public IMeasure<IMoney> multiply(IMeasure<?> that) {
+ return multiply((MonetaryAmount) that);
+ }
+
+ public IMeasure<IMoney> to(Unit<IMoney> unit) {
+ return to(unit, MathContext.DECIMAL32);
+ }
+
+ protected IMeasure<IMoney> to(Unit<IMoney> unit, MathContext ctx) {
+ if (this.unit().equals(unit))
+ return this;
+ UnitConverter cvtr = this.unit().getConverterTo(unit);
+ if (cvtr == AbstractConverter.IDENTITY)
+ return (IMeasure<IMoney>) of(this.getNumber(), unit);
+ return (IMeasure<IMoney>) of(convert(this.getNumber(), cvtr, ctx),
+ unit);
+ }
+
+ // Try to convert the specified value.
+ private static Number convert(Number value, UnitConverter cvtr,
+ MathContext ctx) {
+ if (cvtr instanceof RationalConverter) { // Try converting through Field
+ // methods.
+ RationalConverter rCvtr = (RationalConverter) cvtr;
+ BigInteger dividend = rCvtr.getDividend();
+ BigInteger divisor = rCvtr.getDivisor();
+ if (dividend.abs().compareTo(BigInteger.valueOf(Long.MAX_VALUE)) > 0)
+ throw new ArithmeticException("Multiplier overflow");
+ if (divisor.compareTo(BigInteger.valueOf(Long.MAX_VALUE)) > 0)
+ throw new ArithmeticException("Divisor overflow");
+ return (value.longValue() * dividend.longValue())
+ / (divisor.longValue());
+ } else if (cvtr instanceof AbstractConverter.Compound
+ && cvtr.isLinear()) { // Do it in two parts.
+ AbstractConverter.Compound compound = (AbstractConverter.Compound) cvtr;
+ Number firstConversion = convert(value, compound.getRight(), ctx);
+ Number secondConversion = convert(firstConversion,
+ compound.getLeft(), ctx);
+ return secondConversion;
+ } else { // Try using BigDecimal as intermediate.
+ BigDecimal decimalValue = BigDecimal.valueOf(value.doubleValue());
+ Number newValue = cvtr.convert(decimalValue.toBigDecimal(), ctx);
+ return newValue;
+ // if (((FieldNumber)value) instanceof Decimal)
+ // return (N)((FieldNumber)Decimal.valueOf(newValue));
+ // if (((FieldNumber)value) instanceof Float64)
+ // return (N)((FieldNumber)Float64.valueOf(newValue.doubleValue()));
+ // throw new ArithmeticException(
+ // "Generic amount conversion not implemented for amount of type " +
+ // value.getClass());
+ }
+ }
+
+ private final BigDecimal bigNumber() {
+ if (getNumber() instanceof BigDecimal) {
+ return (BigDecimal)getNumber();
+ } else {
+ throw new UOMoRuntimeException(
+ new IllegalArgumentException("Cannot represent as BigDecimal"));
+ }
+ }
+
+ /**
+ * Generate a 'preference neutral' string from Money value.
+ *
+ * @return java.lang.String
+ */
+ public String serialize() {
+ return null;
+ }
+
+ public Number value() {
+ return getNumber();
+ }
+
+ public IMeasure<? extends IMeasure<IMoney>> inverse() {
+ final IMeasure<? extends IMeasure<IMoney>> m = of(value(), unit()
+ .inverse());
+ return m;
+ }
+
+ public int compareTo(MonetaryAmount o) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+
+ public MonetaryAmount abs() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public MonetaryAmount add(Number augend) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public MonetaryAmount divide(MonetaryAmount divisor) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public MonetaryAmount divide(Number divisor) {
+ // TODO Auto-generated method stub
+ //return of((BigDecimal)value()).divide((BigDecimal)divisor));
+ return null;
+ }
+
+
+ public MonetaryAmount[] divideAndRemainder(MonetaryAmount divisor) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public MonetaryAmount[] divideAndRemainder(Number divisor) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public MonetaryAmount divideToIntegralValue(MonetaryAmount divisor) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public MonetaryAmount divideToIntegralValue(Number divisor) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public MonetaryAmount negate() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public MonetaryAmount plus() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public MonetaryAmount subtract(Number subtrahend) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public MonetaryAmount ulp() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public MonetaryAmount remainder(MonetaryAmount divisor) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public MonetaryAmount remainder(Number divisor) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public MonetaryAmount scaleByPowerOfTen(int n) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public boolean isZero() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+
+ public boolean isPositive() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+
+ public boolean isPositiveOrZero() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+
+ public boolean isNegative() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+
+ public boolean isNegativeOrZero() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public MonetaryAmount from(Number amount) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public MonetaryAmount from(CurrencyUnit currency, Number amount) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public MonetaryAmount with(MonetaryOperator operator) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see MonetaryAmount#getScale()
+ */
+ public int getScale() {
+ return this.bigNumber().scale();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see MonetaryAmount#getPrecision()
+ */
+ public int getPrecision() {
+ return bigNumber().toBigDecimal().precision();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see MonetaryAmount#intValue()
+ */
+ public int intValue() {
+ return this.getNumber().intValue();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see MonetaryAmount#intValueExact()
+ */
+ public int intValueExact() {
+ return bigNumber().intValueExact();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see MonetaryAmount#longValue()
+ */
+ public long longValue() {
+ return this.getNumber().longValue();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see MonetaryAmount#longValueExact()
+ */
+ public long longValueExact() {
+ return bigNumber().longValueExact();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see MonetaryAmount#floatValue()
+ */
+ public float floatValue() {
+ return this.getNumber().floatValue();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see MonetaryAmount#doubleValue()
+ */
+ public double doubleValue() {
+ return this.getNumber().doubleValue();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see MonetaryAmount#byteValue()
+ */
+ public byte byteValue() {
+ return this.getNumber().byteValue();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see MonetaryAmount#shortValue()
+ */
+ public short shortValue() {
+ return getNumber().shortValue();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see MonetaryAmount#shortValueExact()
+ */
+ public short shortValueExact() {
+ return bigNumber().shortValueExact();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see MonetaryAmount#signum()
+ */
+
+ public int signum() {
+ return bigNumber().signum();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see MonetaryAmount#toEngineeringString()
+ */
+ public String toEngineeringString() {
+ return getCurrency().getCurrencyCode() + ' '
+ + bigNumber().toBigDecimal().toEngineeringString();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see MonetaryAmount#toPlainString()
+ */
+ public String toPlainString() {
+ return getCurrency().getCurrencyCode() + ' '
+ + bigNumber().toBigDecimal().toPlainString();
+ }
+
+ public boolean isLessThan(MonetaryAmount amount) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+
+ public boolean isLessThanOrEqualTo(MonetaryAmount amount) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+
+ public boolean isGreaterThan(MonetaryAmount amount) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+
+ public boolean isGreaterThanOrEqualTo(MonetaryAmount amount) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+
+ public boolean isEqualTo(MonetaryAmount amount) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+
+ public boolean isNotEqualTo(MonetaryAmount amount) {
+ return !getNumber().equals(amount);
+ }
+
+ public <T> T asType(Class<T> type) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Class<?> getNumberType() {
+ return getNumber().getClass();
+ }
+
+ public CurrencyUnit getCurrency() {
+ return (CurrencyUnit)unit();
+ }
+
+ @Override
+ public IMoney add(IMeasure<IMoney> that) {
+ return plus((IMoney) that);
+ }
+
+ @Override
+ public MonetaryAmount add(MonetaryAmount augend) {
+ return plus((MoneyAmount) augend);
+ }
+
+ @Override
+ public IMeasure<IMoney> subtract(IMeasure<IMoney> that) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public MonetaryAmount subtract(MonetaryAmount subtrahend) {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/money/MoneyConverter.java b/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/money/MoneyConverter.java
index 05f51a8..2372db1 100644
--- a/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/money/MoneyConverter.java
+++ b/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/money/MoneyConverter.java
@@ -1,287 +1,287 @@
-/**
- * Copyright (c) 2005, 2013, Werner Keil and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Werner Keil, Jean-Marie Dautelle - initial API and implementation
- */
-package org.eclipse.uomo.business.money;
-
-import static java.util.FormattableFlags.LEFT_JUSTIFY;
-
-import java.math.BigDecimal;
-import java.math.MathContext;
-import java.util.Formattable;
-import java.util.Formatter;
-import java.util.List;
-
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.uomo.business.internal.CurrencyUnit;
-import org.eclipse.uomo.business.internal.ExchangeRate;
-import org.eclipse.uomo.business.internal.Messages;
-import org.eclipse.uomo.business.types.IMoney;
-import org.eclipse.uomo.units.AbstractConverter;
-import org.unitsofmeasurement.unit.Unit;
-import org.unitsofmeasurement.unit.UnitConverter;
-
-import com.ibm.icu.util.Currency;
-import com.ibm.icu.util.ULocale;
-
-/**
- * <p>
- * This class represents a converter between two currencies.
- * </p>
- *
- * <p>
- * Currency converters convert values based upon the current exchange rate
- * {@link Currency#getExchangeRate() exchange rate}. If the
- * {@link Currency#getExchangeRate() exchange rate} from the target currency to
- * the source currency is not set, conversion fails. In others words, the
- * converter from a currency <code>A</code> to a currency <code>B</code> is
- * independant from the converter from <code>B</code> to <code>A</code>.
- * </p>
- *
- * @author <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
- * @author <a href="mailto:units@catmedia.us">Werner Keil</a>
- * @version 5.3, $Date: 2013-05-25 $
- * @deprecated use JSR 354
- */
-public class MoneyConverter extends AbstractConverter implements Formattable {
-
- /**
- *
- */
- private static final long serialVersionUID = -3943843029548497620L;
-
- /**
- * Holds the exchange rate.
- */
- private final ExchangeRate rate;
-
- private void checkFactor(Number factor) {
- if (factor == null)
- throw new UnsupportedOperationException(NLS.bind(
- Messages.CurrencyConverter_exchangeRate_not_set,
- rate.getBase(), rate.getTerm())); //$NON-NLS-1$
- }
-
- private CurrencyUnit fromJDK(java.util.Currency currency) {
- // TODO use JDKAdapter
- return fromICU(Currency.getInstance(currency.getCurrencyCode()));
- }
-
- private CurrencyUnit fromICU(Currency currency) {
- return MoneyCurrency.of(currency);
- }
-
-
- /**
- * Creates the currency converter from the source currency to the target
- * currency.
- *
- * @param source
- * the source currency.
- * @param target
- * the target currency.
- * @param factor
- * the multiplier factor from source to target.
- * @return the corresponding converter.
- */
- private MoneyConverter(CurrencyUnit source, CurrencyUnit target, Number factor) {
- rate = new MoneyExchangeRate(source, target, factor);
- }
-
- /**
- * Creates the currency converter from the source currency to the target
- * currency.
- *
- * @param source
- * the source currency.
- * @param target
- * the target currency.
- * @param factor
- * the multiplier factor from source to target.
- * @return the corresponding converter.
- */
- private MoneyConverter(Currency source, Currency target, Number factor) {
- rate = new MoneyExchangeRate(fromICU(source), fromICU(target), factor);
- }
-
- /**
- * Creates the currency converter from the source currency to the target
- * currency.
- *
- * @param source
- * the source currency.
- * @param target
- * the target currency.
- * @param factor
- * the multiplier factor from source to target.
- * @return the corresponding converter.
- */
- @SuppressWarnings("unchecked")
- public MoneyConverter(Unit<?> source, Unit<IMoney> target,
- Number factor) {
-
- CurrencyUnit defCurrency = MoneyCurrency.of(Currency.getInstance(ULocale.getDefault()));
- rate = new MoneyExchangeRate(defCurrency, defCurrency, factor);
-
- }
-
- /**
- * Creates the currency converter from the source currency to the target
- * currency using <strong>JDK</strong> types.
- *
- * @param source
- * the source currency (<strong>JDK</strong>).
- * @param target
- * the target currency (<strong>JDK</strong>).
- * @param factor
- * the multiplier factor from source to target.
- * @return the corresponding converter.
- */
- public MoneyConverter(java.util.Currency source,
- java.util.Currency target, Number factor) {
- rate = new MoneyExchangeRate(fromJDK(source), fromJDK(target), factor);
- }
-
- /**
- * Returns the source currency.
- *
- * @return the source currency.
- */
- public CurrencyUnit getSource() {
- return rate.getBase();
- }
-
- /**
- * Returns the target currency.
- *
- * @return the target currency.
- */
- public CurrencyUnit getTarget() {
- return rate.getTerm();
- }
-
- public MoneyConverter inverse() {
- return new MoneyConverter(getTarget(), getSource(),
- rate.getFactor());
- }
-
- public MoneyConverter negate() {
- return new MoneyConverter(getSource(), getTarget(), -rate
- .getFactor().doubleValue());
- }
-
- public double convert(double value) {
- // Number factor = getExchangeRate(rate.getTarget());
- Number factor = rate.getFactor();
- checkFactor(factor);
- return factor.doubleValue() * value;
- }
-
- public BigDecimal convert(BigDecimal value, MathContext ctx)
- throws ArithmeticException {
- // Number factor = rate.getSource().getExchangeRate(rate.getTarget());
- Number factor = rate.getFactor();
- checkFactor(factor);
- if (factor instanceof BigDecimal)
- return value.multiply((BigDecimal) factor, ctx);
- if (factor instanceof Number) {
- return value.multiply(
- (BigDecimal.valueOf(((Number) factor).doubleValue())), ctx);
- } else { // Reverts to double convert.
- return value
- .multiply(BigDecimal.valueOf(factor.doubleValue()), ctx);
- }
- }
-
- public Number convert(Number value) {
- if (value instanceof BigDecimal) {
- return convert((BigDecimal) value, MathContext.DECIMAL128);
- } else {
- return convert(value.doubleValue());
- }
- }
-
- @Override
- public boolean equals(Object cvtr) {
- if (!(cvtr instanceof MoneyConverter))
- return false;
- MoneyConverter that = (MoneyConverter) cvtr;
- return this.getSource().equals(that.getSource())
- && this.getTarget().equals(that.getTarget());
- }
-
- @Override
- public int hashCode() {
- return getSource().hashCode() + getTarget().hashCode();
- }
-
- @Override
- public final String toString() {
- if (getSource().equals(getTarget())) {
- return getSource().getCurrencyCode();
- }
- return String.format(Messages.CurrencyConverter_toString, getSource()
- .getCurrencyCode(), getTarget().getCurrencyCode());
- }
-
- public boolean isLinear() {
- return true;
- }
-
- public UnitConverter concatenate(UnitConverter converter) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<UnitConverter> getCompoundConverters() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public boolean isIdentity() {
- return false;
- }
-
- public ExchangeRate getExchangeRate() {
- return rate;
- }
-
- public void formatTo(Formatter fmt, int f, int width, int precision) {
- StringBuilder sb = new StringBuilder();
-
- // decide form of name
- String name = getSource().toString();
- String symbol = getSource().getCurrencyCode();
- // if (fmt.locale().equals(Locale.FRANCE))
- // name = frenchCompanyName;
- // boolean alternate = (f & ALTERNATE) == ALTERNATE;
- boolean usesymbol = true; // alternate || (precision != -1 && precision
- // < 10);
- String out = (usesymbol ? symbol : name);
-
- // apply precision
- if (precision == -1 || out.length() < precision) {
- // write it all
- sb.append(out);
- } else {
- sb.append(out.substring(0, precision - 1)).append('*');
- }
-
- // apply width and justification
- int len = sb.length();
- if (len < width)
- for (int i = 0; i < width - len; i++)
- if ((f & LEFT_JUSTIFY) == LEFT_JUSTIFY)
- sb.append(' ');
- else
- sb.insert(0, ' ');
-
- fmt.format(sb.toString());
- }
-}
+/**
+ * Copyright (c) 2005, 2013, Werner Keil and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Werner Keil, Jean-Marie Dautelle - initial API and implementation
+ */
+package org.eclipse.uomo.business.money;
+
+import static java.util.FormattableFlags.LEFT_JUSTIFY;
+
+import java.math.BigDecimal;
+import java.math.MathContext;
+import java.util.Formattable;
+import java.util.Formatter;
+import java.util.List;
+
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.uomo.business.internal.CurrencyUnit;
+import org.eclipse.uomo.business.internal.ExchangeRate;
+import org.eclipse.uomo.business.internal.Messages;
+import org.eclipse.uomo.business.types.IMoney;
+import org.eclipse.uomo.units.AbstractConverter;
+import org.unitsofmeasurement.unit.Unit;
+import org.unitsofmeasurement.unit.UnitConverter;
+
+import com.ibm.icu.util.Currency;
+import com.ibm.icu.util.ULocale;
+
+/**
+ * <p>
+ * This class represents a converter between two currencies.
+ * </p>
+ *
+ * <p>
+ * Currency converters convert values based upon the current exchange rate
+ * {@link Currency#getExchangeRate() exchange rate}. If the
+ * {@link Currency#getExchangeRate() exchange rate} from the target currency to
+ * the source currency is not set, conversion fails. In others words, the
+ * converter from a currency <code>A</code> to a currency <code>B</code> is
+ * independant from the converter from <code>B</code> to <code>A</code>.
+ * </p>
+ *
+ * @author <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
+ * @author <a href="mailto:units@catmedia.us">Werner Keil</a>
+ * @version 5.3, $Date: 2013-05-25 $
+ * @deprecated use JSR 354
+ */
+public class MoneyConverter extends AbstractConverter implements Formattable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3943843029548497620L;
+
+ /**
+ * Holds the exchange rate.
+ */
+ private final ExchangeRate rate;
+
+ private void checkFactor(Number factor) {
+ if (factor == null)
+ throw new UnsupportedOperationException(NLS.bind(
+ Messages.CurrencyConverter_exchangeRate_not_set,
+ rate.getBase(), rate.getTerm())); //$NON-NLS-1$
+ }
+
+ private CurrencyUnit fromJDK(java.util.Currency currency) {
+ // TODO use JDKAdapter
+ return fromICU(Currency.getInstance(currency.getCurrencyCode()));
+ }
+
+ private CurrencyUnit fromICU(Currency currency) {
+ return MoneyCurrency.of(currency);
+ }
+
+
+ /**
+ * Creates the currency converter from the source currency to the target
+ * currency.
+ *
+ * @param source
+ * the source currency.
+ * @param target
+ * the target currency.
+ * @param factor
+ * the multiplier factor from source to target.
+ * @return the corresponding converter.
+ */
+ private MoneyConverter(CurrencyUnit source, CurrencyUnit target, Number factor) {
+ rate = new MoneyExchangeRate(source, target, factor);
+ }
+
+ /**
+ * Creates the currency converter from the source currency to the target
+ * currency.
+ *
+ * @param source
+ * the source currency.
+ * @param target
+ * the target currency.
+ * @param factor
+ * the multiplier factor from source to target.
+ * @return the corresponding converter.
+ */
+ private MoneyConverter(Currency source, Currency target, Number factor) {
+ rate = new MoneyExchangeRate(fromICU(source), fromICU(target), factor);
+ }
+
+ /**
+ * Creates the currency converter from the source currency to the target
+ * currency.
+ *
+ * @param source
+ * the source currency.
+ * @param target
+ * the target currency.
+ * @param factor
+ * the multiplier factor from source to target.
+ * @return the corresponding converter.
+ */
+ @SuppressWarnings("unchecked")
+ public MoneyConverter(Unit<?> source, Unit<IMoney> target,
+ Number factor) {
+
+ CurrencyUnit defCurrency = MoneyCurrency.of(Currency.getInstance(ULocale.getDefault()));
+ rate = new MoneyExchangeRate(defCurrency, defCurrency, factor);
+
+ }
+
+ /**
+ * Creates the currency converter from the source currency to the target
+ * currency using <strong>JDK</strong> types.
+ *
+ * @param source
+ * the source currency (<strong>JDK</strong>).
+ * @param target
+ * the target currency (<strong>JDK</strong>).
+ * @param factor
+ * the multiplier factor from source to target.
+ * @return the corresponding converter.
+ */
+ public MoneyConverter(java.util.Currency source,
+ java.util.Currency target, Number factor) {
+ rate = new MoneyExchangeRate(fromJDK(source), fromJDK(target), factor);
+ }
+
+ /**
+ * Returns the source currency.
+ *
+ * @return the source currency.
+ */
+ public CurrencyUnit getSource() {
+ return rate.getBase();
+ }
+
+ /**
+ * Returns the target currency.
+ *
+ * @return the target currency.
+ */
+ public CurrencyUnit getTarget() {
+ return rate.getTerm();
+ }
+
+ public MoneyConverter inverse() {
+ return new MoneyConverter(getTarget(), getSource(),
+ rate.getFactor());
+ }
+
+ public MoneyConverter negate() {
+ return new MoneyConverter(getSource(), getTarget(), -rate
+ .getFactor().doubleValue());
+ }
+
+ public double convert(double value) {
+ // Number factor = getExchangeRate(rate.getTarget());
+ Number factor = rate.getFactor();
+ checkFactor(factor);
+ return factor.doubleValue() * value;
+ }
+
+ public BigDecimal convert(BigDecimal value, MathContext ctx)
+ throws ArithmeticException {
+ // Number factor = rate.getSource().getExchangeRate(rate.getTarget());
+ Number factor = rate.getFactor();
+ checkFactor(factor);
+ if (factor instanceof BigDecimal)
+ return value.multiply((BigDecimal) factor, ctx);
+ if (factor instanceof Number) {
+ return value.multiply(
+ (BigDecimal.valueOf(((Number) factor).doubleValue())), ctx);
+ } else { // Reverts to double convert.
+ return value
+ .multiply(BigDecimal.valueOf(factor.doubleValue()), ctx);
+ }
+ }
+
+ public Number convert(Number value) {
+ if (value instanceof BigDecimal) {
+ return convert((BigDecimal) value, MathContext.DECIMAL128);
+ } else {
+ return convert(value.doubleValue());
+ }
+ }
+
+ @Override
+ public boolean equals(Object cvtr) {
+ if (!(cvtr instanceof MoneyConverter))
+ return false;
+ MoneyConverter that = (MoneyConverter) cvtr;
+ return this.getSource().equals(that.getSource())
+ && this.getTarget().equals(that.getTarget());
+ }
+
+ @Override
+ public int hashCode() {
+ return getSource().hashCode() + getTarget().hashCode();
+ }
+
+ @Override
+ public final String toString() {
+ if (getSource().equals(getTarget())) {
+ return getSource().getCurrencyCode();
+ }
+ return String.format(Messages.CurrencyConverter_toString, getSource()
+ .getCurrencyCode(), getTarget().getCurrencyCode());
+ }
+
+ public boolean isLinear() {
+ return true;
+ }
+
+ public UnitConverter concatenate(UnitConverter converter) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public List<UnitConverter> getCompoundConverters() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean isIdentity() {
+ return false;
+ }
+
+ public ExchangeRate getExchangeRate() {
+ return rate;
+ }
+
+ public void formatTo(Formatter fmt, int f, int width, int precision) {
+ StringBuilder sb = new StringBuilder();
+
+ // decide form of name
+ String name = getSource().toString();
+ String symbol = getSource().getCurrencyCode();
+ // if (fmt.locale().equals(Locale.FRANCE))
+ // name = frenchCompanyName;
+ // boolean alternate = (f & ALTERNATE) == ALTERNATE;
+ boolean usesymbol = true; // alternate || (precision != -1 && precision
+ // < 10);
+ String out = (usesymbol ? symbol : name);
+
+ // apply precision
+ if (precision == -1 || out.length() < precision) {
+ // write it all
+ sb.append(out);
+ } else {
+ sb.append(out.substring(0, precision - 1)).append('*');
+ }
+
+ // apply width and justification
+ int len = sb.length();
+ if (len < width)
+ for (int i = 0; i < width - len; i++)
+ if ((f & LEFT_JUSTIFY) == LEFT_JUSTIFY)
+ sb.append(' ');
+ else
+ sb.insert(0, ' ');
+
+ fmt.format(sb.toString());
+ }
+}
diff --git a/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/money/MoneyCurrency.java b/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/money/MoneyCurrency.java
index cf3eec6..e9c1b80 100644
--- a/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/money/MoneyCurrency.java
+++ b/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/money/MoneyCurrency.java
@@ -1,710 +1,710 @@
-/**
- * Copyright (c) 2006, 2013, Werner Keil and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Werner Keil - initial API and implementation
- */
-package org.eclipse.uomo.business.money;
-
-import static org.eclipse.uomo.business.money.MonetaryUnits.ISO_NAMESPACE;
-
-//import java.util.Currency;
-import java.util.Locale;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.logging.Logger;
-
-import org.eclipse.uomo.business.internal.CurrencyUnit;
-import org.eclipse.uomo.business.internal.Localizable;
-
-import com.ibm.icu.util.Currency;
-import com.ibm.icu.util.ULocale;
-
-/**
- * Adapter that implements the {@link CurrencyUnit} interface using the
- * ICU4J {@link com.ibm.icu.util.Currency}.
- *
- * @version 0.2.3
- * @author Werner Keil
- * @deprecated merge into MoneyUnit
- */
-public class MoneyCurrency extends com.ibm.icu.util.Currency implements CurrencyUnit, Localizable {
-
- /**
- * serialVersionUID.
- */
- private static final long serialVersionUID = -2523936311372374236L;
-
- /** namespace for this currency. */
- private final String namespace;
- /** currency code for this currency. */
- private final String currencyCode;
- /** valid from, or {@code null}. */
- private final Long validFrom;
- /** valid until, or {@code null}. */
- private final Long validUntil;
- /** true, if legal tender. */
- private final boolean legalTender;
- /** true, if it is a virtual currency. */
- private final boolean virtual;
-
- private static final Map<String, MoneyCurrency> CACHED = new ConcurrentHashMap<String, MoneyCurrency>();
-
- private static final Logger LOGGER = Logger.getLogger(MoneyCurrency.class
- .getName());
-
- /**
- * Private constructor.
- *
- * @param currency
- */
- private MoneyCurrency(String namespace, String code, int numCode,
- int fractionDigits, Long validFrom, Long validUntil, boolean legal,
- boolean virtual) {
- super(code);
- this.namespace = namespace;
- this.currencyCode = code;
- this.validFrom = validFrom;
- this.validUntil = validUntil;
- this.legalTender = legal;
- this.virtual = virtual;
- }
-
- /**
- * Private constructor.
- *
- * @param currency
- */
- private MoneyCurrency(Currency currency) {
- super(currency != null ? currency.getCurrencyCode() : "");
- if (currency == null) {
- throw new IllegalArgumentException("Currency required.");
- }
- this.namespace = ISO_NAMESPACE;
- this.currencyCode = currency.getCurrencyCode();
- currency.getDefaultFractionDigits();
- this.validFrom = null;
- this.validUntil = null; // TODO Adapt for hisotoric one, e.g. AFA
- this.legalTender = !this.currencyCode.startsWith("X"); // TODO check for
- // each code in
- // util.Currency
- // here;
- this.virtual = this.currencyCode.equals("XXX"); // TODO check for each
- // code in util.Currency
- // here;
- }
-
- /**
- * Access a new instance based on {@link Currency}.
- *
- * @param currency
- * the currency unitm not null.
- * @return the new instance, never null.
- */
- public static MoneyCurrency of(Currency currency) {
- String key = ISO_NAMESPACE + ':' + currency.getCurrencyCode();
- MoneyCurrency cachedItem = CACHED.get(key);
- if (cachedItem == null) {
- cachedItem = new ICUCurrencyAdapter(currency);
- CACHED.put(key, cachedItem);
- }
- return cachedItem;
- }
-
- /**
- * Access a new instance based on {@link Currency}.
- *
- * @param currency
- * the currency unitm not null.
- * @return the new instance, never null.
- */
-// public static MoneyCurrency of(com.ibm.icu.util.Currency currency) {
-// String key = ISO_NAMESPACE + ':' + currency.getCurrencyCode();
-// MoneyCurrency cachedItem = CACHED.get(key);
-// if (cachedItem == null) {
-// cachedItem = new ICUCurrencyAdapter(currency);
-// CACHED.put(key, cachedItem);
-// }
-// return cachedItem;
-// }
-//
- /**
- * Access a new instance based on the ISO currency code. The code must
- * return a {@link Currency} when passed to
- * {@link Currency#getInstance(String)}.
- *
- * @param currencyCode
- * the ISO currency code, not null.
- * @return the corresponding {@link MonetaryCurrency} instance.
- */
- public static MoneyCurrency of(String currencyCode) {
- return of(Currency.getInstance(currencyCode));
- }
-
- /**
- * Access a new instance based on the ISO currency code. The code must
- * return a {@link Currency} when passed to
- * {@link Currency#getInstance(String)}.
- *
- * @param namespace
- * the target namespace.
- * @param currencyCode
- * the ISO currency code, not null.
- * @return the corresponding {@link MonetaryCurrency} instance.
- */
- public static MoneyCurrency of(String namespace, String currencyCode) {
- String key = namespace + ':' + currencyCode;
- MoneyCurrency cu = CACHED.get(key);
- if (cu == null && namespace.equals(ISO_NAMESPACE)) {
- return of(currencyCode);
- }
- return cu;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.money.CurrencyUnit#isVirtual()
- */
-
- public boolean isVirtual() {
- return virtual;
- }
-
- /**
- * Get the namepsace of this {@link CurrencyUnit}, returns 'ISO-4217'.
- */
-
- public String getNamespace() {
- return namespace;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.money.CurrencyUnit#getValidFrom()
- */
-
- public Long getValidFrom() {
- return validFrom;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.money.CurrencyUnit#getValidUntil()
- */
-
- public Long getValidUntil() {
- return validUntil;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.money.CurrencyUnit#getCurrencyCode()
- */
-
- /*
- * (non-Javadoc)
- *
- * @see javax.money.CurrencyUnit#getNumericCode()
- */
-
-// public int getNumericCode() {
-// return numericCode;
-// }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.money.CurrencyUnit#getDefaultFractionDigits()
- */
-
-// public int getDefaultFractionDigits() {
-// return defaultFractionDigits;
-// }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.money.CurrencyUnit#isLegalTender()
- */
-
- public boolean isLegalTender() {
- return legalTender;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- */
- public int compareTo(CurrencyUnit currency) {
- int compare = getNamespace().compareTo(currency.getNamespace());
- if (compare == 0) {
- compare = getCurrencyCode().compareTo(currency.getCurrencyCode());
- }
- if (compare == 0) {
- if (validFrom == null && currency.getValidFrom() != null) {
- compare = -1;
- } else if (validFrom != null && currency.getValidFrom() == null) {
- compare = 1;
- } else if (validFrom != null) {
- compare = validFrom.compareTo(currency.getValidFrom());
- }
- }
- if (compare == 0) {
- if (validUntil == null && currency.getValidUntil() != null) {
- compare = -1;
- } else if (validUntil != null && currency.getValidUntil() == null) {
- compare = 1;
- } else if (validUntil != null) {
- compare = validUntil.compareTo(currency.getValidUntil());
- }
- }
- return compare;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
-
- public String toString() {
- if (ISO_NAMESPACE.equals(namespace)) {
- return currencyCode;
- }
- return namespace + ':' + currencyCode;
- }
-
- /**
- * Builder class that supports building complex instances of
- * {@link MoneyCurrency}.
- *
- * @author Anatole Tresch
- */
- public static final class Builder {
- /** namespace for this currency. */
- private String namespace;
- /** currency code for this currency. */
- private String currencyCode;
- /** numeric code, or -1. */
- private int numericCode = -1;
- /** fraction digits, or -1. */
- private int defaultFractionDigits = -1;
- /** valid from, or {@code null}. */
- private Long validFrom;
- /** valid until, or {@code null}. */
- private Long validUntil;
- /** true, if legal tender. */
- private boolean legalTender = true;
- /** true for virtual currencies. */
- private boolean virtual = false;
-
- /**
- * Creates a new {@link Builder}.
- */
- public Builder() {
- }
-
- /**
- * Creates a new {@link Builder}, starting with the according ISO
- * currency.
- *
- * @param currencyCode
- * the ISO currency code.
- */
- public Builder(String currencyCode) {
- this(ISO_NAMESPACE, currencyCode);
- }
-
- /**
- * Creates a new {@link Builder}, starting with the namespace and code
- * given.
- *
- * @param namespace
- * the taregt namespace
- * @param currencyCode
- * the currency code
- */
- public Builder(String namespace, String currencyCode) {
- setNamespace(namespace);
- setCurrencyCode(currencyCode);
- }
-
- /**
- * Set the namespace.
- *
- * @param namespace
- * the namespace, not null
- * @return the builder, for chaining
- */
- public Builder setNamespace(String namespace) {
- if (namespace == null) {
- throw new IllegalArgumentException("namespace may not be null.");
- }
- this.namespace = namespace;
- return this;
- }
-
- /**
- * Set the currency code.
- *
- * @param namespace
- * the currency code, not null
- * @return the builder, for chaining
- */
- public Builder setCurrencyCode(String currencyCode) {
- if (currencyCode == null) {
- throw new IllegalArgumentException(
- "currencyCode may not be null.");
- }
- this.currencyCode = currencyCode;
- return this;
- }
-
- /**
- * Set the default fraction digits.
- *
- * @param defaultFractionDigits
- * the default fraction digits
- * @return the builder, for chaining
- */
- public Builder setDefaultFractionDigits(int defaultFractionDigits) {
- if (defaultFractionDigits < -1) {
- throw new IllegalArgumentException(
- "Invalid value for defaultFractionDigits: "
- + defaultFractionDigits);
- }
- this.defaultFractionDigits = defaultFractionDigits;
- return this;
- }
-
- /**
- * Set the numeric currency code.
- *
- * @param numericCode
- * the numeric currency code
- * @return the builder, for chaining
- */
- public Builder setNumericCode(int numericCode) {
- if (numericCode < -1) {
- throw new IllegalArgumentException(
- "Invalid value for numericCode: " + numericCode);
- }
- this.numericCode = numericCode;
- return this;
- }
-
- /**
- * Sets the start UTC timestamp for the currenciy's validity.
- *
- * @param validFrom
- * the start UTC timestamp
- * @return the builder, for chaining
- */
- public Builder setValidFrom(Long validFrom) {
- this.validFrom = validFrom;
- return this;
- }
-
- /**
- * Sets the end UTC timestamp for the currenciy's validity.
- *
- * @param validUntil
- * the ending UTC timestamp
- * @return the builder, for chaining
- */
- public Builder setValidUntil(Long validUntil) {
- this.validUntil = validUntil;
- return this;
- }
-
- /**
- * Sets the legal tender attribute.
- *
- * @param legalTender
- * true, if the currency is a legal tender
- * @return the builder, for chaining
- */
- public Builder setLegalTender(boolean legalTender) {
- this.legalTender = legalTender;
- return this;
- }
-
- /**
- * Sets the virtual attribute.
- *
- * @param virtual
- * true, if the currency is a virtual currency.
- * @return the builder, for chaining
- */
- public Builder setVirtual(boolean virtual) {
- this.virtual = virtual;
- return this;
- }
-
- /**
- * Get the current namespace attribute set.
- *
- * @return the namespace value, or null.
- */
- public String getNamespace() {
- return this.namespace;
- }
-
- /**
- * Get the current currency code attribute set.
- *
- * @return the currency code value, or null.
- */
- public String getCurrencyCode() {
- return this.currencyCode;
- }
-
- /**
- * Get the current fraction digits attribute set.
- *
- * @return the currency fraction digits value.
- */
- public int getDefaultFractionDigits() {
- return this.defaultFractionDigits;
- }
-
- /**
- * Get the current numeric code attribute set.
- *
- * @return the numeric code value.
- */
- public int getNumericCode() {
- return this.numericCode;
- }
-
- /**
- * Get the starting validity period timestamp.
- *
- * @return the starting validity period tiemstamp, or null..
- */
- public Long getValidFrom() {
- return this.validFrom;
- }
-
- /**
- * Get the ending validity period timestamp.
- *
- * @return the ending validity period tiemstamp, or null..
- */
- public Long getValidUntil() {
- return this.validUntil;
- }
-
- /**
- * Access the legal tender attribute.
- *
- * @return the attribute value.
- */
- public boolean isLegalTender() {
- return this.legalTender;
- }
-
- /**
- * Access the virtual attribute.
- *
- * @return the attribute value.
- */
- public boolean isVirtual() {
- return this.virtual;
- }
-
- /**
- * Checks if this {@link Builder} instance can create a
- * {@link MoneyCurrency}.
- *
- * @see #build()
- * @return true, if the builder can build.
- */
- public boolean isBuildable() {
- return namespace != null && currencyCode != null;
- }
-
- /**
- * Builds a new currency instance, the instance build is not cached
- * internally.
- *
- * @see #build(boolean)
- * @return a new instance of {@link MoneyCurrency}.
- */
- public MoneyCurrency build() {
- return build(true);
- }
-
- /**
- * Builds a new currency instance, which ia additinoally stored to the
- * internal cache for reuse.
- *
- * @param cache
- * flag to optionally store the instance created into the
- * locale cache.
- * @return a new instance of {@link MoneyCurrency}.
- */
- public MoneyCurrency build(boolean cache) {
- if (!isBuildable()) {
- throw new IllegalStateException(
- "Can not build CurrencyUnitImpl.");
- }
- if (cache) {
- if (validUntil != null) {
- LOGGER.warning("CurrencyUnit build: Can only cache currencies that have no validity constraints.");
- cache = false;
- }
- if (validFrom != null) {
- if (validFrom.longValue() > System.currentTimeMillis()) {
- LOGGER.warning("CurrencyUnit build: Can only cache currencies that are already valid.");
- cache = false;
- }
- }
- }
- if (cache) {
- String key = namespace + ':' + currencyCode;
- MoneyCurrency current = CACHED.get(key);
- if (current == null) {
- current = new MoneyCurrency(namespace, currencyCode,
- numericCode, defaultFractionDigits, validFrom,
- validUntil, legalTender, virtual);
- CACHED.put(key, current);
- }
- return current;
- }
- return new MoneyCurrency(namespace, currencyCode, numericCode,
- defaultFractionDigits, validFrom, validUntil, legalTender,
- virtual);
- }
- }
-
- /**
- * Adapter that implements the new {@link CurrencyUnit} interface using the
- * JDK's {@link Currency}.
- * <p>
- * This adapter will be removed in the final platform implementation.
- *
- * @author Anatole Tresch
- * @author Werner Keil
- */
- private final static class JDKCurrencyAdapter extends MoneyCurrency
- implements Localizable {
-
- /**
- * serialVersionUID.
- */
- private static final long serialVersionUID = -2523936311372374236L;
-
- /**
- * ISO 4217 currency code for this currency.
- *
- * @serial
- */
- private final Currency currency;
-
- /**
- * Private constructor.
- *
- * @param currency
- */
- private JDKCurrencyAdapter(Currency currency) {
- super(currency);
- this.currency = currency;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
-
- public String toString() {
- return ISO_NAMESPACE + ':' + getCurrencyCode();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see Localizable#getDisplayName(java.util.Locale)
- */
- public String getDisplayName(Locale locale) {
- //return currency.getName(locale, nameStyle, isChoiceFormat) (locale);
- return currency.getName(ULocale.forLocale(locale), LONG_NAME, new boolean[1]);
- }
-
- }
-
- /**
- * Adapter that implements the new {@link CurrencyUnit} interface using the
- * JDK's {@link Currency}.
- * <p>
- * This adapter will be removed in the final platform implementation.
- *
- * @author Werner Keil
- */
- private final static class ICUCurrencyAdapter extends MoneyCurrency
- implements Localizable {
-
- /**
- * serialVersionUID.
- */
- private static final long serialVersionUID = -2523936311372374236L;
-
- /**
- * ISO 4217 currency code for this currency.
- *
- * @serial
- */
- private final com.ibm.icu.util.Currency currency;
-
- /**
- * Private constructor.
- *
- * @param currency
- */
- private ICUCurrencyAdapter(com.ibm.icu.util.Currency currency) {
- super(ISO_NAMESPACE, currency.getCurrencyCode(), -1, currency.getDefaultFractionDigits(),
- null, null, true, false);
- this.currency = currency;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
-
- public String toString() {
- return ISO_NAMESPACE + ':' + getCurrencyCode();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.money.Localizable#getDisplayName(java.util.Locale)
- */
-
- public String getDisplayName(Locale locale) {
- return currency.getName(ULocale.forLocale(locale), LONG_NAME, new boolean[1]);
- }
-
- }
-
-// public String getDisplayName(Locale locale) {
-// return getName(ULocale.forLocale(locale), LONG_NAME, new boolean[1]);
-// }
-//
-// public int getNumericCode() {
-// return -1;
-// }
-
-}
+/**
+ * Copyright (c) 2006, 2013, Werner Keil and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Werner Keil - initial API and implementation
+ */
+package org.eclipse.uomo.business.money;
+
+import static org.eclipse.uomo.business.money.MonetaryUnits.ISO_NAMESPACE;
+
+//import java.util.Currency;
+import java.util.Locale;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.logging.Logger;
+
+import org.eclipse.uomo.business.internal.CurrencyUnit;
+import org.eclipse.uomo.business.internal.Localizable;
+
+import com.ibm.icu.util.Currency;
+import com.ibm.icu.util.ULocale;
+
+/**
+ * Adapter that implements the {@link CurrencyUnit} interface using the
+ * ICU4J {@link com.ibm.icu.util.Currency}.
+ *
+ * @version 0.2.3
+ * @author Werner Keil
+ * @deprecated merge into MoneyUnit
+ */
+public class MoneyCurrency extends com.ibm.icu.util.Currency implements CurrencyUnit, Localizable {
+
+ /**
+ * serialVersionUID.
+ */
+ private static final long serialVersionUID = -2523936311372374236L;
+
+ /** namespace for this currency. */
+ private final String namespace;
+ /** currency code for this currency. */
+ private final String currencyCode;
+ /** valid from, or {@code null}. */
+ private final Long validFrom;
+ /** valid until, or {@code null}. */
+ private final Long validUntil;
+ /** true, if legal tender. */
+ private final boolean legalTender;
+ /** true, if it is a virtual currency. */
+ private final boolean virtual;
+
+ private static final Map<String, MoneyCurrency> CACHED = new ConcurrentHashMap<String, MoneyCurrency>();
+
+ private static final Logger LOGGER = Logger.getLogger(MoneyCurrency.class
+ .getName());
+
+ /**
+ * Private constructor.
+ *
+ * @param currency
+ */
+ private MoneyCurrency(String namespace, String code, int numCode,
+ int fractionDigits, Long validFrom, Long validUntil, boolean legal,
+ boolean virtual) {
+ super(code);
+ this.namespace = namespace;
+ this.currencyCode = code;
+ this.validFrom = validFrom;
+ this.validUntil = validUntil;
+ this.legalTender = legal;
+ this.virtual = virtual;
+ }
+
+ /**
+ * Private constructor.
+ *
+ * @param currency
+ */
+ private MoneyCurrency(Currency currency) {
+ super(currency != null ? currency.getCurrencyCode() : "");
+ if (currency == null) {
+ throw new IllegalArgumentException("Currency required.");
+ }
+ this.namespace = ISO_NAMESPACE;
+ this.currencyCode = currency.getCurrencyCode();
+ currency.getDefaultFractionDigits();
+ this.validFrom = null;
+ this.validUntil = null; // TODO Adapt for hisotoric one, e.g. AFA
+ this.legalTender = !this.currencyCode.startsWith("X"); // TODO check for
+ // each code in
+ // util.Currency
+ // here;
+ this.virtual = this.currencyCode.equals("XXX"); // TODO check for each
+ // code in util.Currency
+ // here;
+ }
+
+ /**
+ * Access a new instance based on {@link Currency}.
+ *
+ * @param currency
+ * the currency unitm not null.
+ * @return the new instance, never null.
+ */
+ public static MoneyCurrency of(Currency currency) {
+ String key = ISO_NAMESPACE + ':' + currency.getCurrencyCode();
+ MoneyCurrency cachedItem = CACHED.get(key);
+ if (cachedItem == null) {
+ cachedItem = new ICUCurrencyAdapter(currency);
+ CACHED.put(key, cachedItem);
+ }
+ return cachedItem;
+ }
+
+ /**
+ * Access a new instance based on {@link Currency}.
+ *
+ * @param currency
+ * the currency unitm not null.
+ * @return the new instance, never null.
+ */
+// public static MoneyCurrency of(com.ibm.icu.util.Currency currency) {
+// String key = ISO_NAMESPACE + ':' + currency.getCurrencyCode();
+// MoneyCurrency cachedItem = CACHED.get(key);
+// if (cachedItem == null) {
+// cachedItem = new ICUCurrencyAdapter(currency);
+// CACHED.put(key, cachedItem);
+// }
+// return cachedItem;
+// }
+//
+ /**
+ * Access a new instance based on the ISO currency code. The code must
+ * return a {@link Currency} when passed to
+ * {@link Currency#getInstance(String)}.
+ *
+ * @param currencyCode
+ * the ISO currency code, not null.
+ * @return the corresponding {@link MonetaryCurrency} instance.
+ */
+ public static MoneyCurrency of(String currencyCode) {
+ return of(Currency.getInstance(currencyCode));
+ }
+
+ /**
+ * Access a new instance based on the ISO currency code. The code must
+ * return a {@link Currency} when passed to
+ * {@link Currency#getInstance(String)}.
+ *
+ * @param namespace
+ * the target namespace.
+ * @param currencyCode
+ * the ISO currency code, not null.
+ * @return the corresponding {@link MonetaryCurrency} instance.
+ */
+ public static MoneyCurrency of(String namespace, String currencyCode) {
+ String key = namespace + ':' + currencyCode;
+ MoneyCurrency cu = CACHED.get(key);
+ if (cu == null && namespace.equals(ISO_NAMESPACE)) {
+ return of(currencyCode);
+ }
+ return cu;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.money.CurrencyUnit#isVirtual()
+ */
+
+ public boolean isVirtual() {
+ return virtual;
+ }
+
+ /**
+ * Get the namepsace of this {@link CurrencyUnit}, returns 'ISO-4217'.
+ */
+
+ public String getNamespace() {
+ return namespace;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.money.CurrencyUnit#getValidFrom()
+ */
+
+ public Long getValidFrom() {
+ return validFrom;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.money.CurrencyUnit#getValidUntil()
+ */
+
+ public Long getValidUntil() {
+ return validUntil;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.money.CurrencyUnit#getCurrencyCode()
+ */
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.money.CurrencyUnit#getNumericCode()
+ */
+
+// public int getNumericCode() {
+// return numericCode;
+// }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.money.CurrencyUnit#getDefaultFractionDigits()
+ */
+
+// public int getDefaultFractionDigits() {
+// return defaultFractionDigits;
+// }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.money.CurrencyUnit#isLegalTender()
+ */
+
+ public boolean isLegalTender() {
+ return legalTender;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Comparable#compareTo(java.lang.Object)
+ */
+ public int compareTo(CurrencyUnit currency) {
+ int compare = getNamespace().compareTo(currency.getNamespace());
+ if (compare == 0) {
+ compare = getCurrencyCode().compareTo(currency.getCurrencyCode());
+ }
+ if (compare == 0) {
+ if (validFrom == null && currency.getValidFrom() != null) {
+ compare = -1;
+ } else if (validFrom != null && currency.getValidFrom() == null) {
+ compare = 1;
+ } else if (validFrom != null) {
+ compare = validFrom.compareTo(currency.getValidFrom());
+ }
+ }
+ if (compare == 0) {
+ if (validUntil == null && currency.getValidUntil() != null) {
+ compare = -1;
+ } else if (validUntil != null && currency.getValidUntil() == null) {
+ compare = 1;
+ } else if (validUntil != null) {
+ compare = validUntil.compareTo(currency.getValidUntil());
+ }
+ }
+ return compare;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+
+ public String toString() {
+ if (ISO_NAMESPACE.equals(namespace)) {
+ return currencyCode;
+ }
+ return namespace + ':' + currencyCode;
+ }
+
+ /**
+ * Builder class that supports building complex instances of
+ * {@link MoneyCurrency}.
+ *
+ * @author Anatole Tresch
+ */
+ public static final class Builder {
+ /** namespace for this currency. */
+ private String namespace;
+ /** currency code for this currency. */
+ private String currencyCode;
+ /** numeric code, or -1. */
+ private int numericCode = -1;
+ /** fraction digits, or -1. */
+ private int defaultFractionDigits = -1;
+ /** valid from, or {@code null}. */
+ private Long validFrom;
+ /** valid until, or {@code null}. */
+ private Long validUntil;
+ /** true, if legal tender. */
+ private boolean legalTender = true;
+ /** true for virtual currencies. */
+ private boolean virtual = false;
+
+ /**
+ * Creates a new {@link Builder}.
+ */
+ public Builder() {
+ }
+
+ /**
+ * Creates a new {@link Builder}, starting with the according ISO
+ * currency.
+ *
+ * @param currencyCode
+ * the ISO currency code.
+ */
+ public Builder(String currencyCode) {
+ this(ISO_NAMESPACE, currencyCode);
+ }
+
+ /**
+ * Creates a new {@link Builder}, starting with the namespace and code
+ * given.
+ *
+ * @param namespace
+ * the taregt namespace
+ * @param currencyCode
+ * the currency code
+ */
+ public Builder(String namespace, String currencyCode) {
+ setNamespace(namespace);
+ setCurrencyCode(currencyCode);
+ }
+
+ /**
+ * Set the namespace.
+ *
+ * @param namespace
+ * the namespace, not null
+ * @return the builder, for chaining
+ */
+ public Builder setNamespace(String namespace) {
+ if (namespace == null) {
+ throw new IllegalArgumentException("namespace may not be null.");
+ }
+ this.namespace = namespace;
+ return this;
+ }
+
+ /**
+ * Set the currency code.
+ *
+ * @param namespace
+ * the currency code, not null
+ * @return the builder, for chaining
+ */
+ public Builder setCurrencyCode(String currencyCode) {
+ if (currencyCode == null) {
+ throw new IllegalArgumentException(
+ "currencyCode may not be null.");
+ }
+ this.currencyCode = currencyCode;
+ return this;
+ }
+
+ /**
+ * Set the default fraction digits.
+ *
+ * @param defaultFractionDigits
+ * the default fraction digits
+ * @return the builder, for chaining
+ */
+ public Builder setDefaultFractionDigits(int defaultFractionDigits) {
+ if (defaultFractionDigits < -1) {
+ throw new IllegalArgumentException(
+ "Invalid value for defaultFractionDigits: "
+ + defaultFractionDigits);
+ }
+ this.defaultFractionDigits = defaultFractionDigits;
+ return this;
+ }
+
+ /**
+ * Set the numeric currency code.
+ *
+ * @param numericCode
+ * the numeric currency code
+ * @return the builder, for chaining
+ */
+ public Builder setNumericCode(int numericCode) {
+ if (numericCode < -1) {
+ throw new IllegalArgumentException(
+ "Invalid value for numericCode: " + numericCode);
+ }
+ this.numericCode = numericCode;
+ return this;
+ }
+
+ /**
+ * Sets the start UTC timestamp for the currenciy's validity.
+ *
+ * @param validFrom
+ * the start UTC timestamp
+ * @return the builder, for chaining
+ */
+ public Builder setValidFrom(Long validFrom) {
+ this.validFrom = validFrom;
+ return this;
+ }
+
+ /**
+ * Sets the end UTC timestamp for the currenciy's validity.
+ *
+ * @param validUntil
+ * the ending UTC timestamp
+ * @return the builder, for chaining
+ */
+ public Builder setValidUntil(Long validUntil) {
+ this.validUntil = validUntil;
+ return this;
+ }
+
+ /**
+ * Sets the legal tender attribute.
+ *
+ * @param legalTender
+ * true, if the currency is a legal tender
+ * @return the builder, for chaining
+ */
+ public Builder setLegalTender(boolean legalTender) {
+ this.legalTender = legalTender;
+ return this;
+ }
+
+ /**
+ * Sets the virtual attribute.
+ *
+ * @param virtual
+ * true, if the currency is a virtual currency.
+ * @return the builder, for chaining
+ */
+ public Builder setVirtual(boolean virtual) {
+ this.virtual = virtual;
+ return this;
+ }
+
+ /**
+ * Get the current namespace attribute set.
+ *
+ * @return the namespace value, or null.
+ */
+ public String getNamespace() {
+ return this.namespace;
+ }
+
+ /**
+ * Get the current currency code attribute set.
+ *
+ * @return the currency code value, or null.
+ */
+ public String getCurrencyCode() {
+ return this.currencyCode;
+ }
+
+ /**
+ * Get the current fraction digits attribute set.
+ *
+ * @return the currency fraction digits value.
+ */
+ public int getDefaultFractionDigits() {
+ return this.defaultFractionDigits;
+ }
+
+ /**
+ * Get the current numeric code attribute set.
+ *
+ * @return the numeric code value.
+ */
+ public int getNumericCode() {
+ return this.numericCode;
+ }
+
+ /**
+ * Get the starting validity period timestamp.
+ *
+ * @return the starting validity period tiemstamp, or null..
+ */
+ public Long getValidFrom() {
+ return this.validFrom;
+ }
+
+ /**
+ * Get the ending validity period timestamp.
+ *
+ * @return the ending validity period tiemstamp, or null..
+ */
+ public Long getValidUntil() {
+ return this.validUntil;
+ }
+
+ /**
+ * Access the legal tender attribute.
+ *
+ * @return the attribute value.
+ */
+ public boolean isLegalTender() {
+ return this.legalTender;
+ }
+
+ /**
+ * Access the virtual attribute.
+ *
+ * @return the attribute value.
+ */
+ public boolean isVirtual() {
+ return this.virtual;
+ }
+
+ /**
+ * Checks if this {@link Builder} instance can create a
+ * {@link MoneyCurrency}.
+ *
+ * @see #build()
+ * @return true, if the builder can build.
+ */
+ public boolean isBuildable() {
+ return namespace != null && currencyCode != null;
+ }
+
+ /**
+ * Builds a new currency instance, the instance build is not cached
+ * internally.
+ *
+ * @see #build(boolean)
+ * @return a new instance of {@link MoneyCurrency}.
+ */
+ public MoneyCurrency build() {
+ return build(true);
+ }
+
+ /**
+ * Builds a new currency instance, which ia additinoally stored to the
+ * internal cache for reuse.
+ *
+ * @param cache
+ * flag to optionally store the instance created into the
+ * locale cache.
+ * @return a new instance of {@link MoneyCurrency}.
+ */
+ public MoneyCurrency build(boolean cache) {
+ if (!isBuildable()) {
+ throw new IllegalStateException(
+ "Can not build CurrencyUnitImpl.");
+ }
+ if (cache) {
+ if (validUntil != null) {
+ LOGGER.warning("CurrencyUnit build: Can only cache currencies that have no validity constraints.");
+ cache = false;
+ }
+ if (validFrom != null) {
+ if (validFrom.longValue() > System.currentTimeMillis()) {
+ LOGGER.warning("CurrencyUnit build: Can only cache currencies that are already valid.");
+ cache = false;
+ }
+ }
+ }
+ if (cache) {
+ String key = namespace + ':' + currencyCode;
+ MoneyCurrency current = CACHED.get(key);
+ if (current == null) {
+ current = new MoneyCurrency(namespace, currencyCode,
+ numericCode, defaultFractionDigits, validFrom,
+ validUntil, legalTender, virtual);
+ CACHED.put(key, current);
+ }
+ return current;
+ }
+ return new MoneyCurrency(namespace, currencyCode, numericCode,
+ defaultFractionDigits, validFrom, validUntil, legalTender,
+ virtual);
+ }
+ }
+
+ /**
+ * Adapter that implements the new {@link CurrencyUnit} interface using the
+ * JDK's {@link Currency}.
+ * <p>
+ * This adapter will be removed in the final platform implementation.
+ *
+ * @author Anatole Tresch
+ * @author Werner Keil
+ */
+ private final static class JDKCurrencyAdapter extends MoneyCurrency
+ implements Localizable {
+
+ /**
+ * serialVersionUID.
+ */
+ private static final long serialVersionUID = -2523936311372374236L;
+
+ /**
+ * ISO 4217 currency code for this currency.
+ *
+ * @serial
+ */
+ private final Currency currency;
+
+ /**
+ * Private constructor.
+ *
+ * @param currency
+ */
+ private JDKCurrencyAdapter(Currency currency) {
+ super(currency);
+ this.currency = currency;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+
+ public String toString() {
+ return ISO_NAMESPACE + ':' + getCurrencyCode();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see Localizable#getDisplayName(java.util.Locale)
+ */
+ public String getDisplayName(Locale locale) {
+ //return currency.getName(locale, nameStyle, isChoiceFormat) (locale);
+ return currency.getName(ULocale.forLocale(locale), LONG_NAME, new boolean[1]);
+ }
+
+ }
+
+ /**
+ * Adapter that implements the new {@link CurrencyUnit} interface using the
+ * JDK's {@link Currency}.
+ * <p>
+ * This adapter will be removed in the final platform implementation.
+ *
+ * @author Werner Keil
+ */
+ private final static class ICUCurrencyAdapter extends MoneyCurrency
+ implements Localizable {
+
+ /**
+ * serialVersionUID.
+ */
+ private static final long serialVersionUID = -2523936311372374236L;
+
+ /**
+ * ISO 4217 currency code for this currency.
+ *
+ * @serial
+ */
+ private final com.ibm.icu.util.Currency currency;
+
+ /**
+ * Private constructor.
+ *
+ * @param currency
+ */
+ private ICUCurrencyAdapter(com.ibm.icu.util.Currency currency) {
+ super(ISO_NAMESPACE, currency.getCurrencyCode(), -1, currency.getDefaultFractionDigits(),
+ null, null, true, false);
+ this.currency = currency;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+
+ public String toString() {
+ return ISO_NAMESPACE + ':' + getCurrencyCode();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.money.Localizable#getDisplayName(java.util.Locale)
+ */
+
+ public String getDisplayName(Locale locale) {
+ return currency.getName(ULocale.forLocale(locale), LONG_NAME, new boolean[1]);
+ }
+
+ }
+
+// public String getDisplayName(Locale locale) {
+// return getName(ULocale.forLocale(locale), LONG_NAME, new boolean[1]);
+// }
+//
+// public int getNumericCode() {
+// return -1;
+// }
+
+}
diff --git a/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/money/MoneyUnit.java b/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/money/MoneyUnit.java
index fbc0967..5ec9fb8 100644
--- a/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/money/MoneyUnit.java
+++ b/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/money/MoneyUnit.java
@@ -1,488 +1,488 @@
-/**
- * Copyright (c) 2005, 2015, Werner Keil and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Werner Keil - initial API and implementation
- */
-package org.eclipse.uomo.business.money;
-
-import static org.eclipse.uomo.business.money.MonetaryUnits.ISO_NAMESPACE;
-
-import java.math.BigInteger;
-import java.util.Map;
-
-import org.eclipse.uomo.business.internal.CurrencyUnit;
-import org.eclipse.uomo.business.internal.Localizable;
-import org.eclipse.uomo.business.types.IMoney;
-import org.eclipse.uomo.core.IName;
-import org.eclipse.uomo.units.AbstractConverter;
-import org.eclipse.uomo.units.AbstractUnit;
-import org.eclipse.uomo.units.impl.AlternateUnit;
-import org.eclipse.uomo.units.impl.ProductUnit;
-import org.eclipse.uomo.units.impl.TransformedUnit;
-import org.eclipse.uomo.units.impl.converter.AddConverter;
-import org.eclipse.uomo.units.impl.converter.MultiplyConverter;
-import org.eclipse.uomo.units.impl.converter.RationalConverter;
-import org.unitsofmeasurement.quantity.Quantity;
-import org.unitsofmeasurement.unit.Dimension;
-import org.unitsofmeasurement.unit.IncommensurableException;
-import org.unitsofmeasurement.unit.UnconvertibleException;
-import org.unitsofmeasurement.unit.Unit;
-import org.unitsofmeasurement.unit.UnitConverter;
-
-import com.ibm.icu.util.Currency;
-import com.ibm.icu.util.ULocale;
-
-
-/**
- * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
- * @version 0.2.8, $Date: 2015-04-15
- * @param <Q> the monetary quantity
- *
- */
-public class MoneyUnit<Q extends IMoney> extends Currency implements
- Unit<IMoney>, IName, CurrencyUnit, Localizable {
-// TODO use JSR 354
- /**
- *
- */
- private static final long serialVersionUID = 8524573975644908457L;
-
- /** namespace for this currency. */
- private final String namespace;
- /** valid from, or {@code null}. */
- private final Long validFrom;
- /** valid until, or {@code null}. */
- private final Long validUntil;
- /** true, if legal tender. */
- private final boolean legalTender;
- /** true, if it is a virtual currency. */
- private final boolean virtual;
-
- protected MoneyUnit(String theCode, String namespace,
- Long validFrom, Long validUntil,
- boolean legalTender, boolean virtual) {
- super(theCode);
- this.namespace = namespace;
- this.validFrom = validFrom;
- this.validUntil = validUntil;
- this.legalTender = legalTender;
- this.virtual = virtual;
- }
-
- protected MoneyUnit(String theISOCode) {
- this(theISOCode, ISO_NAMESPACE, null, null, true, false);
- }
-
- /**
- * The Canadian Dollar currency unit.
- */
- public static final MoneyUnit<IMoney> CAD = new MoneyUnit<IMoney>("CAD"); //$NON-NLS-1$
-
- /**
- * The China Yan currency.
- */
- public static final MoneyUnit<IMoney> CNY = new MoneyUnit<IMoney>("CNY"); //$NON-NLS-1$
-
- /**
- * The Euro currency.
- */
- @SuppressWarnings("rawtypes")
- public static final MoneyUnit EUR = new MoneyUnit<IMoney>("EUR"); //$NON-NLS-1$
-
- /**
- * The British Pound currency.
- */
- public static final MoneyUnit<IMoney> GBP = new MoneyUnit<IMoney>("GBP"); //$NON-NLS-1$
-
- /**
- * The Japanese Yen currency.
- */
- public static final MoneyUnit<IMoney> JPY = new MoneyUnit<IMoney>("JPY"); //$NON-NLS-1$
-
- /**
- * The Korean Republic Won currency.
- */
- public static final MoneyUnit<IMoney> KRW = new MoneyUnit<IMoney>("KRW"); //$NON-NLS-1$
-
- /**
- * The Taiwanese dollar currency.
- */
- @SuppressWarnings("rawtypes")
- public static final MoneyUnit TWD = new MoneyUnit<IMoney>("TWD"); //$NON-NLS-1$
-
- /**
- * Holds the dimensionless unit <code>ONE</code>.
- */
- public static final ProductUnit<IMoney> ONE = new ProductUnit<IMoney>();
-
- /**
- * The United State dollar currency.
- */
- @SuppressWarnings("rawtypes")
- public static final MoneyUnit USD = new MoneyUnit<IMoney>("USD"); //$NON-NLS-1$
-
- /**
- * Returns the result of adding an offset to this unit. The returned unit is
- * convertible with all units that are convertible with this unit.
- *
- * @param offset
- * the offset added (expressed in this unit, e.g.
- * <code>CELSIUS = KELVIN.add(273.15)</code>).
- * @return <code>this.transform(new AddConverter(offset))</code>
- */
- public final Unit<IMoney> add(double offset) {
- if (offset == 0)
- return this;
- return transform(new AddConverter(offset));
- }
-
- /**
- * Returns a metric unit equivalent to this unscaled metric unit but used in
- * expressions to distinguish between quantities of a different nature but
- * of the same dimensions.
- *
- * <p>
- * Examples of alternate units:[code] Unit<Angle> RADIAN =
- * ONE.alternate("rad"); Unit<Force> NEWTON =
- * METRE.times(KILOGRAM).divide(SECOND.pow(2)).alternate("N");
- * Unit<Pressure> PASCAL = NEWTON.divide(METRE.pow(2)).alternate("Pa");
- * [/code]
- * </p>
- *
- * @param <Q>
- * the type of the quantity measured by the new alternate unit.
- *
- * @param symbol
- * the new symbol for the alternate unit.
- * @return the alternate unit.
- * @throws UnsupportedOperationException
- * if this unit is not an unscaled metric unit.
- * @throws IllegalArgumentException
- * if the specified symbol is already associated to a different
- * unit.
- */
- @SuppressWarnings({ "unchecked", "rawtypes" })
- public final Unit<IMoney> alternate(String symbol) {
- return new AlternateUnit(symbol, this);
- }
-
- public <T extends Quantity<T>> Unit<T> asType(Class<T> type) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /**
- * Returns the result of dividing this unit by an approximate divisor.
- *
- * @param divisor
- * the approximate divisor.
- * @return <code>this.transform(new MultiplyConverter(1.0 / divisor))</code>
- */
- public final Unit<IMoney> divide(double divisor) {
- if (divisor == 1)
- return this;
- return transform(new MultiplyConverter(1.0 / divisor));
- }
-
- /**
- * Returns the result of dividing this unit by an exact divisor.
- *
- * @param divisor
- * the exact divisor. (e.g.
- * <code>QUART = GALLON_LIQUID_US.divide(4)</code>).
- * @return <code>this.transform(new RationalConverter(1 , divisor))</code>
- */
- public final Unit<?> divide(long divisor) {
- if (divisor == 1)
- return this;
- return (Unit<?>) transform(new RationalConverter(BigInteger.ONE,
- BigInteger.valueOf(divisor)));
- }
-
- public UnitConverter getConverterTo(Unit<IMoney> that)
- throws UnconvertibleException {
- return new MoneyConverter(this, that, 1);
- }
-
- public UnitConverter getConverterToAny(Unit<?> that)
- throws IncommensurableException, UnconvertibleException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Dimension getDimension() {
- return IMoney.DIMENSION;
- }
-
- public Map<Unit<?>, Integer> getProductUnits() {
- // TODO Auto-generated method stub
- return null;
- }
-
- private boolean isRationalFactor() {
- // if (!(this instanceof TransformedUnit<?>))
- // return false;
- // TransformedUnit<Q> tu = (TransformedUnit<Q>) this;
- // return tu.getParentUnit().equals(ONE) &&
- // (tu.getConverterTo(tu.toMetric()) instanceof RationalConverter);
- return true;
- }
-
- /**
- * Returns the inverse of this unit.
- *
- * @return <code>1 / this</code>
- */
- @SuppressWarnings({ "unchecked", "rawtypes" })
- public final Unit<?> inverse() {
- if (this.equals(ONE))
- return this;
- if (this.isRationalFactor())
- return this.transform(this.getConverterTo((Unit) ONE).inverse());
- return ProductUnit.getQuotientInstance(ONE, this);
- }
-
- public boolean isCompatible(Unit<?> that) {
- return (this == that)
- || this.toMetric().equals(that.getSystemUnit())
- || (!"".equals(this.getDimension().toString()) && this.getDimension().equals(that.getDimension())); //$NON-NLS-1$
- }
-
- /**
- * Returns the result of multiplying this unit by an exact factor.
- *
- * @param factor
- * the exact scale factor (e.g.
- * <code>KILOMETRE = METRE.multiply(1000)</code>).
- * @return <code>this.transform(new RationalConverter(factor, 1))</code>
- */
- final Unit<IMoney> multiply(long factor) {
- if (factor == 1)
- return this;
- return transform(new RationalConverter(BigInteger.valueOf(factor),
- BigInteger.ONE));
- }
-
- /**
- * Returns the result of multiplying this unit by a an approximate factor.
- *
- * @param factor
- * the approximate factor (e.g.
- * <code>ELECTRON_MASS = KILOGRAM.multiply(9.10938188e-31)</code>
- * ).
- * @return <code>this.transform(new MultiplyConverter(factor))</code>
- */
- public final Unit<IMoney> multiply(double factor) {
- if (factor == 1)
- return this;
- return transform(new MultiplyConverter(factor));
- }
-
- /**
- * Returns the product of this unit with the one specified.
- *
- * @param that
- * the unit multiplicand.
- * @return <code>this * that</code>
- */
- @SuppressWarnings({ "unchecked", "rawtypes" })
- public final Unit<?> multiply(Unit<?> that) {
- if (this.equals(ONE))
- return that;
- if (that.equals(ONE))
- return this;
- if (this.isRationalFactor())
- return that.transform(this.getConverterTo(ONE));
- if (((MoneyUnit<?>) that).isRationalFactor())
- return this.transform(that.getConverterTo((Unit) ONE));
- return ProductUnit.getProductInstance(this, (AbstractUnit<?>) that);
- }
-
- /**
- * Returns a unit equals to this unit raised to an exponent.
- *
- * @param n
- * the exponent.
- * @return the result of raising this unit to the exponent.
- */
- public final Unit<?> pow(int n) {
- if (n > 0)
- return this.multiply(this.pow(n - 1));
- else if (n == 0)
- return ONE;
- else
- // n < 0
- return ONE.divide(this.pow(-n));
- }
-
- /**
- * Returns a unit equals to the given root of this unit.
- *
- * @param n
- * the root's order.
- * @return the result of taking the given root of this unit.
- * @throws ArithmeticException
- * if <code>n == 0</code> or if this operation would result in
- * an unit with a fractional exponent.
- */
- public final Unit<?> root(int n) {
- if (n > 0)
- return ProductUnit.getRootInstance(this, n);
- else if (n == 0)
- throw new ArithmeticException("Root's order of zero"); //$NON-NLS-1$
- else
- // n < 0
- return ONE.divide(this.root(-n));
- }
-
- protected Unit<IMoney> toMetric() {
- return this;
- }
-
- /**
- * Returns the unit derived from this unit using the specified converter.
- * The converter does not need to be linear. For example:[code]
- * Unit<Dimensionless> DECIBEL = Unit.ONE.transform( new
- * LogConverter(10).inverse().concatenate( new RationalConverter(1, 10)));
- * [/code]
- *
- * @param operation
- * the converter from the transformed unit to this unit.
- * @return the unit after the specified transformation.
- */
- @SuppressWarnings("unchecked")
- public final Unit<IMoney> transform(UnitConverter operation) {
- if (this instanceof Unit<?>) {
- Unit<IMoney> tf = this;
- Unit<?> parent = (Unit<?>) ((TransformedUnit<?>) tf)
- .getParentUnit();
- UnitConverter toParent = ((TransformedUnit<?>) tf).toParentUnit();
- if (toParent == null)
- return (Unit<IMoney>) parent;
- UnitConverter toParentConcat = toParent.concatenate(operation);
- if (toParentConcat == AbstractConverter.IDENTITY)
- return (Unit<IMoney>) parent;
- return new TransformedUnit<IMoney>((Unit<IMoney>) parent,
- (AbstractConverter) toParentConcat);
- }
- if (operation == AbstractConverter.IDENTITY)
- return this;
- return new TransformedUnit<IMoney>(this, (AbstractConverter) operation);
- }
-
- /**
- * Returns the quotient of this unit with the one specified.
- *
- * @param that
- * the unit divisor.
- * @return <code>this / that</code>
- */
- public final Unit<?> divide(Unit<?> that) {
- return (Unit<?>) this.multiply(that.inverse());
- }
-
- public String getName() {
- return getName(ULocale.getDefault(), LONG_NAME, new boolean[] { false });
- }
-
- public Unit<IMoney> getSystemUnit() {
- return toMetric();
- }
-
- /**
- * Get the namespace of this {@link CurrencyUnit}, default 'ISO-4217'.
- */
- public String getNamespace() {
- return namespace;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see CurrencyUnit#isLegalTender()
- */
- public boolean isLegalTender() {
- return legalTender;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see CurrencyUnit#isVirtual()
- */
- public boolean isVirtual() {
- return virtual;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see CurrencyUnit#getValidFrom()
- */
-
- public Long getValidFrom() {
- return validFrom;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see CurrencyUnit#getValidUntil()
- */
-
- public Long getValidUntil() {
- return validUntil;
- }
-
- public int compareTo(CurrencyUnit currency) {
- int compare = getNamespace().compareTo(currency.getNamespace());
- if (compare == 0) {
- compare = getCurrencyCode().compareTo(currency.getCurrencyCode());
- }
- if (compare == 0) {
- if (validFrom == null && currency.getValidFrom() != null) {
- compare = -1;
- } else if (validFrom != null && currency.getValidFrom() == null) {
- compare = 1;
- } else if (validFrom != null) {
- compare = validFrom.compareTo(currency.getValidFrom());
- }
- }
- if (compare == 0) {
- if (validUntil == null && currency.getValidUntil() != null) {
- compare = -1;
- } else if (validUntil != null && currency.getValidUntil() == null) {
- compare = 1;
- } else if (validUntil != null) {
- compare = validUntil.compareTo(currency.getValidUntil());
- }
- }
- return compare;
- }
-
- /**
- * Access a new instance based on the ISO currency code. The code must
- * return a {@link Currency} when passed to
- * {@link Currency#getInstance(String)}.
- *
- * @param currencyCode
- * the ISO currency code, not null.
- * @return the corresponding {@link MonetaryCurrency} instance.
- */
- public static MoneyUnit of(String currencyCode) {
- return new MoneyUnit(currencyCode);
- }
-
-// public String getDisplayName(Locale locale) {
-// return getName(ULocale.forLocale(locale), LONG_NAME, new boolean[1]);
-// }
-//
-// public int getNumericCode() {
-// return -1;
-// }
-}
+/**
+ * Copyright (c) 2005, 2015, Werner Keil and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Werner Keil - initial API and implementation
+ */
+package org.eclipse.uomo.business.money;
+
+import static org.eclipse.uomo.business.money.MonetaryUnits.ISO_NAMESPACE;
+
+import java.math.BigInteger;
+import java.util.Map;
+
+import org.eclipse.uomo.business.internal.CurrencyUnit;
+import org.eclipse.uomo.business.internal.Localizable;
+import org.eclipse.uomo.business.types.IMoney;
+import org.eclipse.uomo.core.IName;
+import org.eclipse.uomo.units.AbstractConverter;
+import org.eclipse.uomo.units.AbstractUnit;
+import org.eclipse.uomo.units.impl.AlternateUnit;
+import org.eclipse.uomo.units.impl.ProductUnit;
+import org.eclipse.uomo.units.impl.TransformedUnit;
+import org.eclipse.uomo.units.impl.converter.AddConverter;
+import org.eclipse.uomo.units.impl.converter.MultiplyConverter;
+import org.eclipse.uomo.units.impl.converter.RationalConverter;
+import org.unitsofmeasurement.quantity.Quantity;
+import org.unitsofmeasurement.unit.Dimension;
+import org.unitsofmeasurement.unit.IncommensurableException;
+import org.unitsofmeasurement.unit.UnconvertibleException;
+import org.unitsofmeasurement.unit.Unit;
+import org.unitsofmeasurement.unit.UnitConverter;
+
+import com.ibm.icu.util.Currency;
+import com.ibm.icu.util.ULocale;
+
+
+/**
+ * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
+ * @version 0.2.8, $Date: 2015-04-15
+ * @param <Q> the monetary quantity
+ *
+ */
+public class MoneyUnit<Q extends IMoney> extends Currency implements
+ Unit<IMoney>, IName, CurrencyUnit, Localizable {
+// TODO use JSR 354
+ /**
+ *
+ */
+ private static final long serialVersionUID = 8524573975644908457L;
+
+ /** namespace for this currency. */
+ private final String namespace;
+ /** valid from, or {@code null}. */
+ private final Long validFrom;
+ /** valid until, or {@code null}. */
+ private final Long validUntil;
+ /** true, if legal tender. */
+ private final boolean legalTender;
+ /** true, if it is a virtual currency. */
+ private final boolean virtual;
+
+ protected MoneyUnit(String theCode, String namespace,
+ Long validFrom, Long validUntil,
+ boolean legalTender, boolean virtual) {
+ super(theCode);
+ this.namespace = namespace;
+ this.validFrom = validFrom;
+ this.validUntil = validUntil;
+ this.legalTender = legalTender;
+ this.virtual = virtual;
+ }
+
+ protected MoneyUnit(String theISOCode) {
+ this(theISOCode, ISO_NAMESPACE, null, null, true, false);
+ }
+
+ /**
+ * The Canadian Dollar currency unit.
+ */
+ public static final MoneyUnit<IMoney> CAD = new MoneyUnit<IMoney>("CAD"); //$NON-NLS-1$
+
+ /**
+ * The China Yan currency.
+ */
+ public static final MoneyUnit<IMoney> CNY = new MoneyUnit<IMoney>("CNY"); //$NON-NLS-1$
+
+ /**
+ * The Euro currency.
+ */
+ @SuppressWarnings("rawtypes")
+ public static final MoneyUnit EUR = new MoneyUnit<IMoney>("EUR"); //$NON-NLS-1$
+
+ /**
+ * The British Pound currency.
+ */
+ public static final MoneyUnit<IMoney> GBP = new MoneyUnit<IMoney>("GBP"); //$NON-NLS-1$
+
+ /**
+ * The Japanese Yen currency.
+ */
+ public static final MoneyUnit<IMoney> JPY = new MoneyUnit<IMoney>("JPY"); //$NON-NLS-1$
+
+ /**
+ * The Korean Republic Won currency.
+ */
+ public static final MoneyUnit<IMoney> KRW = new MoneyUnit<IMoney>("KRW"); //$NON-NLS-1$
+
+ /**
+ * The Taiwanese dollar currency.
+ */
+ @SuppressWarnings("rawtypes")
+ public static final MoneyUnit TWD = new MoneyUnit<IMoney>("TWD"); //$NON-NLS-1$
+
+ /**
+ * Holds the dimensionless unit <code>ONE</code>.
+ */
+ public static final ProductUnit<IMoney> ONE = new ProductUnit<IMoney>();
+
+ /**
+ * The United State dollar currency.
+ */
+ @SuppressWarnings("rawtypes")
+ public static final MoneyUnit USD = new MoneyUnit<IMoney>("USD"); //$NON-NLS-1$
+
+ /**
+ * Returns the result of adding an offset to this unit. The returned unit is
+ * convertible with all units that are convertible with this unit.
+ *
+ * @param offset
+ * the offset added (expressed in this unit, e.g.
+ * <code>CELSIUS = KELVIN.add(273.15)</code>).
+ * @return <code>this.transform(new AddConverter(offset))</code>
+ */
+ public final Unit<IMoney> add(double offset) {
+ if (offset == 0)
+ return this;
+ return transform(new AddConverter(offset));
+ }
+
+ /**
+ * Returns a metric unit equivalent to this unscaled metric unit but used in
+ * expressions to distinguish between quantities of a different nature but
+ * of the same dimensions.
+ *
+ * <p>
+ * Examples of alternate units:[code] Unit<Angle> RADIAN =
+ * ONE.alternate("rad"); Unit<Force> NEWTON =
+ * METRE.times(KILOGRAM).divide(SECOND.pow(2)).alternate("N");
+ * Unit<Pressure> PASCAL = NEWTON.divide(METRE.pow(2)).alternate("Pa");
+ * [/code]
+ * </p>
+ *
+ * @param <Q>
+ * the type of the quantity measured by the new alternate unit.
+ *
+ * @param symbol
+ * the new symbol for the alternate unit.
+ * @return the alternate unit.
+ * @throws UnsupportedOperationException
+ * if this unit is not an unscaled metric unit.
+ * @throws IllegalArgumentException
+ * if the specified symbol is already associated to a different
+ * unit.
+ */
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public final Unit<IMoney> alternate(String symbol) {
+ return new AlternateUnit(symbol, this);
+ }
+
+ public <T extends Quantity<T>> Unit<T> asType(Class<T> type) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ * Returns the result of dividing this unit by an approximate divisor.
+ *
+ * @param divisor
+ * the approximate divisor.
+ * @return <code>this.transform(new MultiplyConverter(1.0 / divisor))</code>
+ */
+ public final Unit<IMoney> divide(double divisor) {
+ if (divisor == 1)
+ return this;
+ return transform(new MultiplyConverter(1.0 / divisor));
+ }
+
+ /**
+ * Returns the result of dividing this unit by an exact divisor.
+ *
+ * @param divisor
+ * the exact divisor. (e.g.
+ * <code>QUART = GALLON_LIQUID_US.divide(4)</code>).
+ * @return <code>this.transform(new RationalConverter(1 , divisor))</code>
+ */
+ public final Unit<?> divide(long divisor) {
+ if (divisor == 1)
+ return this;
+ return (Unit<?>) transform(new RationalConverter(BigInteger.ONE,
+ BigInteger.valueOf(divisor)));
+ }
+
+ public UnitConverter getConverterTo(Unit<IMoney> that)
+ throws UnconvertibleException {
+ return new MoneyConverter(this, that, 1);
+ }
+
+ public UnitConverter getConverterToAny(Unit<?> that)
+ throws IncommensurableException, UnconvertibleException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Dimension getDimension() {
+ return IMoney.DIMENSION;
+ }
+
+ public Map<Unit<?>, Integer> getProductUnits() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ private boolean isRationalFactor() {
+ // if (!(this instanceof TransformedUnit<?>))
+ // return false;
+ // TransformedUnit<Q> tu = (TransformedUnit<Q>) this;
+ // return tu.getParentUnit().equals(ONE) &&
+ // (tu.getConverterTo(tu.toMetric()) instanceof RationalConverter);
+ return true;
+ }
+
+ /**
+ * Returns the inverse of this unit.
+ *
+ * @return <code>1 / this</code>
+ */
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public final Unit<?> inverse() {
+ if (this.equals(ONE))
+ return this;
+ if (this.isRationalFactor())
+ return this.transform(this.getConverterTo((Unit) ONE).inverse());
+ return ProductUnit.getQuotientInstance(ONE, this);
+ }
+
+ public boolean isCompatible(Unit<?> that) {
+ return (this == that)
+ || this.toMetric().equals(that.getSystemUnit())
+ || (!"".equals(this.getDimension().toString()) && this.getDimension().equals(that.getDimension())); //$NON-NLS-1$
+ }
+
+ /**
+ * Returns the result of multiplying this unit by an exact factor.
+ *
+ * @param factor
+ * the exact scale factor (e.g.
+ * <code>KILOMETRE = METRE.multiply(1000)</code>).
+ * @return <code>this.transform(new RationalConverter(factor, 1))</code>
+ */
+ final Unit<IMoney> multiply(long factor) {
+ if (factor == 1)
+ return this;
+ return transform(new RationalConverter(BigInteger.valueOf(factor),
+ BigInteger.ONE));
+ }
+
+ /**
+ * Returns the result of multiplying this unit by a an approximate factor.
+ *
+ * @param factor
+ * the approximate factor (e.g.
+ * <code>ELECTRON_MASS = KILOGRAM.multiply(9.10938188e-31)</code>
+ * ).
+ * @return <code>this.transform(new MultiplyConverter(factor))</code>
+ */
+ public final Unit<IMoney> multiply(double factor) {
+ if (factor == 1)
+ return this;
+ return transform(new MultiplyConverter(factor));
+ }
+
+ /**
+ * Returns the product of this unit with the one specified.
+ *
+ * @param that
+ * the unit multiplicand.
+ * @return <code>this * that</code>
+ */
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public final Unit<?> multiply(Unit<?> that) {
+ if (this.equals(ONE))
+ return that;
+ if (that.equals(ONE))
+ return this;
+ if (this.isRationalFactor())
+ return that.transform(this.getConverterTo(ONE));
+ if (((MoneyUnit<?>) that).isRationalFactor())
+ return this.transform(that.getConverterTo((Unit) ONE));
+ return ProductUnit.getProductInstance(this, (AbstractUnit<?>) that);
+ }
+
+ /**
+ * Returns a unit equals to this unit raised to an exponent.
+ *
+ * @param n
+ * the exponent.
+ * @return the result of raising this unit to the exponent.
+ */
+ public final Unit<?> pow(int n) {
+ if (n > 0)
+ return this.multiply(this.pow(n - 1));
+ else if (n == 0)
+ return ONE;
+ else
+ // n < 0
+ return ONE.divide(this.pow(-n));
+ }
+
+ /**
+ * Returns a unit equals to the given root of this unit.
+ *
+ * @param n
+ * the root's order.
+ * @return the result of taking the given root of this unit.
+ * @throws ArithmeticException
+ * if <code>n == 0</code> or if this operation would result in
+ * an unit with a fractional exponent.
+ */
+ public final Unit<?> root(int n) {
+ if (n > 0)
+ return ProductUnit.getRootInstance(this, n);
+ else if (n == 0)
+ throw new ArithmeticException("Root's order of zero"); //$NON-NLS-1$
+ else
+ // n < 0
+ return ONE.divide(this.root(-n));
+ }
+
+ protected Unit<IMoney> toMetric() {
+ return this;
+ }
+
+ /**
+ * Returns the unit derived from this unit using the specified converter.
+ * The converter does not need to be linear. For example:[code]
+ * Unit<Dimensionless> DECIBEL = Unit.ONE.transform( new
+ * LogConverter(10).inverse().concatenate( new RationalConverter(1, 10)));
+ * [/code]
+ *
+ * @param operation
+ * the converter from the transformed unit to this unit.
+ * @return the unit after the specified transformation.
+ */
+ @SuppressWarnings("unchecked")
+ public final Unit<IMoney> transform(UnitConverter operation) {
+ if (this instanceof Unit<?>) {
+ Unit<IMoney> tf = this;
+ Unit<?> parent = (Unit<?>) ((TransformedUnit<?>) tf)
+ .getParentUnit();
+ UnitConverter toParent = ((TransformedUnit<?>) tf).toParentUnit();
+ if (toParent == null)
+ return (Unit<IMoney>) parent;
+ UnitConverter toParentConcat = toParent.concatenate(operation);
+ if (toParentConcat == AbstractConverter.IDENTITY)
+ return (Unit<IMoney>) parent;
+ return new TransformedUnit<IMoney>((Unit<IMoney>) parent,
+ (AbstractConverter) toParentConcat);
+ }
+ if (operation == AbstractConverter.IDENTITY)
+ return this;
+ return new TransformedUnit<IMoney>(this, (AbstractConverter) operation);
+ }
+
+ /**
+ * Returns the quotient of this unit with the one specified.
+ *
+ * @param that
+ * the unit divisor.
+ * @return <code>this / that</code>
+ */
+ public final Unit<?> divide(Unit<?> that) {
+ return (Unit<?>) this.multiply(that.inverse());
+ }
+
+ public String getName() {
+ return getName(ULocale.getDefault(), LONG_NAME, new boolean[] { false });
+ }
+
+ public Unit<IMoney> getSystemUnit() {
+ return toMetric();
+ }
+
+ /**
+ * Get the namespace of this {@link CurrencyUnit}, default 'ISO-4217'.
+ */
+ public String getNamespace() {
+ return namespace;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see CurrencyUnit#isLegalTender()
+ */
+ public boolean isLegalTender() {
+ return legalTender;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see CurrencyUnit#isVirtual()
+ */
+ public boolean isVirtual() {
+ return virtual;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see CurrencyUnit#getValidFrom()
+ */
+
+ public Long getValidFrom() {
+ return validFrom;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see CurrencyUnit#getValidUntil()
+ */
+
+ public Long getValidUntil() {
+ return validUntil;
+ }
+
+ public int compareTo(CurrencyUnit currency) {
+ int compare = getNamespace().compareTo(currency.getNamespace());
+ if (compare == 0) {
+ compare = getCurrencyCode().compareTo(currency.getCurrencyCode());
+ }
+ if (compare == 0) {
+ if (validFrom == null && currency.getValidFrom() != null) {
+ compare = -1;
+ } else if (validFrom != null && currency.getValidFrom() == null) {
+ compare = 1;
+ } else if (validFrom != null) {
+ compare = validFrom.compareTo(currency.getValidFrom());
+ }
+ }
+ if (compare == 0) {
+ if (validUntil == null && currency.getValidUntil() != null) {
+ compare = -1;
+ } else if (validUntil != null && currency.getValidUntil() == null) {
+ compare = 1;
+ } else if (validUntil != null) {
+ compare = validUntil.compareTo(currency.getValidUntil());
+ }
+ }
+ return compare;
+ }
+
+ /**
+ * Access a new instance based on the ISO currency code. The code must
+ * return a {@link Currency} when passed to
+ * {@link Currency#getInstance(String)}.
+ *
+ * @param currencyCode
+ * the ISO currency code, not null.
+ * @return the corresponding {@link MonetaryCurrency} instance.
+ */
+ public static MoneyUnit of(String currencyCode) {
+ return new MoneyUnit(currencyCode);
+ }
+
+// public String getDisplayName(Locale locale) {
+// return getName(ULocale.forLocale(locale), LONG_NAME, new boolean[1]);
+// }
+//
+// public int getNumericCode() {
+// return -1;
+// }
+}
diff --git a/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/types/BDTypeException.java b/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/types/BDTypeException.java
index dafd4d2..e26e439 100644
--- a/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/types/BDTypeException.java
+++ b/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/types/BDTypeException.java
@@ -1,30 +1,30 @@
-/**
- * Copyright (c) 2005, 2011, Werner Keil, Ikayzo and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Werner Keil - initial API and implementation
- */
-package org.eclipse.uomo.business.types;
-
-import org.eclipse.uomo.core.UOMoRuntimeException;
-
-
-/**
- * Basic Data Type Exception class
- * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
- * @deprecated Try using UOMoRuntimeException directly
- */
-public class BDTypeException extends UOMoRuntimeException {
- final static long serialVersionUID = 362498820763181265L;
-/**
- * BDTypeException constructor with String.
- */
-public BDTypeException(String s) {
- super(s);
-
-}
-}
+/**
+ * Copyright (c) 2005, 2011, Werner Keil, Ikayzo and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Werner Keil - initial API and implementation
+ */
+package org.eclipse.uomo.business.types;
+
+import org.eclipse.uomo.core.UOMoRuntimeException;
+
+
+/**
+ * Basic Data Type Exception class
+ * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
+ * @deprecated Try using UOMoRuntimeException directly
+ */
+public class BDTypeException extends UOMoRuntimeException {
+ final static long serialVersionUID = 362498820763181265L;
+/**
+ * BDTypeException constructor with String.
+ */
+public BDTypeException(String s) {
+ super(s);
+
+}
+}
diff --git a/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/types/IBasicType.java b/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/types/IBasicType.java
index 97a1fe6..02d019b 100644
--- a/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/types/IBasicType.java
+++ b/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/types/IBasicType.java
@@ -1,16 +1,16 @@
-package org.eclipse.uomo.business.types;
-
-/**
- * This interface indicates that a class is a Basic Data Type
- *
- * @author Werner Keil
- */
-public interface IBasicType {
-
- /**
- * This requires that all Basic Data Types implement a serialize method
- *
- * @return java.lang.String
- */
- String serialize();
-}
+package org.eclipse.uomo.business.types;
+
+/**
+ * This interface indicates that a class is a Basic Data Type
+ *
+ * @author Werner Keil
+ */
+public interface IBasicType {
+
+ /**
+ * This requires that all Basic Data Types implement a serialize method
+ *
+ * @return java.lang.String
+ */
+ String serialize();
+}
diff --git a/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/types/IMarket.java b/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/types/IMarket.java
index 0c8cd78..365feae 100644
--- a/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/types/IMarket.java
+++ b/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/types/IMarket.java
@@ -1,92 +1,92 @@
-package org.eclipse.uomo.business.types;
-
-import java.util.*;
-
-import org.eclipse.uomo.core.IName;
-import org.eclipse.uomo.core.ISymbol;
-import org.unitsofmeasurement.quantity.Time;
-import org.unitsofmeasurement.unit.Unit;
-
-import com.ibm.icu.util.Holiday;
-
-/**
- * Insert the type's description here. Creation date: (9/20/00 2:35:47 PM)
- * @version $Revision$, Change date: ($Date$)
- * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
- */
-public interface IMarket extends IBDType, IName, ISymbol {
- /**
- * Insert the method's description here. Creation date: (9/26/00 4:55:31 PM)
- *
- * @return java.util.HashMap
- */
- Map<Date, Holiday> getHolidays();
-
- /**
- * Insert the method's description here. Creation date: (9/28/00 9:43:08 AM)
- *
- * @return java.util.HashMap
- */
- Map<Date, Holiday> getReplHolidays();
-
- /**
- * Insert the method's description here. Creation date: (9/25/00 10:25:18
- * AM)
- *
- * @return java.util.HashMap
- */
- Map<String, List<Time>> getTimes();
-
- /**
- * Insert the method's description here. Creation date: (9/25/00 4:36:09 PM)
- *
- * @return java.lang.String
- */
- String getTimeZone();
-
- /**
- * Returns true if market is open for specified date and FI Type
- *
- * @return boolean
- */
- public boolean isOpen(Date date, String fiType);
-
- /**
- * Returns true if market is open for specified time and FI Type
- *
- * @return boolean
- */
- public boolean isOpen(Unit<Time> ts, String fiType);
-
- /**
- * Returns true if market is open right now for specified FIType
- *
- * @return boolean
- */
- public boolean isOpen(String fiType);
-
- /**
- * Insert the method's description here. Creation date: (9/26/00 4:52:54 PM)
- *
- * @param hm
- * java.util.HashMap
- */
- void setHolidays(Map<Date, Holiday> hm);
-
- /**
- * Insert the method's description here. Creation date: (9/26/00 4:52:54 PM)
- *
- * @param hm
- * java.util.HashMap
- */
- void setReplHolidays(Map<Date, Holiday> hm);
-
- /**
- * Insert the method's description here. Creation date: (9/25/00 10:25:57
- * AM)
- *
- * @param hm
- * java.util.HashMap
- */
- void setTimes(Map<String, List<Time>> hm);
-}
+package org.eclipse.uomo.business.types;
+
+import java.util.*;
+
+import org.eclipse.uomo.core.IName;
+import org.eclipse.uomo.core.ISymbol;
+import org.unitsofmeasurement.quantity.Time;
+import org.unitsofmeasurement.unit.Unit;
+
+import com.ibm.icu.util.Holiday;
+
+/**
+ * Insert the type's description here. Creation date: (9/20/00 2:35:47 PM)
+ * @version $Revision$, Change date: ($Date$)
+ * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
+ */
+public interface IMarket extends IBDType, IName, ISymbol {
+ /**
+ * Insert the method's description here. Creation date: (9/26/00 4:55:31 PM)
+ *
+ * @return java.util.HashMap
+ */
+ Map<Date, Holiday> getHolidays();
+
+ /**
+ * Insert the method's description here. Creation date: (9/28/00 9:43:08 AM)
+ *
+ * @return java.util.HashMap
+ */
+ Map<Date, Holiday> getReplHolidays();
+
+ /**
+ * Insert the method's description here. Creation date: (9/25/00 10:25:18
+ * AM)
+ *
+ * @return java.util.HashMap
+ */
+ Map<String, List<Time>> getTimes();
+
+ /**
+ * Insert the method's description here. Creation date: (9/25/00 4:36:09 PM)
+ *
+ * @return java.lang.String
+ */
+ String getTimeZone();
+
+ /**
+ * Returns true if market is open for specified date and FI Type
+ *
+ * @return boolean
+ */
+ public boolean isOpen(Date date, String fiType);
+
+ /**
+ * Returns true if market is open for specified time and FI Type
+ *
+ * @return boolean
+ */
+ public boolean isOpen(Unit<Time> ts, String fiType);
+
+ /**
+ * Returns true if market is open right now for specified FIType
+ *
+ * @return boolean
+ */
+ public boolean isOpen(String fiType);
+
+ /**
+ * Insert the method's description here. Creation date: (9/26/00 4:52:54 PM)
+ *
+ * @param hm
+ * java.util.HashMap
+ */
+ void setHolidays(Map<Date, Holiday> hm);
+
+ /**
+ * Insert the method's description here. Creation date: (9/26/00 4:52:54 PM)
+ *
+ * @param hm
+ * java.util.HashMap
+ */
+ void setReplHolidays(Map<Date, Holiday> hm);
+
+ /**
+ * Insert the method's description here. Creation date: (9/25/00 10:25:57
+ * AM)
+ *
+ * @param hm
+ * java.util.HashMap
+ */
+ void setTimes(Map<String, List<Time>> hm);
+}
diff --git a/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/types/IMoney.java b/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/types/IMoney.java
index 7f5228c..2a43dcf 100644
--- a/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/types/IMoney.java
+++ b/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/types/IMoney.java
@@ -1,33 +1,33 @@
-/**
- * Copyright (c) 2005, 2010, Werner Keil, Ikayzo and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Werner Keil, Jean-Marie Dautelle - initial API and implementation
- */
-package org.eclipse.uomo.business.types;
-
-import static org.eclipse.uomo.business.money.MoneyAmount.UNIT;
-
-import org.eclipse.uomo.units.IMeasure;
-import org.unitsofmeasurement.unit.Dimension;
-
-/**
- * This interface represents something generally accepted as a medium of
- * exchange, a measure of value, or a means of payment. The units for money
- * quantities is of type {@link Currency}.
- *
- * @author <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
- * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
- * @version 3.2 ($Revision: 227 $), $Date: 2010-10-01 00:54:55 +0200 (Fr, 01 Okt 2010) $
- */
-public interface IMoney extends IBDType, IMeasure<IMoney> {
-
- /**
- * Holds the dimension for money quantities (dimension [$]).
- */
- public static final Dimension DIMENSION = UNIT.getDimension();
-}
+/**
+ * Copyright (c) 2005, 2010, Werner Keil, Ikayzo and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Werner Keil, Jean-Marie Dautelle - initial API and implementation
+ */
+package org.eclipse.uomo.business.types;
+
+import static org.eclipse.uomo.business.money.MoneyAmount.UNIT;
+
+import org.eclipse.uomo.units.IMeasure;
+import org.unitsofmeasurement.unit.Dimension;
+
+/**
+ * This interface represents something generally accepted as a medium of
+ * exchange, a measure of value, or a means of payment. The units for money
+ * quantities is of type {@link Currency}.
+ *
+ * @author <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
+ * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
+ * @version 3.2 ($Revision: 227 $), $Date: 2010-10-01 00:54:55 +0200 (Fr, 01 Okt 2010) $
+ */
+public interface IMoney extends IBDType, IMeasure<IMoney> {
+
+ /**
+ * Holds the dimension for money quantities (dimension [$]).
+ */
+ public static final Dimension DIMENSION = UNIT.getDimension();
+}
diff --git a/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/types/impl/BDate.java b/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/types/impl/BDate.java
index 50a0add..b7ec213 100644
--- a/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/types/impl/BDate.java
+++ b/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/types/impl/BDate.java
@@ -1,148 +1,148 @@
-package org.eclipse.uomo.business.types.impl;
-
-import static org.eclipse.uomo.business.types.impl.DataHelper.BDT_DELIM;
-
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-
-import org.eclipse.uomo.business.types.IBasicType;
-import org.eclipse.uomo.core.UOMoRuntimeException;
-
-/**
- * Define (non-Java.util) Date class
- *
- * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
- */
-public class BDate implements IBasicType {
- String m_date;
-
- /**
- * Constructor for date with no parameter - use current date in this locale
- * - dangerous!
- */
-
- public BDate() {
-
- Calendar cal = new GregorianCalendar();
-
- java.util.Date date = cal.getTime();
-
- TimeStamp ts = new TimeStamp(date.getTime());
- m_date = ts.serialize().substring(0, 8);
-
- }
-
- /**
- * Constructor for date with date string (yyyymmdd); optional calendar and
- * era are being ignored for now
- */
-
- public BDate(String s) {
- super();
- m_date = BuildDate(s);
- }
-
- /**
- * Constructor for jbdtypes Date using java.sql.Date
- */
-
- public BDate(java.sql.Date dt) {
- long millis = dt.getTime();
- TimeStamp ts = new TimeStamp(millis);
-
- m_date = BuildDate(ts.serialize().substring(0, 8));
- }
-
- /**
- * Return true if <code>this</code> date is after specified date
- *
- * @return boolean
- * @param d
- * com.jpmorrsn.jbdtypes.Date
- */
- public boolean after(BDate d) {
- return Integer.parseInt(this.m_date) > Integer.parseInt(d.m_date);
- }
-
- /**
- * Return true if <code>this</code> date is before specified date
- *
- * @return boolean
- * @param d
- * com.jpmorrsn.jbdtypes.Date
- */
- public boolean before(BDate d) {
- return Integer.parseInt(this.m_date) < Integer.parseInt(d.m_date);
- }
-
- /**
- * Strip off calendar and era (if any)
- *
- * @return java.lang.String
- * @param s
- * java.lang.String
- */
- static String BuildDate(String s) {
- int sp = s.indexOf(BDT_DELIM);
- if (sp == -1)
- return s;
- else
- return s.substring(0, sp);
- }
-
- /**
- * Build a TimeStamp using specified TimeTz object
- *
- * @return com.jpmorrsn.jbdtypes.TimeStamp
- * @param t
- * com.jpmorrsn.jbdtypes.TimeTz
- * @throws BDTypeException
- */
- public TimeStamp buildTimeStamp(TimeTz t) throws UOMoRuntimeException {
-
- return new TimeStamp(m_date + 'T' + t.serialize());
- }
-
- /**
- * Convert this Date to a java.sql.Date
- *
- * @return java.sql.Timestamp
- */
- public java.sql.Date convertToSQL() {
-
- TimeStamp ts = new TimeStamp(m_date + "T00:00");
- return new java.sql.Date(ts.getTime());
-
- }
-
- /**
- * Return true if <code>this</code> date is same as specified date
- *
- * @return boolean
- * @param d
- * com.jpmorrsn.jbdtypes.Date
- */
- public boolean equals(BDate d) {
- return Integer.parseInt(this.m_date) == Integer.parseInt(d.m_date);
- }
-
- /**
- * Display a (non-Java.util) jbdtypes Date object as an 8-byte string
- *
- * @return java.lang.String
- */
- public String serialize() {
-
- return m_date;
-
- }
-
- /**
- * Create a String from this object
- *
- * @return java.lang.String
- */
- public String toString() {
- return serialize();
- }
-}
+package org.eclipse.uomo.business.types.impl;
+
+import static org.eclipse.uomo.business.types.impl.DataHelper.BDT_DELIM;
+
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+
+import org.eclipse.uomo.business.types.IBasicType;
+import org.eclipse.uomo.core.UOMoRuntimeException;
+
+/**
+ * Define (non-Java.util) Date class
+ *
+ * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
+ */
+public class BDate implements IBasicType {
+ String m_date;
+
+ /**
+ * Constructor for date with no parameter - use current date in this locale
+ * - dangerous!
+ */
+
+ public BDate() {
+
+ Calendar cal = new GregorianCalendar();
+
+ java.util.Date date = cal.getTime();
+
+ TimeStamp ts = new TimeStamp(date.getTime());
+ m_date = ts.serialize().substring(0, 8);
+
+ }
+
+ /**
+ * Constructor for date with date string (yyyymmdd); optional calendar and
+ * era are being ignored for now
+ */
+
+ public BDate(String s) {
+ super();
+ m_date = BuildDate(s);
+ }
+
+ /**
+ * Constructor for jbdtypes Date using java.sql.Date
+ */
+
+ public BDate(java.sql.Date dt) {
+ long millis = dt.getTime();
+ TimeStamp ts = new TimeStamp(millis);
+
+ m_date = BuildDate(ts.serialize().substring(0, 8));
+ }
+
+ /**
+ * Return true if <code>this</code> date is after specified date
+ *
+ * @return boolean
+ * @param d
+ * com.jpmorrsn.jbdtypes.Date
+ */
+ public boolean after(BDate d) {
+ return Integer.parseInt(this.m_date) > Integer.parseInt(d.m_date);
+ }
+
+ /**
+ * Return true if <code>this</code> date is before specified date
+ *
+ * @return boolean
+ * @param d
+ * com.jpmorrsn.jbdtypes.Date
+ */
+ public boolean before(BDate d) {
+ return Integer.parseInt(this.m_date) < Integer.parseInt(d.m_date);
+ }
+
+ /**
+ * Strip off calendar and era (if any)
+ *
+ * @return java.lang.String
+ * @param s
+ * java.lang.String
+ */
+ static String BuildDate(String s) {
+ int sp = s.indexOf(BDT_DELIM);
+ if (sp == -1)
+ return s;
+ else
+ return s.substring(0, sp);
+ }
+
+ /**
+ * Build a TimeStamp using specified TimeTz object
+ *
+ * @return com.jpmorrsn.jbdtypes.TimeStamp
+ * @param t
+ * com.jpmorrsn.jbdtypes.TimeTz
+ * @throws BDTypeException
+ */
+ public TimeStamp buildTimeStamp(TimeTz t) throws UOMoRuntimeException {
+
+ return new TimeStamp(m_date + 'T' + t.serialize());
+ }
+
+ /**
+ * Convert this Date to a java.sql.Date
+ *
+ * @return java.sql.Timestamp
+ */
+ public java.sql.Date convertToSQL() {
+
+ TimeStamp ts = new TimeStamp(m_date + "T00:00");
+ return new java.sql.Date(ts.getTime());
+
+ }
+
+ /**
+ * Return true if <code>this</code> date is same as specified date
+ *
+ * @return boolean
+ * @param d
+ * com.jpmorrsn.jbdtypes.Date
+ */
+ public boolean equals(BDate d) {
+ return Integer.parseInt(this.m_date) == Integer.parseInt(d.m_date);
+ }
+
+ /**
+ * Display a (non-Java.util) jbdtypes Date object as an 8-byte string
+ *
+ * @return java.lang.String
+ */
+ public String serialize() {
+
+ return m_date;
+
+ }
+
+ /**
+ * Create a String from this object
+ *
+ * @return java.lang.String
+ */
+ public String toString() {
+ return serialize();
+ }
+}
diff --git a/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/types/impl/Market.java b/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/types/impl/Market.java
index 709cabc..969843e 100644
--- a/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/types/impl/Market.java
+++ b/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/types/impl/Market.java
@@ -1,323 +1,323 @@
-/**
- * Copyright (c) 2005, 2011, Werner Keil, Ikayzo and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Werner Keil - initial API and implementation
- */
-package org.eclipse.uomo.business.types.impl;
-
-import java.util.*;
-
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.uomo.business.internal.Messages;
-import org.eclipse.uomo.business.types.BDTHelper;
-import org.eclipse.uomo.business.types.BDTypeException;
-import org.eclipse.uomo.business.types.IMarket;
-import org.unitsofmeasurement.quantity.Time;
-import org.unitsofmeasurement.unit.Unit;
-
-import com.ibm.icu.util.Holiday;
-
-/**
- * Market object - object is mutable, but only the holiday table for a market
- * will be changed on a regular basis (plus the closed indicators); open and
- * close times will only be changed at BDT Load time.
- *
- * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
- * @version 0.4 ($Revision$), $Date$
- */
-public class Market {
- static class MarketImpl implements IMarket {
-
- /**
- * Returns true if market is open for specified FIType
- *
- * @return boolean
- */
- String m_name;
- String m_symbol;
- String m_code = null; // this must be the Reuters code
-
- String m_timeZone = null; // alpha TimeZone ID - can be used by
- // TimeStamp methods)
- String m_openTime = "09:30"; // default values //$NON-NLS-1$
- String m_closeTime = "16:00"; // same //$NON-NLS-1$
- String m_countryCode = null;
- String m_quoteCurrency = null;
- Map<String, List<Time>> m_times = null; // HashMap of open and close times
- // - key is fiType
-
- Map<Date, Holiday> m_holidays = null; // list of holidays - keyed on date
- Map<Date, Holiday> m_replHolidays = new HashMap<Date, Holiday>(); // used to build new holiday
- // list
- // TODO introdude ICU4J Holiday type and related framework
-
- /**
- * Returns true if market is open right now for specified FIType
- *
- * @return boolean
- */
-
- public boolean isOpen(String fiType) {
-
- // TimeStamp ts = new TimeStamp(); // set timestamp to right now!
- // return isOpen(ts, fiType);
-
- return false;
-
- }
-
- /**
- * Returns true if market is open at specified time and for specified
- * FIType
- *
- * @return boolean
- */
-
- public boolean isOpen(Unit<Time> ts, String fiType) {
-
- if (m_code.equals("M")) { //$NON-NLS-1$
- System.err
- .println("Montreal Exchange forced closed for testing!"); //$NON-NLS-1$
- System.err.println("Remember to correct code later!"); //$NON-NLS-1$
- return false;
- }
-
- String open = m_openTime;
- String close = m_closeTime;
- boolean closeInd = false;
- if (m_times != null) {
- List list = (List) m_times.get(fiType);
- closeInd = list.get(0).equals("1"); //$NON-NLS-1$
- open = (String) list.get(1);
- close = (String) list.get(2);
- }
-
- if (closeInd)
- return false;
-
- // try {String nowInTZ = ts.formatWithZone(m_timeZone); // now in
- // market time zone
- //
- // TimeZone tz = TimeTz.GetTimeZone(m_timeZone); // get from
- // BDTHelper table
- // String date = nowInTZ.substring(0,8);
- //
- // Calendar cal = new GregorianCalendar(tz); // needed to obtain day
- // of week
- // cal.setTime(ts);
- // int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
- // HashMap hm = getHolidays();
- // if (dayOfWeek == Calendar.SATURDAY || dayOfWeek ==
- // Calendar.SUNDAY ||
- // hm != null && null != hm.get(date)) // or is date in list of
- // holidays?
- // return false;
- //
- //
- // TimeStamp tsStart = new TimeStamp(date + 'T' + open + '!' +
- // m_timeZone);
- // TimeStamp tsEnd = new TimeStamp(date + 'T' + close + '!' +
- // m_timeZone);
- //
- // if (ts.before(tsStart) || ts.after(tsEnd))
- // return false;
- //
- // }
- // catch (BDTypeException ex) {
- // System.err.println("Date error: " + ex);
- // }
- //
- return true;
-
- }
-
- /**
- * Returns true if market is open for specified Date and FI Type
- * (partial dates will be treated as not open); times will not be
- * checked at all
- *
- * @return boolean
- */
- public boolean isOpen(Date date, String fiType) {
-
- if (m_code.equals("M")) { //$NON-NLS-1$
- System.err
- .println("Montreal Exchange forced closed for testing!"); //$NON-NLS-1$
- System.err.println("Remember to correct code later!"); //$NON-NLS-1$
- return false;
- }
-
- boolean closeInd = false;
- if (m_times != null) {
- List list = (List) m_times.get(fiType);
- closeInd = list.get(0).equals("1"); //$NON-NLS-1$
- }
-
- if (closeInd)
- return false;
-
- // try {TimeStamp timeWithinDate = new TimeStamp(date + "T12:00!" +
- // m_timeZone);
- //
- // TimeZone tz = TimeTz.GetTimeZone(m_timeZone); // get from
- // BDTHelper table
- // Calendar cal = new GregorianCalendar(tz); // needed to obtain day
- // of week
- // cal.setTime(timeWithinDate);
- // int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
- // HashMap hm = getHolidays();
- // if (dayOfWeek == Calendar.SATURDAY || dayOfWeek ==
- // Calendar.SUNDAY ||
- // hm != null && null != hm.get(date)) // or is date in list of
- // holidays?
- // return false;
- //
- //
- // }
- // catch (BDTypeException ex) {
- // System.err.println("Date error: " + ex);
- // }
-
- return true;
-
- }
-
- /**
- * Get HashMap of open/close times
- */
-
- public Map<String, List<Time>> getTimes() {
- return m_times;
- }
-
- /**
- * Set HashMap with open/close times
- */
-
- public void setTimes(HashMap<String, List<Time>> hm) {
- m_times = hm;
- }
-
- /**
- * Insert the method's description here. Creation date: (9/20/00 2:49:20
- * PM)
- *
- * @return java.lang.String
- */
- public String serialize() {
-
- String str = m_code + ';' + m_timeZone + ';' + m_countryCode + ';'
- + m_quoteCurrency + ';' + '{';
- Iterator iter = m_times.keySet().iterator();
- boolean first = true;
- while (iter.hasNext()) {
- if (!first)
- str = str + ';';
- first = false;
- String key = (String) iter.next();
- List vec = (List) m_times.get(key);
- str = str
- + key
- + "={" + vec.get(0) + ';' + vec.get(1) + ';' + vec.get(2) + '}'; //$NON-NLS-1$
- }
- str = str + "}{"; //$NON-NLS-1$
-
- iter = m_holidays.keySet().iterator();
- first = true;
- while (iter.hasNext()) {
- if (!first)
- str = str + ';';
- first = false;
- Date d = (Date) iter.next();
- str = str + d.toString();
- }
- str = str + '}';
- return str;
-
- }
-
- MarketImpl(String s1, String s2, String s3, String s4) {
- m_code = s1;
- m_timeZone = s2;
- m_countryCode = s3;
- m_quoteCurrency = s4;
- }
-
- public String getTimeZone() {
- return m_timeZone;
- }
-
- public synchronized Map<Date, Holiday> getHolidays() {
- return m_holidays;
- }
-
- public synchronized void setHolidays(Map<Date, Holiday> hm) {
- m_holidays = hm;
- }
-
- public Map<Date, Holiday> getReplHolidays() {
- return m_replHolidays;
- }
-
- public void setReplHolidays(Map<Date, Holiday> hm) {
- m_replHolidays = hm;
- }
-
- public void setTimes(Map<String, List<Time>> hm) {
- m_times = hm;
- }
-
- public String getName() {
- return m_name;
- }
-
- public String getSymbol() {
- return m_symbol;
- }
-
- }
-
- /**
- * Insert the method's description here. Creation date: (9/22/00 4:09:05 PM)
- *
- * @return com.jpmorrsn.jbdtypes.IMarket
- * @param s1
- * java.lang.String
- * @param s2
- * java.lang.String
- * @param s3
- * java.lang.String
- * @param s4
- * java.lang.String
- */
- static IMarket createMarket(String s1, String s2, String s3, String s4) {
- return new MarketImpl(s1, s2, s3, s4);
- }
-
- /**
- * Return an IMarket object given the name - return null if string empty
- *
- * @return org.eclipse.uomo.business.types.IMarket
- * @param s
- * java.lang.String
- */
- public static IMarket get(String s) throws BDTypeException {
-
- if (s.equals("")) //$NON-NLS-1$
- return null;
- else {
- IMarket mkt = BDTHelper.getMarkets().get(s);
- if (mkt == null) {
- // System.err.println("Invalid market code: " + s);
- throw new BDTypeException(NLS.bind(
- Messages.Market_invalid_code, s)); //$NON-NLS-1$
- }
- return mkt;
- }
- }
-}
+/**
+ * Copyright (c) 2005, 2011, Werner Keil, Ikayzo and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Werner Keil - initial API and implementation
+ */
+package org.eclipse.uomo.business.types.impl;
+
+import java.util.*;
+
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.uomo.business.internal.Messages;
+import org.eclipse.uomo.business.types.BDTHelper;
+import org.eclipse.uomo.business.types.BDTypeException;
+import org.eclipse.uomo.business.types.IMarket;
+import org.unitsofmeasurement.quantity.Time;
+import org.unitsofmeasurement.unit.Unit;
+
+import com.ibm.icu.util.Holiday;
+
+/**
+ * Market object - object is mutable, but only the holiday table for a market
+ * will be changed on a regular basis (plus the closed indicators); open and
+ * close times will only be changed at BDT Load time.
+ *
+ * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
+ * @version 0.4 ($Revision$), $Date$
+ */
+public class Market {
+ static class MarketImpl implements IMarket {
+
+ /**
+ * Returns true if market is open for specified FIType
+ *
+ * @return boolean
+ */
+ String m_name;
+ String m_symbol;
+ String m_code = null; // this must be the Reuters code
+
+ String m_timeZone = null; // alpha TimeZone ID - can be used by
+ // TimeStamp methods)
+ String m_openTime = "09:30"; // default values //$NON-NLS-1$
+ String m_closeTime = "16:00"; // same //$NON-NLS-1$
+ String m_countryCode = null;
+ String m_quoteCurrency = null;
+ Map<String, List<Time>> m_times = null; // HashMap of open and close times
+ // - key is fiType
+
+ Map<Date, Holiday> m_holidays = null; // list of holidays - keyed on date
+ Map<Date, Holiday> m_replHolidays = new HashMap<Date, Holiday>(); // used to build new holiday
+ // list
+ // TODO introdude ICU4J Holiday type and related framework
+
+ /**
+ * Returns true if market is open right now for specified FIType
+ *
+ * @return boolean
+ */
+
+ public boolean isOpen(String fiType) {
+
+ // TimeStamp ts = new TimeStamp(); // set timestamp to right now!
+ // return isOpen(ts, fiType);
+
+ return false;
+
+ }
+
+ /**
+ * Returns true if market is open at specified time and for specified
+ * FIType
+ *
+ * @return boolean
+ */
+
+ public boolean isOpen(Unit<Time> ts, String fiType) {
+
+ if (m_code.equals("M")) { //$NON-NLS-1$
+ System.err
+ .println("Montreal Exchange forced closed for testing!"); //$NON-NLS-1$
+ System.err.println("Remember to correct code later!"); //$NON-NLS-1$
+ return false;
+ }
+
+ String open = m_openTime;
+ String close = m_closeTime;
+ boolean closeInd = false;
+ if (m_times != null) {
+ List list = (List) m_times.get(fiType);
+ closeInd = list.get(0).equals("1"); //$NON-NLS-1$
+ open = (String) list.get(1);
+ close = (String) list.get(2);
+ }
+
+ if (closeInd)
+ return false;
+
+ // try {String nowInTZ = ts.formatWithZone(m_timeZone); // now in
+ // market time zone
+ //
+ // TimeZone tz = TimeTz.GetTimeZone(m_timeZone); // get from
+ // BDTHelper table
+ // String date = nowInTZ.substring(0,8);
+ //
+ // Calendar cal = new GregorianCalendar(tz); // needed to obtain day
+ // of week
+ // cal.setTime(ts);
+ // int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
+ // HashMap hm = getHolidays();
+ // if (dayOfWeek == Calendar.SATURDAY || dayOfWeek ==
+ // Calendar.SUNDAY ||
+ // hm != null && null != hm.get(date)) // or is date in list of
+ // holidays?
+ // return false;
+ //
+ //
+ // TimeStamp tsStart = new TimeStamp(date + 'T' + open + '!' +
+ // m_timeZone);
+ // TimeStamp tsEnd = new TimeStamp(date + 'T' + close + '!' +
+ // m_timeZone);
+ //
+ // if (ts.before(tsStart) || ts.after(tsEnd))
+ // return false;
+ //
+ // }
+ // catch (BDTypeException ex) {
+ // System.err.println("Date error: " + ex);
+ // }
+ //
+ return true;
+
+ }
+
+ /**
+ * Returns true if market is open for specified Date and FI Type
+ * (partial dates will be treated as not open); times will not be
+ * checked at all
+ *
+ * @return boolean
+ */
+ public boolean isOpen(Date date, String fiType) {
+
+ if (m_code.equals("M")) { //$NON-NLS-1$
+ System.err
+ .println("Montreal Exchange forced closed for testing!"); //$NON-NLS-1$
+ System.err.println("Remember to correct code later!"); //$NON-NLS-1$
+ return false;
+ }
+
+ boolean closeInd = false;
+ if (m_times != null) {
+ List list = (List) m_times.get(fiType);
+ closeInd = list.get(0).equals("1"); //$NON-NLS-1$
+ }
+
+ if (closeInd)
+ return false;
+
+ // try {TimeStamp timeWithinDate = new TimeStamp(date + "T12:00!" +
+ // m_timeZone);
+ //
+ // TimeZone tz = TimeTz.GetTimeZone(m_timeZone); // get from
+ // BDTHelper table
+ // Calendar cal = new GregorianCalendar(tz); // needed to obtain day
+ // of week
+ // cal.setTime(timeWithinDate);
+ // int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
+ // HashMap hm = getHolidays();
+ // if (dayOfWeek == Calendar.SATURDAY || dayOfWeek ==
+ // Calendar.SUNDAY ||
+ // hm != null && null != hm.get(date)) // or is date in list of
+ // holidays?
+ // return false;
+ //
+ //
+ // }
+ // catch (BDTypeException ex) {
+ // System.err.println("Date error: " + ex);
+ // }
+
+ return true;
+
+ }
+
+ /**
+ * Get HashMap of open/close times
+ */
+
+ public Map<String, List<Time>> getTimes() {
+ return m_times;
+ }
+
+ /**
+ * Set HashMap with open/close times
+ */
+
+ public void setTimes(HashMap<String, List<Time>> hm) {
+ m_times = hm;
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (9/20/00 2:49:20
+ * PM)
+ *
+ * @return java.lang.String
+ */
+ public String serialize() {
+
+ String str = m_code + ';' + m_timeZone + ';' + m_countryCode + ';'
+ + m_quoteCurrency + ';' + '{';
+ Iterator iter = m_times.keySet().iterator();
+ boolean first = true;
+ while (iter.hasNext()) {
+ if (!first)
+ str = str + ';';
+ first = false;
+ String key = (String) iter.next();
+ List vec = (List) m_times.get(key);
+ str = str
+ + key
+ + "={" + vec.get(0) + ';' + vec.get(1) + ';' + vec.get(2) + '}'; //$NON-NLS-1$
+ }
+ str = str + "}{"; //$NON-NLS-1$
+
+ iter = m_holidays.keySet().iterator();
+ first = true;
+ while (iter.hasNext()) {
+ if (!first)
+ str = str + ';';
+ first = false;
+ Date d = (Date) iter.next();
+ str = str + d.toString();
+ }
+ str = str + '}';
+ return str;
+
+ }
+
+ MarketImpl(String s1, String s2, String s3, String s4) {
+ m_code = s1;
+ m_timeZone = s2;
+ m_countryCode = s3;
+ m_quoteCurrency = s4;
+ }
+
+ public String getTimeZone() {
+ return m_timeZone;
+ }
+
+ public synchronized Map<Date, Holiday> getHolidays() {
+ return m_holidays;
+ }
+
+ public synchronized void setHolidays(Map<Date, Holiday> hm) {
+ m_holidays = hm;
+ }
+
+ public Map<Date, Holiday> getReplHolidays() {
+ return m_replHolidays;
+ }
+
+ public void setReplHolidays(Map<Date, Holiday> hm) {
+ m_replHolidays = hm;
+ }
+
+ public void setTimes(Map<String, List<Time>> hm) {
+ m_times = hm;
+ }
+
+ public String getName() {
+ return m_name;
+ }
+
+ public String getSymbol() {
+ return m_symbol;
+ }
+
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (9/22/00 4:09:05 PM)
+ *
+ * @return com.jpmorrsn.jbdtypes.IMarket
+ * @param s1
+ * java.lang.String
+ * @param s2
+ * java.lang.String
+ * @param s3
+ * java.lang.String
+ * @param s4
+ * java.lang.String
+ */
+ static IMarket createMarket(String s1, String s2, String s3, String s4) {
+ return new MarketImpl(s1, s2, s3, s4);
+ }
+
+ /**
+ * Return an IMarket object given the name - return null if string empty
+ *
+ * @return org.eclipse.uomo.business.types.IMarket
+ * @param s
+ * java.lang.String
+ */
+ public static IMarket get(String s) throws BDTypeException {
+
+ if (s.equals("")) //$NON-NLS-1$
+ return null;
+ else {
+ IMarket mkt = BDTHelper.getMarkets().get(s);
+ if (mkt == null) {
+ // System.err.println("Invalid market code: " + s);
+ throw new BDTypeException(NLS.bind(
+ Messages.Market_invalid_code, s)); //$NON-NLS-1$
+ }
+ return mkt;
+ }
+ }
+}
diff --git a/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/types/impl/TimeStamp.java b/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/types/impl/TimeStamp.java
index 7d0f887..1623160 100644
--- a/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/types/impl/TimeStamp.java
+++ b/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/types/impl/TimeStamp.java
@@ -1,318 +1,318 @@
-/**
- * Copyright (c) 2005, 2011, Werner Keil, Ikayzo and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Werner Keil - initial API and implementation
- */
-package org.eclipse.uomo.business.types.impl;
-
-import static org.eclipse.uomo.business.types.impl.DataHelper.BDT_DELIM;
-
-import java.text.SimpleDateFormat;
-import java.text.ParsePosition;
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-import java.util.TimeZone;
-import java.sql.Timestamp;
-
-import org.eclipse.uomo.business.types.IBasicType;
-import org.eclipse.uomo.core.UOMoRuntimeException;
-
-/**
- * Timestamp extends java.util.Date, which goes down to the millisecond
- *
- * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
- */
-public class TimeStamp extends java.util.Date implements IBasicType {
- final static long serialVersionUID = 362498820763181265L;
-
- /**
- * TimeStamp constructor - sets a TimeStamp to the current time
- */
- public TimeStamp() {
- super((TimeStamp.BuildTimeStamp()).getTime());
-
- }
-
- /**
- * TimeStamp constructor with millisecs (long)
- */
- public TimeStamp(long m) {
- super(m);
-
- }
-
- /**
- * TimeStamp constructor with String. buildTimeStamp returns a TimeStamp
- * object, which can't be used directly, so we use getTime
- *
- * @throws UOMoRuntimeException
- */
- public TimeStamp(String s) throws UOMoRuntimeException {
- super((TimeStamp.BuildTimeStamp(s)).getTime());
- }
-
- /**
- * TimeStamp constructor with a java.sql.Timestamp buildTimeStamp returns a
- * TimeStamp object, which can't be used directly, so we use
- * getTime
- *
- * @throws UOMoRuntimeException
- */
- public TimeStamp(Timestamp ts) throws UOMoRuntimeException {
- super((TimeStamp.BuildTimeStamp(ts)).getTime());
- }
-
- /**
- * Create a TimeStamp object using current time
- *
- * @return TimeStamp
- */
- static TimeStamp BuildTimeStamp() {
-
- Calendar aGregCal = new GregorianCalendar();
-
- java.util.Date date = aGregCal.getTime();
- return new TimeStamp(date.getTime());
- }
-
- /**
- * Create an (non-Java.util) TimeStamp using a String. This has format
- * ccyymmddThh:mm:ssttt!zone;calendar;era where zone is an alpha time zone
- * name known to UOMo; calendar and era are optional. The time from :ss
- * is also optional. Instead of !zone, you may instead use Ahh:mm, where A
- * is + or -; in this case, no daylight savings time logic is available. If
- * adjustment and time zone are both missing, treat as 0, i.e. time is UTC
- * If an adjustment is present, the sign is as normally used to identify the
- * time zone - i.e. the offset needed to convert UTC to local time, even
- * though the first part is local time. This means that, to compute the UTC,
- * the sign must be reversed - i.e. local time 08:00 am in the EDT zone will
- * be represented as 08:00-04:00, so that UTC is computed by adding the two
- * values together. Calendar and era will be ignored for now.
- *
- * @return TimeStamp
- * @param s
- * java.lang.String
- * @throws UOMoRuntimeException
- */
- static TimeStamp BuildTimeStamp(String s) throws UOMoRuntimeException {
- String str;
- int sp = s.indexOf(BDT_DELIM); // strip off calendar and/or era
- if (sp == -1)
- str = s;
- else
- str = s.substring(0, sp);
-
- String adj = null;
- TimeZone tz = null;
-
- sp = str.indexOf('!');
-
- if (sp > -1) {
- String zoneString = str.substring(sp + 1);
- tz = TimeTz.GetTimeZone(zoneString);
- if (tz == null)
- throw new UOMoRuntimeException("Time Zone not found: "
- + zoneString);
- str = str.substring(0, sp);
- }
-
- else {
- sp = str.indexOf('+');
- if (sp == -1)
- sp = str.indexOf('-');
- if (sp > -1) {
- adj = str.substring(sp);
- str = str.substring(0, sp);
- }
- }
-
- if (str.length() < 14)
- throw new UOMoRuntimeException("Timestamp too short: " + s);
-
- if (str.charAt(8) != 'T' || str.charAt(11) != ':')
- throw new UOMoRuntimeException("Invalid TimeStamp: " + s);
-
- String secs = "00000";
-
- if (str.length() > 14) {
- if (str.charAt(14) != ':')
- throw new UOMoRuntimeException("Invalid TimeStamp: " + s);
- if (str.length() != 17 && str.length() != 20)
- throw new UOMoRuntimeException("Invalid TimeStamp: " + s);
- secs = str.substring(15) + secs;
- secs = secs.substring(0, 5);
- }
- TimeZone zone = TimeZone.getTimeZone("UTC");
-
- SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHH:mmssSSS");
- formatter.setTimeZone(zone);
-
- String dateString = str.substring(0, 8) + str.substring(9, 14) + secs;
-
- ParsePosition pos = new ParsePosition(0);
- java.util.Date date = formatter.parse(dateString, pos);
- TimeStamp ts = new TimeStamp(date.getTime());
-
- long millis = 0;
-
- if (tz != null) {
- millis = ts.getTime();
- millis -= tz.getRawOffset();
- ts.setTime(millis);
- if (tz.inDaylightTime(ts))
- millis -= 3600000;
- ts.setTime(millis);
- }
-
- if (adj != null) {
- int hrs;
- int mins = 0;
-
- if (adj.length() == 3)
- hrs = Integer.parseInt(adj.substring(1));
- else {
- if (adj.charAt(3) != ':' || adj.length() != 6)
- throw new UOMoRuntimeException(
- "Invalid TimeStamp adjustment: " + s);
- hrs = Integer.parseInt(adj.substring(1, 3));
- mins = Integer.parseInt(adj.substring(4, 6));
- }
-
- if (adj.charAt(0) == '+') {
- hrs = -hrs;
- mins = -mins;
- } else if (adj.charAt(0) != '-')
- throw new UOMoRuntimeException(
- "Invalid TimeStamp adjustment sign: " + s);
-
- millis = ts.getTime();
-
- millis += (3600 * hrs + 60 * mins) * 1000;
-
- ts.setTime(millis);
- }
-
- return ts;
- }
-
- /**
- * Create an TimeStamp using a java.sql.Timestamp. This differs
- * from an UOMo TimeStamp in that it goes down to the nanosecond. We
- * will therefore lose fractional milliseconds.
- *
- * @return TimeStamp
- * @param ts
- * java.sql.Timestamp
- * @throws UOMoRuntimeException
- */
- static TimeStamp BuildTimeStamp(java.sql.Timestamp ts)
- throws UOMoRuntimeException {
- long millis = ts.getTime(); // gets integral number of seconds
- millis += ts.getNanos() / 1000000;
- return new TimeStamp(millis);
- }
-
- /**
- * Convert this TimeStamp to a java.sql.Timestamp
- *
- * @return java.sql.Timestamp
- */
- public Timestamp convertToSQL() {
-
- long millis = getTime() % 1000;
- java.sql.Timestamp ts = new Timestamp(this.getTime() - millis);
- ts.setNanos((new Long(millis * 1000000)).intValue());
- return ts;
-
- }
-
- /**
- * Format a (non-Java.util) TimeStamp object with specified alpha zone or
- * numeric (+/-) zone
- *
- * @return java.lang.String
- * @throws UOMoRuntimeException
- */
- public String formatWithZone(String s) throws UOMoRuntimeException {
-
- SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHH:mm:ssSSS");
- TimeZone zone = TimeZone.getTimeZone("UTC");
-
- formatter.setTimeZone(zone);
-
- long millis = getTime();
-
- TimeStamp ts = new TimeStamp(millis);
-
- String z = s;
-
- if (s.charAt(0) == '+' || s.charAt(0) == '-') {
- int hrs;
- int mins = 0;
-
- if (s.length() == 3)
- hrs = Integer.parseInt(s.substring(1));
- else {
- if (s.charAt(3) != ':' || s.length() != 6)
- throw new UOMoRuntimeException(
- "Invalid TimeStamp adjustment: " + s);
- hrs = Integer.parseInt(s.substring(1, 3));
- mins = Integer.parseInt(s.substring(4, 6));
- }
-
- if (s.charAt(0) == '-') {
- hrs = -hrs;
- mins = -mins;
- }
- millis += (hrs * 3600 + mins * 60) * 1000;
- ts.setTime(millis);
- } else {
- TimeZone tz = TimeTz.GetTimeZone(s);
- if (tz == null)
- throw new UOMoRuntimeException("Time Zone not found: " + s);
- millis += tz.getRawOffset();
- ts.setTime(millis);
- if (tz.inDaylightTime(ts))
- ts.setTime(millis + 3600000);
- z = '!' + s;
- }
-
- String str = formatter.format(ts);
- str = str.substring(0, 8) + 'T' + str.substring(8) + z;
-
- return str;
-
- }
-
- /**
- * Display a (non-Java.util) TimeStamp object as a 26-byte string
- *
- * @return java.lang.String
- */
- public String serialize() {
-
- SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHH:mm:ssSSS");
- TimeZone zone = TimeZone.getTimeZone("UTC");
-
- formatter.setTimeZone(zone);
-
- String str = formatter.format(this);
- str = str.substring(0, 8) + 'T' + str.substring(8) + "+00:00";
- return str;
-
- }
-
- /**
- * Create a String from this object
- *
- * @return java.lang.String
- */
- public String toString() {
- return serialize();
- }
-}
+/**
+ * Copyright (c) 2005, 2011, Werner Keil, Ikayzo and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Werner Keil - initial API and implementation
+ */
+package org.eclipse.uomo.business.types.impl;
+
+import static org.eclipse.uomo.business.types.impl.DataHelper.BDT_DELIM;
+
+import java.text.SimpleDateFormat;
+import java.text.ParsePosition;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import java.util.TimeZone;
+import java.sql.Timestamp;
+
+import org.eclipse.uomo.business.types.IBasicType;
+import org.eclipse.uomo.core.UOMoRuntimeException;
+
+/**
+ * Timestamp extends java.util.Date, which goes down to the millisecond
+ *
+ * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
+ */
+public class TimeStamp extends java.util.Date implements IBasicType {
+ final static long serialVersionUID = 362498820763181265L;
+
+ /**
+ * TimeStamp constructor - sets a TimeStamp to the current time
+ */
+ public TimeStamp() {
+ super((TimeStamp.BuildTimeStamp()).getTime());
+
+ }
+
+ /**
+ * TimeStamp constructor with millisecs (long)
+ */
+ public TimeStamp(long m) {
+ super(m);
+
+ }
+
+ /**
+ * TimeStamp constructor with String. buildTimeStamp returns a TimeStamp
+ * object, which can't be used directly, so we use getTime
+ *
+ * @throws UOMoRuntimeException
+ */
+ public TimeStamp(String s) throws UOMoRuntimeException {
+ super((TimeStamp.BuildTimeStamp(s)).getTime());
+ }
+
+ /**
+ * TimeStamp constructor with a java.sql.Timestamp buildTimeStamp returns a
+ * TimeStamp object, which can't be used directly, so we use
+ * getTime
+ *
+ * @throws UOMoRuntimeException
+ */
+ public TimeStamp(Timestamp ts) throws UOMoRuntimeException {
+ super((TimeStamp.BuildTimeStamp(ts)).getTime());
+ }
+
+ /**
+ * Create a TimeStamp object using current time
+ *
+ * @return TimeStamp
+ */
+ static TimeStamp BuildTimeStamp() {
+
+ Calendar aGregCal = new GregorianCalendar();
+
+ java.util.Date date = aGregCal.getTime();
+ return new TimeStamp(date.getTime());
+ }
+
+ /**
+ * Create an (non-Java.util) TimeStamp using a String. This has format
+ * ccyymmddThh:mm:ssttt!zone;calendar;era where zone is an alpha time zone
+ * name known to UOMo; calendar and era are optional. The time from :ss
+ * is also optional. Instead of !zone, you may instead use Ahh:mm, where A
+ * is + or -; in this case, no daylight savings time logic is available. If
+ * adjustment and time zone are both missing, treat as 0, i.e. time is UTC
+ * If an adjustment is present, the sign is as normally used to identify the
+ * time zone - i.e. the offset needed to convert UTC to local time, even
+ * though the first part is local time. This means that, to compute the UTC,
+ * the sign must be reversed - i.e. local time 08:00 am in the EDT zone will
+ * be represented as 08:00-04:00, so that UTC is computed by adding the two
+ * values together. Calendar and era will be ignored for now.
+ *
+ * @return TimeStamp
+ * @param s
+ * java.lang.String
+ * @throws UOMoRuntimeException
+ */
+ static TimeStamp BuildTimeStamp(String s) throws UOMoRuntimeException {
+ String str;
+ int sp = s.indexOf(BDT_DELIM); // strip off calendar and/or era
+ if (sp == -1)
+ str = s;
+ else
+ str = s.substring(0, sp);
+
+ String adj = null;
+ TimeZone tz = null;
+
+ sp = str.indexOf('!');
+
+ if (sp > -1) {
+ String zoneString = str.substring(sp + 1);
+ tz = TimeTz.GetTimeZone(zoneString);
+ if (tz == null)
+ throw new UOMoRuntimeException("Time Zone not found: "
+ + zoneString);
+ str = str.substring(0, sp);
+ }
+
+ else {
+ sp = str.indexOf('+');
+ if (sp == -1)
+ sp = str.indexOf('-');
+ if (sp > -1) {
+ adj = str.substring(sp);
+ str = str.substring(0, sp);
+ }
+ }
+
+ if (str.length() < 14)
+ throw new UOMoRuntimeException("Timestamp too short: " + s);
+
+ if (str.charAt(8) != 'T' || str.charAt(11) != ':')
+ throw new UOMoRuntimeException("Invalid TimeStamp: " + s);
+
+ String secs = "00000";
+
+ if (str.length() > 14) {
+ if (str.charAt(14) != ':')
+ throw new UOMoRuntimeException("Invalid TimeStamp: " + s);
+ if (str.length() != 17 && str.length() != 20)
+ throw new UOMoRuntimeException("Invalid TimeStamp: " + s);
+ secs = str.substring(15) + secs;
+ secs = secs.substring(0, 5);
+ }
+ TimeZone zone = TimeZone.getTimeZone("UTC");
+
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHH:mmssSSS");
+ formatter.setTimeZone(zone);
+
+ String dateString = str.substring(0, 8) + str.substring(9, 14) + secs;
+
+ ParsePosition pos = new ParsePosition(0);
+ java.util.Date date = formatter.parse(dateString, pos);
+ TimeStamp ts = new TimeStamp(date.getTime());
+
+ long millis = 0;
+
+ if (tz != null) {
+ millis = ts.getTime();
+ millis -= tz.getRawOffset();
+ ts.setTime(millis);
+ if (tz.inDaylightTime(ts))
+ millis -= 3600000;
+ ts.setTime(millis);
+ }
+
+ if (adj != null) {
+ int hrs;
+ int mins = 0;
+
+ if (adj.length() == 3)
+ hrs = Integer.parseInt(adj.substring(1));
+ else {
+ if (adj.charAt(3) != ':' || adj.length() != 6)
+ throw new UOMoRuntimeException(
+ "Invalid TimeStamp adjustment: " + s);
+ hrs = Integer.parseInt(adj.substring(1, 3));
+ mins = Integer.parseInt(adj.substring(4, 6));
+ }
+
+ if (adj.charAt(0) == '+') {
+ hrs = -hrs;
+ mins = -mins;
+ } else if (adj.charAt(0) != '-')
+ throw new UOMoRuntimeException(
+ "Invalid TimeStamp adjustment sign: " + s);
+
+ millis = ts.getTime();
+
+ millis += (3600 * hrs + 60 * mins) * 1000;
+
+ ts.setTime(millis);
+ }
+
+ return ts;
+ }
+
+ /**
+ * Create an TimeStamp using a java.sql.Timestamp. This differs
+ * from an UOMo TimeStamp in that it goes down to the nanosecond. We
+ * will therefore lose fractional milliseconds.
+ *
+ * @return TimeStamp
+ * @param ts
+ * java.sql.Timestamp
+ * @throws UOMoRuntimeException
+ */
+ static TimeStamp BuildTimeStamp(java.sql.Timestamp ts)
+ throws UOMoRuntimeException {
+ long millis = ts.getTime(); // gets integral number of seconds
+ millis += ts.getNanos() / 1000000;
+ return new TimeStamp(millis);
+ }
+
+ /**
+ * Convert this TimeStamp to a java.sql.Timestamp
+ *
+ * @return java.sql.Timestamp
+ */
+ public Timestamp convertToSQL() {
+
+ long millis = getTime() % 1000;
+ java.sql.Timestamp ts = new Timestamp(this.getTime() - millis);
+ ts.setNanos((new Long(millis * 1000000)).intValue());
+ return ts;
+
+ }
+
+ /**
+ * Format a (non-Java.util) TimeStamp object with specified alpha zone or
+ * numeric (+/-) zone
+ *
+ * @return java.lang.String
+ * @throws UOMoRuntimeException
+ */
+ public String formatWithZone(String s) throws UOMoRuntimeException {
+
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHH:mm:ssSSS");
+ TimeZone zone = TimeZone.getTimeZone("UTC");
+
+ formatter.setTimeZone(zone);
+
+ long millis = getTime();
+
+ TimeStamp ts = new TimeStamp(millis);
+
+ String z = s;
+
+ if (s.charAt(0) == '+' || s.charAt(0) == '-') {
+ int hrs;
+ int mins = 0;
+
+ if (s.length() == 3)
+ hrs = Integer.parseInt(s.substring(1));
+ else {
+ if (s.charAt(3) != ':' || s.length() != 6)
+ throw new UOMoRuntimeException(
+ "Invalid TimeStamp adjustment: " + s);
+ hrs = Integer.parseInt(s.substring(1, 3));
+ mins = Integer.parseInt(s.substring(4, 6));
+ }
+
+ if (s.charAt(0) == '-') {
+ hrs = -hrs;
+ mins = -mins;
+ }
+ millis += (hrs * 3600 + mins * 60) * 1000;
+ ts.setTime(millis);
+ } else {
+ TimeZone tz = TimeTz.GetTimeZone(s);
+ if (tz == null)
+ throw new UOMoRuntimeException("Time Zone not found: " + s);
+ millis += tz.getRawOffset();
+ ts.setTime(millis);
+ if (tz.inDaylightTime(ts))
+ ts.setTime(millis + 3600000);
+ z = '!' + s;
+ }
+
+ String str = formatter.format(ts);
+ str = str.substring(0, 8) + 'T' + str.substring(8) + z;
+
+ return str;
+
+ }
+
+ /**
+ * Display a (non-Java.util) TimeStamp object as a 26-byte string
+ *
+ * @return java.lang.String
+ */
+ public String serialize() {
+
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHH:mm:ssSSS");
+ TimeZone zone = TimeZone.getTimeZone("UTC");
+
+ formatter.setTimeZone(zone);
+
+ String str = formatter.format(this);
+ str = str.substring(0, 8) + 'T' + str.substring(8) + "+00:00";
+ return str;
+
+ }
+
+ /**
+ * Create a String from this object
+ *
+ * @return java.lang.String
+ */
+ public String toString() {
+ return serialize();
+ }
+}
diff --git a/bundles/org.eclipse.uomo.core.tests/.classpath b/bundles/org.eclipse.uomo.core.tests/.classpath
index 0b1bcf9..9bc33d3 100644
--- a/bundles/org.eclipse.uomo.core.tests/.classpath
+++ b/bundles/org.eclipse.uomo.core.tests/.classpath
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src/"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src/"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/bundles/org.eclipse.uomo.core.tests/.gitignore b/bundles/org.eclipse.uomo.core.tests/.gitignore
index ea8c4bf..0b42d2d 100644
--- a/bundles/org.eclipse.uomo.core.tests/.gitignore
+++ b/bundles/org.eclipse.uomo.core.tests/.gitignore
@@ -1 +1 @@
-/target
+/target
diff --git a/bundles/org.eclipse.uomo.core.tests/.project b/bundles/org.eclipse.uomo.core.tests/.project
index 9ad70dd..9702ecc 100644
--- a/bundles/org.eclipse.uomo.core.tests/.project
+++ b/bundles/org.eclipse.uomo.core.tests/.project
@@ -1,34 +1,34 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.uomo.core.tests</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.m2e.core.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.m2e.core.maven2Nature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.uomo.core.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.uomo.core.tests/.settings/.gitignore b/bundles/org.eclipse.uomo.core.tests/.settings/.gitignore
index 0924da4..c14d360 100644
--- a/bundles/org.eclipse.uomo.core.tests/.settings/.gitignore
+++ b/bundles/org.eclipse.uomo.core.tests/.settings/.gitignore
@@ -1 +1 @@
-/org.eclipse.m2e.core.prefs
+/org.eclipse.m2e.core.prefs
diff --git a/bundles/org.eclipse.uomo.core.tests/META-INF/MANIFEST.MF b/bundles/org.eclipse.uomo.core.tests/META-INF/MANIFEST.MF
index 4d0b866..b48f324 100644
--- a/bundles/org.eclipse.uomo.core.tests/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.uomo.core.tests/META-INF/MANIFEST.MF
@@ -1,10 +1,10 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: UOMO Core Tests
-Bundle-SymbolicName: org.eclipse.uomo.core.tests
-Bundle-Version: 0.7.0.qualifier
-Bundle-Vendor: Eclipse org
-Fragment-Host: org.eclipse.uomo.core;bundle-version="0.7.0"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Export-Package: org.eclipse.uomo.core.impl;uses:="org.eclipse.uomo.core"
-Require-Bundle: org.junit
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: UOMO Core Tests
+Bundle-SymbolicName: org.eclipse.uomo.core.tests
+Bundle-Version: 0.7.0.qualifier
+Bundle-Vendor: Eclipse org
+Fragment-Host: org.eclipse.uomo.core;bundle-version="0.7.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Export-Package: org.eclipse.uomo.core.impl;uses:="org.eclipse.uomo.core"
+Require-Bundle: org.junit
diff --git a/bundles/org.eclipse.uomo.core.tests/build.properties b/bundles/org.eclipse.uomo.core.tests/build.properties
index ced5f40..c4e35e4 100644
--- a/bundles/org.eclipse.uomo.core.tests/build.properties
+++ b/bundles/org.eclipse.uomo.core.tests/build.properties
@@ -1,4 +1,4 @@
-source.. = src/
-output.. = target/classes
-bin.includes = META-INF/,\
- .
+source.. = src/
+output.. = target/classes
+bin.includes = META-INF/,\
+ .
diff --git a/bundles/org.eclipse.uomo.core.tests/pom.xml b/bundles/org.eclipse.uomo.core.tests/pom.xml
index 7b4aabc..cdbfb2d 100644
--- a/bundles/org.eclipse.uomo.core.tests/pom.xml
+++ b/bundles/org.eclipse.uomo.core.tests/pom.xml
@@ -1,14 +1,14 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>org.eclipse.uomo.bundles</artifactId>
- <groupId>org.eclipse.uomo</groupId>
- <version>0.7.0-SNAPSHOT</version>
- </parent>
- <artifactId>org.eclipse.uomo.core.tests</artifactId>
- <name>UOMo Core Tests</name>
- <packaging>eclipse-test-plugin</packaging>
+<?xml version="1.0" encoding="UTF-8"?>
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>org.eclipse.uomo.bundles</artifactId>
+ <groupId>org.eclipse.uomo</groupId>
+ <version>0.7.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.uomo.core.tests</artifactId>
+ <name>UOMo Core Tests</name>
+ <packaging>eclipse-test-plugin</packaging>
</project>
\ No newline at end of file
diff --git a/bundles/org.eclipse.uomo.core.tests/src/log4j.properties b/bundles/org.eclipse.uomo.core.tests/src/log4j.properties
index 18cfaa3..1b4557b 100644
--- a/bundles/org.eclipse.uomo.core.tests/src/log4j.properties
+++ b/bundles/org.eclipse.uomo.core.tests/src/log4j.properties
@@ -1,8 +1,8 @@
-log4j.rootCategory=INFO, stdout
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout.ConversionPattern=%t %p [%c] - %m%n
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.threshold=TRACE
-
-#log4j.logger.org.springframework.osgi=DEBUG
+log4j.rootCategory=INFO, stdout
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout.ConversionPattern=%t %p [%c] - %m%n
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.threshold=TRACE
+
+#log4j.logger.org.springframework.osgi=DEBUG
#log4j.logger.org.springframework=DEBUG
\ No newline at end of file
diff --git a/bundles/org.eclipse.uomo.core.tests/src/org/eclipse/uomo/core/impl/BeanImplTest.java b/bundles/org.eclipse.uomo.core.tests/src/org/eclipse/uomo/core/impl/BeanImplTest.java
index 816e745..0e54980 100644
--- a/bundles/org.eclipse.uomo.core.tests/src/org/eclipse/uomo/core/impl/BeanImplTest.java
+++ b/bundles/org.eclipse.uomo.core.tests/src/org/eclipse/uomo/core/impl/BeanImplTest.java
@@ -1,15 +1,15 @@
-package org.eclipse.uomo.core.impl;
-
-import junit.framework.TestCase;
-
-import org.eclipse.uomo.core.IBean;
-import org.eclipse.uomo.core.impl.Bean;
-
-public class BeanImplTest extends TestCase {
-
- public void testBeanIsABean() {
- IBean aBean = new Bean();
- assertTrue(aBean.isABean());
- }
-
+package org.eclipse.uomo.core.impl;
+
+import junit.framework.TestCase;
+
+import org.eclipse.uomo.core.IBean;
+import org.eclipse.uomo.core.impl.Bean;
+
+public class BeanImplTest extends TestCase {
+
+ public void testBeanIsABean() {
+ IBean aBean = new Bean();
+ assertTrue(aBean.isABean());
+ }
+
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.uomo.core/.classpath b/bundles/org.eclipse.uomo.core/.classpath
index 710ceaa..7e0a6d5 100644
--- a/bundles/org.eclipse.uomo.core/.classpath
+++ b/bundles/org.eclipse.uomo.core/.classpath
@@ -1,9 +1,9 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry exported="true" kind="lib" path="libs/unit-api-0.6.1.jar"/>
- <classpathentry kind="src" path="src/main/java/"/>
- <classpathentry kind="src" path="src/main/resources/"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry exported="true" kind="lib" path="libs/unit-api-0.6.1.jar"/>
+ <classpathentry kind="src" path="src/main/java/"/>
+ <classpathentry kind="src" path="src/main/resources/"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/bundles/org.eclipse.uomo.core/.gitignore b/bundles/org.eclipse.uomo.core/.gitignore
index df81231..f97c089 100644
--- a/bundles/org.eclipse.uomo.core/.gitignore
+++ b/bundles/org.eclipse.uomo.core/.gitignore
@@ -1,3 +1,3 @@
-/target
-/eclipse_config
-/.settings
+/target
+/eclipse_config
+/.settings
diff --git a/bundles/org.eclipse.uomo.core/.project b/bundles/org.eclipse.uomo.core/.project
index f1f433b..90f912b 100644
--- a/bundles/org.eclipse.uomo.core/.project
+++ b/bundles/org.eclipse.uomo.core/.project
@@ -1,60 +1,60 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.uomo.core</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.wst.common.project.facet.core.builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.jboss.tools.jst.web.kb.kbbuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.jboss.tools.cdi.core.cdibuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.wst.validation.validationbuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.m2e.core.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
- <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
- <nature>com.springsource.server.ide.facet.core.bundlenature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
- <nature>org.eclipse.m2e.core.maven2Nature</nature>
- <nature>org.jboss.tools.jst.web.kb.kbnature</nature>
- <nature>org.jboss.tools.cdi.core.cdinature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.uomo.core</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.wst.common.project.facet.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.jboss.tools.jst.web.kb.kbbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.jboss.tools.cdi.core.cdibuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
+ <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+ <nature>com.springsource.server.ide.facet.core.bundlenature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.jboss.tools.jst.web.kb.kbnature</nature>
+ <nature>org.jboss.tools.cdi.core.cdinature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.uomo.core/libs/README b/bundles/org.eclipse.uomo.core/libs/README
index 9edcad5..3b4d98f 100644
--- a/bundles/org.eclipse.uomo.core/libs/README
+++ b/bundles/org.eclipse.uomo.core/libs/README
@@ -1,3 +1,3 @@
-This jar file is included here because it cannot be downloaded from a public p2 repository at this time.
-
+This jar file is included here because it cannot be downloaded from a public p2 repository at this time.
+
If this file is included in Orbit - it can be removed.
\ No newline at end of file
diff --git a/bundles/org.eclipse.uomo.core/src/main/java/org/eclipse/uomo/core/IBean.java b/bundles/org.eclipse.uomo.core/src/main/java/org/eclipse/uomo/core/IBean.java
index fa6a020..6162629 100644
--- a/bundles/org.eclipse.uomo.core/src/main/java/org/eclipse/uomo/core/IBean.java
+++ b/bundles/org.eclipse.uomo.core/src/main/java/org/eclipse/uomo/core/IBean.java
@@ -1,25 +1,25 @@
-/******************************************************************************
- * Copyright (c) 1996, 2010, Werner Keil, Creative Arts & Technologies.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Werner Keil, Creative Arts & Technologies - initial API and implementation
- *****************************************************************************/
-
-package org.eclipse.uomo.core;
-
-/**
- * A bean.
- *
- * @version $Id$
- * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
- * @deprecated For integration only
- */
-public interface IBean {
-
- boolean isABean();
-
+/******************************************************************************
+ * Copyright (c) 1996, 2010, Werner Keil, Creative Arts & Technologies.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Werner Keil, Creative Arts & Technologies - initial API and implementation
+ *****************************************************************************/
+
+package org.eclipse.uomo.core;
+
+/**
+ * A bean.
+ *
+ * @version $Id$
+ * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
+ * @deprecated For integration only
+ */
+public interface IBean {
+
+ boolean isABean();
+
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.uomo.core/src/main/java/org/eclipse/uomo/core/IDescription.java b/bundles/org.eclipse.uomo.core/src/main/java/org/eclipse/uomo/core/IDescription.java
index 72df53e..b66641c 100644
--- a/bundles/org.eclipse.uomo.core/src/main/java/org/eclipse/uomo/core/IDescription.java
+++ b/bundles/org.eclipse.uomo.core/src/main/java/org/eclipse/uomo/core/IDescription.java
@@ -1,22 +1,22 @@
-/******************************************************************************
- * Copyright (c) 1996, 2010, Werner Keil, Creative Arts & Technologies.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Werner Keil, Creative Arts & Technologies - initial API and implementation
- *****************************************************************************/
-
-package org.eclipse.uomo.core;
-
-/**
- * Denote entity that has a description.
- *
- * @version $Id: IIDescription.java 63 2010-07-19 10:35:31Z werner.keil $
- * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
- */
-public interface IDescription {
- String getDescription();
+/******************************************************************************
+ * Copyright (c) 1996, 2010, Werner Keil, Creative Arts & Technologies.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Werner Keil, Creative Arts & Technologies - initial API and implementation
+ *****************************************************************************/
+
+package org.eclipse.uomo.core;
+
+/**
+ * Denote entity that has a description.
+ *
+ * @version $Id: IIDescription.java 63 2010-07-19 10:35:31Z werner.keil $
+ * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
+ */
+public interface IDescription {
+ String getDescription();
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.uomo.core/src/main/java/org/eclipse/uomo/core/IValue.java b/bundles/org.eclipse.uomo.core/src/main/java/org/eclipse/uomo/core/IValue.java
index 9671de2..98de649 100644
--- a/bundles/org.eclipse.uomo.core/src/main/java/org/eclipse/uomo/core/IValue.java
+++ b/bundles/org.eclipse.uomo.core/src/main/java/org/eclipse/uomo/core/IValue.java
@@ -1,22 +1,22 @@
-/******************************************************************************
- * Copyright (c) 2011, 2014 Werner Keil, Creative Arts & Technologies.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Werner Keil, Creative Arts & Technologies - initial API and implementation
- *****************************************************************************/
-
-package org.eclipse.uomo.core;
-
-/**
- * Denote entity that has a {@code V} value.
- *
- * @version 0.3
- * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
- */
-public interface IValue<V> {
- V getValue();
+/******************************************************************************
+ * Copyright (c) 2011, 2014 Werner Keil, Creative Arts & Technologies.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Werner Keil, Creative Arts & Technologies - initial API and implementation
+ *****************************************************************************/
+
+package org.eclipse.uomo.core;
+
+/**
+ * Denote entity that has a {@code V} value.
+ *
+ * @version 0.3
+ * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
+ */
+public interface IValue<V> {
+ V getValue();
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.uomo.core/src/main/java/org/eclipse/uomo/core/impl/Bean.java b/bundles/org.eclipse.uomo.core/src/main/java/org/eclipse/uomo/core/impl/Bean.java
index 0b124fe..3fcf49d 100644
--- a/bundles/org.eclipse.uomo.core/src/main/java/org/eclipse/uomo/core/impl/Bean.java
+++ b/bundles/org.eclipse.uomo.core/src/main/java/org/eclipse/uomo/core/impl/Bean.java
@@ -1,22 +1,22 @@
-/******************************************************************************
- * Copyright (c) 1996, 2010, Werner Keil, Creative Arts & Technologies.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Werner Keil, Creative Arts & Technologies - initial API and implementation
- *****************************************************************************/
-
-package org.eclipse.uomo.core.impl;
-
-import org.eclipse.uomo.core.IBean;
-
-public class Bean implements IBean {
-
- public boolean isABean() {
- return true;
- }
-
-}
+/******************************************************************************
+ * Copyright (c) 1996, 2010, Werner Keil, Creative Arts & Technologies.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Werner Keil, Creative Arts & Technologies - initial API and implementation
+ *****************************************************************************/
+
+package org.eclipse.uomo.core.impl;
+
+import org.eclipse.uomo.core.IBean;
+
+public class Bean implements IBean {
+
+ public boolean isABean() {
+ return true;
+ }
+
+}
diff --git a/bundles/org.eclipse.uomo.core/src/main/java/org/eclipse/uomo/core/impl/CodeValuePair.java b/bundles/org.eclipse.uomo.core/src/main/java/org/eclipse/uomo/core/impl/CodeValuePair.java
index 384f193..4ef2777 100644
--- a/bundles/org.eclipse.uomo.core/src/main/java/org/eclipse/uomo/core/impl/CodeValuePair.java
+++ b/bundles/org.eclipse.uomo.core/src/main/java/org/eclipse/uomo/core/impl/CodeValuePair.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2014 Werner Keil, Creative Arts & Technologies.
- * Crown Copyright (c) 2006, 2007, Copyright (c) 2006, 2007 Jiva Medical.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Jiva Medical - initial API and implementation
- * Werner Keil - improvements, functional interfaces
- *******************************************************************************/
-
-package org.eclipse.uomo.core.impl;
-
-import org.eclipse.uomo.core.ICode;
-import org.eclipse.uomo.core.IValue;
-
-/**
- * @author Werner Keil
- *
- * @param <V>
- * @param <C>
- */
-public class CodeValuePair<V, C> implements ICode<C>, IValue<V> {
-
- private V value;
- private C code;
- /**
- * @param value
- * @param code
- */
- public CodeValuePair(V value, C code) {
- super();
- this.value = value;
- this.code = code;
- }
- /**
- * @return the value
- */
- public V getValue() {
- return value;
- }
- /**
- * @return the code
- */
- public C getCode() {
- return code;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010, 2014 Werner Keil, Creative Arts & Technologies.
+ * Crown Copyright (c) 2006, 2007, Copyright (c) 2006, 2007 Jiva Medical.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Jiva Medical - initial API and implementation
+ * Werner Keil - improvements, functional interfaces
+ *******************************************************************************/
+
+package org.eclipse.uomo.core.impl;
+
+import org.eclipse.uomo.core.ICode;
+import org.eclipse.uomo.core.IValue;
+
+/**
+ * @author Werner Keil
+ *
+ * @param <V>
+ * @param <C>
+ */
+public class CodeValuePair<V, C> implements ICode<C>, IValue<V> {
+
+ private V value;
+ private C code;
+ /**
+ * @param value
+ * @param code
+ */
+ public CodeValuePair(V value, C code) {
+ super();
+ this.value = value;
+ this.code = code;
+ }
+ /**
+ * @return the value
+ */
+ public V getValue() {
+ return value;
+ }
+ /**
+ * @return the code
+ */
+ public C getCode() {
+ return code;
+ }
+}
diff --git a/bundles/org.eclipse.uomo.core/src/main/java/org/eclipse/uomo/core/internal/Activator.java b/bundles/org.eclipse.uomo.core/src/main/java/org/eclipse/uomo/core/internal/Activator.java
index 4ff473f..a81ef37 100644
--- a/bundles/org.eclipse.uomo.core/src/main/java/org/eclipse/uomo/core/internal/Activator.java
+++ b/bundles/org.eclipse.uomo.core/src/main/java/org/eclipse/uomo/core/internal/Activator.java
@@ -1,50 +1,50 @@
-/**
- * Copyright (c) 2010, 2012 Werner Keil, JScience and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Werner Keil - initial API and implementation
- */
-package org.eclipse.uomo.core.internal;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-/**
- * OSGi part of implementation.
- *
- * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
- * @version 0.3 ($Revision$), $Date$
- */
-public class Activator implements BundleActivator {
- private BundleContext fContext;
-
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext
- * )
- */
- public void start(BundleContext context) throws Exception {
- fContext = context;
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- // close the service tracker(s)
- // stopDictionary();
- fContext = null;
- }
-
-}
+/**
+ * Copyright (c) 2010, 2012 Werner Keil, JScience and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Werner Keil - initial API and implementation
+ */
+package org.eclipse.uomo.core.internal;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * OSGi part of implementation.
+ *
+ * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
+ * @version 0.3 ($Revision$), $Date$
+ */
+public class Activator implements BundleActivator {
+ private BundleContext fContext;
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext
+ * )
+ */
+ public void start(BundleContext context) throws Exception {
+ fContext = context;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ // close the service tracker(s)
+ // stopDictionary();
+ fContext = null;
+ }
+
+}
diff --git a/bundles/org.eclipse.uomo.core/src/main/resources/META-INF/spring/bundle-context.xml b/bundles/org.eclipse.uomo.core/src/main/resources/META-INF/spring/bundle-context.xml
index 2459eb0..8c4ef28 100644
--- a/bundles/org.eclipse.uomo.core/src/main/resources/META-INF/spring/bundle-context.xml
+++ b/bundles/org.eclipse.uomo.core/src/main/resources/META-INF/spring/bundle-context.xml
@@ -1,13 +1,13 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
-
- <!-- regular spring configuration file defining the beans for this
- bundle. We've kept the osgi definitions in a separate
- configuration file so that this file can easily be used
- for integration testing outside of an OSGi environment -->
-
- <bean name="myBean" class="org.eclipse.uomo.core.impl.BeanImpl" />
-
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+ <!-- regular spring configuration file defining the beans for this
+ bundle. We've kept the osgi definitions in a separate
+ configuration file so that this file can easily be used
+ for integration testing outside of an OSGi environment -->
+
+ <bean name="myBean" class="org.eclipse.uomo.core.impl.BeanImpl" />
+
</beans>
\ No newline at end of file
diff --git a/bundles/org.eclipse.uomo.core/src/main/resources/log4j.properties b/bundles/org.eclipse.uomo.core/src/main/resources/log4j.properties
index 18cfaa3..1b4557b 100644
--- a/bundles/org.eclipse.uomo.core/src/main/resources/log4j.properties
+++ b/bundles/org.eclipse.uomo.core/src/main/resources/log4j.properties
@@ -1,8 +1,8 @@
-log4j.rootCategory=INFO, stdout
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout.ConversionPattern=%t %p [%c] - %m%n
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.threshold=TRACE
-
-#log4j.logger.org.springframework.osgi=DEBUG
+log4j.rootCategory=INFO, stdout
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout.ConversionPattern=%t %p [%c] - %m%n
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.threshold=TRACE
+
+#log4j.logger.org.springframework.osgi=DEBUG
#log4j.logger.org.springframework=DEBUG
\ No newline at end of file
diff --git a/bundles/org.eclipse.uomo.ucum.tests/.classpath b/bundles/org.eclipse.uomo.ucum.tests/.classpath
index 0b1bcf9..9bc33d3 100644
--- a/bundles/org.eclipse.uomo.ucum.tests/.classpath
+++ b/bundles/org.eclipse.uomo.ucum.tests/.classpath
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src/"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src/"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/bundles/org.eclipse.uomo.ucum.tests/.gitignore b/bundles/org.eclipse.uomo.ucum.tests/.gitignore
index 4dc0091..9f564a8 100644
--- a/bundles/org.eclipse.uomo.ucum.tests/.gitignore
+++ b/bundles/org.eclipse.uomo.ucum.tests/.gitignore
@@ -1,2 +1,2 @@
-/target
-/bin
+/target
+/bin
diff --git a/bundles/org.eclipse.uomo.ucum.tests/.project b/bundles/org.eclipse.uomo.ucum.tests/.project
index 65a1971..c239d3f 100644
--- a/bundles/org.eclipse.uomo.ucum.tests/.project
+++ b/bundles/org.eclipse.uomo.ucum.tests/.project
@@ -1,34 +1,34 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.uomo.ucum.tests</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.m2e.core.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.m2e.core.maven2Nature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.uomo.ucum.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.uomo.ucum.tests/.settings/.gitignore b/bundles/org.eclipse.uomo.ucum.tests/.settings/.gitignore
index 0924da4..c14d360 100644
--- a/bundles/org.eclipse.uomo.ucum.tests/.settings/.gitignore
+++ b/bundles/org.eclipse.uomo.ucum.tests/.settings/.gitignore
@@ -1 +1 @@
-/org.eclipse.m2e.core.prefs
+/org.eclipse.m2e.core.prefs
diff --git a/bundles/org.eclipse.uomo.ucum.tests/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.uomo.ucum.tests/.settings/org.eclipse.jdt.core.prefs
index c537b63..f287d53 100644
--- a/bundles/org.eclipse.uomo.ucum.tests/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.uomo.ucum.tests/.settings/org.eclipse.jdt.core.prefs
@@ -1,7 +1,7 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.6
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/bundles/org.eclipse.uomo.ucum.tests/META-INF/MANIFEST.MF b/bundles/org.eclipse.uomo.ucum.tests/META-INF/MANIFEST.MF
index 6cb9dee..2178429 100644
--- a/bundles/org.eclipse.uomo.ucum.tests/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.uomo.ucum.tests/META-INF/MANIFEST.MF
@@ -1,13 +1,13 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: UCUM Tests
-Bundle-SymbolicName: org.eclipse.uomo.ucum.tests
-Bundle-Version: 0.7.0.qualifier
-Bundle-Vendor: Eclipse.org
-Fragment-Host: org.eclipse.uomo.ucum;bundle-version="0.7.0"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Export-Package: org.eclipse.uomo.ucum.tests
-Require-Bundle: org.junit;bundle-version="4.8.2",
- org.eclipse.uomo.util;bundle-version="0.7.0",
- org.eclipse.uomo.xml;bundle-version="0.7.0"
-
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: UCUM Tests
+Bundle-SymbolicName: org.eclipse.uomo.ucum.tests
+Bundle-Version: 0.7.0.qualifier
+Bundle-Vendor: Eclipse.org
+Fragment-Host: org.eclipse.uomo.ucum;bundle-version="0.7.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Export-Package: org.eclipse.uomo.ucum.tests
+Require-Bundle: org.junit;bundle-version="4.8.2",
+ org.eclipse.uomo.util;bundle-version="0.7.0",
+ org.eclipse.uomo.xml;bundle-version="0.7.0"
+
diff --git a/bundles/org.eclipse.uomo.ucum.tests/build.properties b/bundles/org.eclipse.uomo.ucum.tests/build.properties
index 34d2e4d..41eb6ad 100644
--- a/bundles/org.eclipse.uomo.ucum.tests/build.properties
+++ b/bundles/org.eclipse.uomo.ucum.tests/build.properties
@@ -1,4 +1,4 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/bundles/org.eclipse.uomo.ucum.tests/etc/org.eclipse.uomo.ucum.tests.launch b/bundles/org.eclipse.uomo.ucum.tests/etc/org.eclipse.uomo.ucum.tests.launch
index 2e7ef92..da2a12b 100644
--- a/bundles/org.eclipse.uomo.ucum.tests/etc/org.eclipse.uomo.ucum.tests.launch
+++ b/bundles/org.eclipse.uomo.ucum.tests/etc/org.eclipse.uomo.ucum.tests.launch
@@ -1,20 +1,20 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/org.eclipse.uomo.ucum.tests"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="4"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
-<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=org.eclipse.uomo.ucum.tests"/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.uomo.ucum.tests"/>
-<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
-</launchConfiguration>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.eclipse.uomo.ucum.tests"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
+<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=org.eclipse.uomo.ucum.tests"/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.uomo.ucum.tests"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
+</launchConfiguration>
diff --git a/bundles/org.eclipse.uomo.ucum.tests/src/org/eclipse/uomo/ucum/tests/H3ETTestConfiguration.java b/bundles/org.eclipse.uomo.ucum.tests/src/org/eclipse/uomo/ucum/tests/H3ETTestConfiguration.java
index 4a28125..b318597 100644
--- a/bundles/org.eclipse.uomo.ucum.tests/src/org/eclipse/uomo/ucum/tests/H3ETTestConfiguration.java
+++ b/bundles/org.eclipse.uomo.ucum.tests/src/org/eclipse/uomo/ucum/tests/H3ETTestConfiguration.java
@@ -1,55 +1,55 @@
-/*******************************************************************************
- * Crown Copyright (c) 2006, 2007, Copyright (c) 2006, 2007 Jiva Medical.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Jiva Medical - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.uomo.ucum.tests;
-
-//import org.eclipse.uomo.util.test.UOMoTestConfiguration;
-
-
-
-/*
- * we need some ideas here.
- * 1. copyright. The testing uses a sample project. It's full of things that are open but
- * not sufficiently unencumbered to be EPL. So it's on
- * sourceforge @ https://sourceforge.net/projects/ohf-he3t-test
- *
- * 2. Local directory. We've given up trying to organise some better way to
- * organise where the data resides. So it's a constant here, and you simply
- * change the constant for your local setup.
- *
- * Better ideas are welcome
- */
-
-public interface H3ETTestConfiguration {
-
- /**
- * The test workspace, which should contains the test project
- * org.eclipse.ohf.h3et.test
- *
- * NOTE: current setting assume the test workspace contains two projects:
- * * org.eclipse.ohf.h3et.test: with a minimised MIF and its related test data
- * * ca.infoway.cerx.mif21: Using the Infoway MIFs settings for more general testing
- */
- public static final String TEST_WORKSPACE = System.getenv("WORKSPACE") != null ? System.getenv("WORKSPACE") : "C:/workspace/data/";
-// public static final String TEST_PROJECT = TEST_WORKSPACE + "org.eclipse.ohf.h3et.test";
-// public static final String TEST_PROJECT_VOCAB = TEST_PROJECT+"/Vocab";
-// public static final String TEST_PROJECT_MIF = TEST_PROJECT+"/Mif";
-// public static final String TEST_PROJECT_CASES = TEST_PROJECT+"/TestCases";
-// public static final String TEST_PROJECT_FRAGMENTS = TEST_PROJECT+"/Mif/Fragments";
-
- public static final String WORK_PROJECT = TEST_WORKSPACE + "ca.infoway.cerx.mif21";
- public static final String WORK_PROJECT_VOCAB = WORK_PROJECT+"/Vocab";
- public static final String WORK_PROJECT_MIF = WORK_PROJECT+"/Mif";
- public static final String WORK_PROJECT_CASES = WORK_PROJECT+"/TestCases";
- public static final String WORK_PROJECT_FRAGMENTS = WORK_PROJECT+"/Mif/Fragments";
- public static final String WORK_PROJECT_TESTFOLDER = WORK_PROJECT+"/unitTests";
-
-}
+/*******************************************************************************
+ * Crown Copyright (c) 2006, 2007, Copyright (c) 2006, 2007 Jiva Medical.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Jiva Medical - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.uomo.ucum.tests;
+
+//import org.eclipse.uomo.util.test.UOMoTestConfiguration;
+
+
+
+/*
+ * we need some ideas here.
+ * 1. copyright. The testing uses a sample project. It's full of things that are open but
+ * not sufficiently unencumbered to be EPL. So it's on
+ * sourceforge @ https://sourceforge.net/projects/ohf-he3t-test
+ *
+ * 2. Local directory. We've given up trying to organise some better way to
+ * organise where the data resides. So it's a constant here, and you simply
+ * change the constant for your local setup.
+ *
+ * Better ideas are welcome
+ */
+
+public interface H3ETTestConfiguration {
+
+ /**
+ * The test workspace, which should contains the test project
+ * org.eclipse.ohf.h3et.test
+ *
+ * NOTE: current setting assume the test workspace contains two projects:
+ * * org.eclipse.ohf.h3et.test: with a minimised MIF and its related test data
+ * * ca.infoway.cerx.mif21: Using the Infoway MIFs settings for more general testing
+ */
+ public static final String TEST_WORKSPACE = System.getenv("WORKSPACE") != null ? System.getenv("WORKSPACE") : "C:/workspace/data/";
+// public static final String TEST_PROJECT = TEST_WORKSPACE + "org.eclipse.ohf.h3et.test";
+// public static final String TEST_PROJECT_VOCAB = TEST_PROJECT+"/Vocab";
+// public static final String TEST_PROJECT_MIF = TEST_PROJECT+"/Mif";
+// public static final String TEST_PROJECT_CASES = TEST_PROJECT+"/TestCases";
+// public static final String TEST_PROJECT_FRAGMENTS = TEST_PROJECT+"/Mif/Fragments";
+
+ public static final String WORK_PROJECT = TEST_WORKSPACE + "ca.infoway.cerx.mif21";
+ public static final String WORK_PROJECT_VOCAB = WORK_PROJECT+"/Vocab";
+ public static final String WORK_PROJECT_MIF = WORK_PROJECT+"/Mif";
+ public static final String WORK_PROJECT_CASES = WORK_PROJECT+"/TestCases";
+ public static final String WORK_PROJECT_FRAGMENTS = WORK_PROJECT+"/Mif/Fragments";
+ public static final String WORK_PROJECT_TESTFOLDER = WORK_PROJECT+"/unitTests";
+
+}
diff --git a/bundles/org.eclipse.uomo.ucum.tests/src/org/eclipse/uomo/ucum/tests/UcumServiceTest.java b/bundles/org.eclipse.uomo.ucum.tests/src/org/eclipse/uomo/ucum/tests/UcumServiceTest.java
index 6836d28..0e8a84d 100644
--- a/bundles/org.eclipse.uomo.ucum.tests/src/org/eclipse/uomo/ucum/tests/UcumServiceTest.java
+++ b/bundles/org.eclipse.uomo.ucum.tests/src/org/eclipse/uomo/ucum/tests/UcumServiceTest.java
@@ -1,120 +1,120 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2013 Werner Keil.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Werner Keil - initial API and implementation
- *******************************************************************************/
-package org.eclipse.uomo.ucum.tests;
-
-import static org.junit.Assert.*;
-import static org.eclipse.uomo.core.impl.OutputHelper.*;
-
-import java.math.BigDecimal;
-import java.util.Set;
-
-import org.eclipse.uomo.core.UOMoException;
-import org.eclipse.uomo.ucum.UcumService;
-import org.eclipse.uomo.ucum.expression.Symbol;
-import org.eclipse.uomo.ucum.expression.Term;
-import org.eclipse.uomo.ucum.impl.UcumEssenceService;
-import org.eclipse.uomo.ucum.parsers.ExpressionParser;
-import org.eclipse.uomo.util.Parser;
-import org.junit.Before;
-import org.junit.Test;
-import org.unitsofmeasurement.unit.Unit;
-
-import com.ibm.icu.text.DecimalFormat;
-import com.ibm.icu.text.NumberFormat;
-
-
-/**
- * @author Werner Keil
- * @version 1.4, 2013-12-08
- */
-public class UcumServiceTest {
- private UcumService ucumService;
-
- @Before
- public void init() {
- if (ucumService == null) {
- ucumService = new UcumEssenceService(getClass().getClassLoader().getResourceAsStream("ucum-essence.xml"));
- }
- }
-
- @Test
- public void testConversion() {
- Number mult = ucumService.convert(new BigDecimal(1000d), "l", "m3");
- assertNotNull(mult);
- NumberFormat fmt = new DecimalFormat("#,##0.000");
- assertEquals(fmt.format(BigDecimal.ONE), fmt.format(mult));
- }
-
- @Test
- public void testProperties() {
- Set<String> props = ucumService.getProperties();
- if (isConsoleOutput()) {
- for (String prop : props) {
- println(prop);
- }
- }
- assertEquals(98, props.size());
- }
-
-
- @Test
- public void testParse() {
- Parser<String, Term> p = new ExpressionParser(ucumService.getModel());
- try {
- Term t = p.parse("m/s2");
- assertNotNull(t);
- assertEquals("DIVISION", t.getOp().toString());
- Symbol s = (Symbol)t.getComp();
- Unit<?> u = s.getUnit();
- assertEquals("m", u.getSymbol());
- } catch (UOMoException e) {
- println(e.getLocalizedMessage());
- fail(e.getLocalizedMessage());
- }
- }
-
- @Test
- public void testParseParseMult1() {
- Parser<String, Term> p = new ExpressionParser(ucumService.getModel());
- try {
- Term t = p.parse("m.s2");
- assertNotNull(t);
- assertEquals("MULTIPLICATION", t.getOp().toString());
- Symbol s = (Symbol)t.getComp();
- Unit<?> u = s.getUnit();
- assertEquals("m", u.getSymbol());
- } catch (UOMoException e) {
- println(e.getLocalizedMessage());
- fail(e.getLocalizedMessage());
- }
- }
-
- /**
- * @see <a
- * href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=371433">Bugzilla: 371433</a>
- */
- @Test
- public void testParseParseParenthes1() {
- Parser<String, Term> p = new ExpressionParser(ucumService.getModel());
- try {
- Term t = p.parse("kg/m/s");
- assertNotNull(t);
- assertEquals("DIVISION", t.getOp().toString());
- Symbol s = (Symbol)t.getComp();
- Unit<?> u = s.getUnit();
- assertEquals("g", u.getSymbol());
- assertEquals("k", s.getPrefix().getSymbol());
- } catch (UOMoException e) {
- println(e.getLocalizedMessage());
- fail(e.getLocalizedMessage());
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010, 2013 Werner Keil.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Werner Keil - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.uomo.ucum.tests;
+
+import static org.junit.Assert.*;
+import static org.eclipse.uomo.core.impl.OutputHelper.*;
+
+import java.math.BigDecimal;
+import java.util.Set;
+
+import org.eclipse.uomo.core.UOMoException;
+import org.eclipse.uomo.ucum.UcumService;
+import org.eclipse.uomo.ucum.expression.Symbol;
+import org.eclipse.uomo.ucum.expression.Term;
+import org.eclipse.uomo.ucum.impl.UcumEssenceService;
+import org.eclipse.uomo.ucum.parsers.ExpressionParser;
+import org.eclipse.uomo.util.Parser;
+import org.junit.Before;
+import org.junit.Test;
+import org.unitsofmeasurement.unit.Unit;
+
+import com.ibm.icu.text.DecimalFormat;
+import com.ibm.icu.text.NumberFormat;
+
+
+/**
+ * @author Werner Keil
+ * @version 1.4, 2013-12-08
+ */
+public class UcumServiceTest {
+ private UcumService ucumService;
+
+ @Before
+ public void init() {
+ if (ucumService == null) {
+ ucumService = new UcumEssenceService(getClass().getClassLoader().getResourceAsStream("ucum-essence.xml"));
+ }
+ }
+
+ @Test
+ public void testConversion() {
+ Number mult = ucumService.convert(new BigDecimal(1000d), "l", "m3");
+ assertNotNull(mult);
+ NumberFormat fmt = new DecimalFormat("#,##0.000");
+ assertEquals(fmt.format(BigDecimal.ONE), fmt.format(mult));
+ }
+
+ @Test
+ public void testProperties() {
+ Set<String> props = ucumService.getProperties();
+ if (isConsoleOutput()) {
+ for (String prop : props) {
+ println(prop);
+ }
+ }
+ assertEquals(98, props.size());
+ }
+
+
+ @Test
+ public void testParse() {
+ Parser<String, Term> p = new ExpressionParser(ucumService.getModel());
+ try {
+ Term t = p.parse("m/s2");
+ assertNotNull(t);
+ assertEquals("DIVISION", t.getOp().toString());
+ Symbol s = (Symbol)t.getComp();
+ Unit<?> u = s.getUnit();
+ assertEquals("m", u.getSymbol());
+ } catch (UOMoException e) {
+ println(e.getLocalizedMessage());
+ fail(e.getLocalizedMessage());
+ }
+ }
+
+ @Test
+ public void testParseParseMult1() {
+ Parser<String, Term> p = new ExpressionParser(ucumService.getModel());
+ try {
+ Term t = p.parse("m.s2");
+ assertNotNull(t);
+ assertEquals("MULTIPLICATION", t.getOp().toString());
+ Symbol s = (Symbol)t.getComp();
+ Unit<?> u = s.getUnit();
+ assertEquals("m", u.getSymbol());
+ } catch (UOMoException e) {
+ println(e.getLocalizedMessage());
+ fail(e.getLocalizedMessage());
+ }
+ }
+
+ /**
+ * @see <a
+ * href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=371433">Bugzilla: 371433</a>
+ */
+ @Test
+ public void testParseParseParenthes1() {
+ Parser<String, Term> p = new ExpressionParser(ucumService.getModel());
+ try {
+ Term t = p.parse("kg/m/s");
+ assertNotNull(t);
+ assertEquals("DIVISION", t.getOp().toString());
+ Symbol s = (Symbol)t.getComp();
+ Unit<?> u = s.getUnit();
+ assertEquals("g", u.getSymbol());
+ assertEquals("k", s.getPrefix().getSymbol());
+ } catch (UOMoException e) {
+ println(e.getLocalizedMessage());
+ fail(e.getLocalizedMessage());
+ }
+ }
+}
diff --git a/bundles/org.eclipse.uomo.ucum.tests/src/ucum-essence.xml b/bundles/org.eclipse.uomo.ucum.tests/src/ucum-essence.xml
index c6c6c9b..d45b615 100644
--- a/bundles/org.eclipse.uomo.ucum.tests/src/ucum-essence.xml
+++ b/bundles/org.eclipse.uomo.ucum.tests/src/ucum-essence.xml
@@ -1,2062 +1,2062 @@
-<?xml version="1.0" encoding="ascii"?>
-<root xmlns="http://unitsofmeasure.org/ucum-essence" version="1.9"
- revision="$Revision: 16410 $"
- revision-date="$Date: 2013-10-21 21:24:43 -0700 (Mon, 21 Oct 2013) $">
- <prefix xmlns="" Code="Y" CODE="YA">
- <name>yotta</name>
- <printSymbol>Y</printSymbol>
- <value value="1e24">1 × 10<sup>24</sup>
- </value>
- </prefix>
- <prefix xmlns="" Code="Z" CODE="ZA">
- <name>zetta</name>
- <printSymbol>Z</printSymbol>
- <value value="1e21">1 × 10<sup>21</sup>
- </value>
- </prefix>
- <prefix xmlns="" Code="E" CODE="EX">
- <name>exa</name>
- <printSymbol>E</printSymbol>
- <value value="1e18">1 × 10<sup>18</sup>
- </value>
- </prefix>
- <prefix xmlns="" Code="P" CODE="PT">
- <name>peta</name>
- <printSymbol>P</printSymbol>
- <value value="1e15">1 × 10<sup>15</sup>
- </value>
- </prefix>
- <prefix xmlns="" Code="T" CODE="TR">
- <name>tera</name>
- <printSymbol>T</printSymbol>
- <value value="1e12">1 × 10<sup>12</sup>
- </value>
- </prefix>
- <prefix xmlns="" Code="G" CODE="GA">
- <name>giga</name>
- <printSymbol>G</printSymbol>
- <value value="1e9">1 × 10<sup>9</sup>
- </value>
- </prefix>
- <prefix xmlns="" Code="M" CODE="MA">
- <name>mega</name>
- <printSymbol>M</printSymbol>
- <value value="1e6">1 × 10<sup>6</sup>
- </value>
- </prefix>
- <prefix xmlns="" Code="k" CODE="K">
- <name>kilo</name>
- <printSymbol>k</printSymbol>
- <value value="1e3">1 × 10<sup>3</sup>
- </value>
- </prefix>
- <prefix xmlns="" Code="h" CODE="H">
- <name>hecto</name>
- <printSymbol>h</printSymbol>
- <value value="1e2">1 × 10<sup>2</sup>
- </value>
- </prefix>
- <prefix xmlns="" Code="da" CODE="DA">
- <name>deka</name>
- <printSymbol>da</printSymbol>
- <value value="1e1">1 × 10<sup>1</sup>
- </value>
- </prefix>
- <prefix xmlns="" Code="d" CODE="D">
- <name>deci</name>
- <printSymbol>d</printSymbol>
- <value value="1e-1">1 × 10<sup>-1</sup>
- </value>
- </prefix>
- <prefix xmlns="" Code="c" CODE="C">
- <name>centi</name>
- <printSymbol>c</printSymbol>
- <value value="1e-2">1 × 10<sup>-2</sup>
- </value>
- </prefix>
- <prefix xmlns="" Code="m" CODE="M">
- <name>milli</name>
- <printSymbol>m</printSymbol>
- <value value="1e-3">1 × 10<sup>-3</sup>
- </value>
- </prefix>
- <prefix xmlns="" Code="u" CODE="U">
- <name>micro</name>
- <printSymbol>μ</printSymbol>
- <value value="1e-6">1 × 10<sup>-6</sup>
- </value>
- </prefix>
- <prefix xmlns="" Code="n" CODE="N">
- <name>nano</name>
- <printSymbol>n</printSymbol>
- <value value="1e-9">1 × 10<sup>-9</sup>
- </value>
- </prefix>
- <prefix xmlns="" Code="p" CODE="P">
- <name>pico</name>
- <printSymbol>p</printSymbol>
- <value value="1e-12">1 × 10<sup>-12</sup>
- </value>
- </prefix>
- <prefix xmlns="" Code="f" CODE="F">
- <name>femto</name>
- <printSymbol>f</printSymbol>
- <value value="1e-15">1 × 10<sup>-15</sup>
- </value>
- </prefix>
- <prefix xmlns="" Code="a" CODE="A">
- <name>atto</name>
- <printSymbol>a</printSymbol>
- <value value="1e-18">1 × 10<sup>-18</sup>
- </value>
- </prefix>
- <prefix xmlns="" Code="z" CODE="ZO">
- <name>zepto</name>
- <printSymbol>z</printSymbol>
- <value value="1e-21">1 × 10<sup>-21</sup>
- </value>
- </prefix>
- <prefix xmlns="" Code="y" CODE="YO">
- <name>yocto</name>
- <printSymbol>y</printSymbol>
- <value value="1e-24">1 × 10<sup>-24</sup>
- </value>
- </prefix>
- <base-unit xmlns="" Code="m" CODE="M" dim="L">
- <name>meter</name>
- <printSymbol>m</printSymbol>
- <property>length</property>
- </base-unit>
- <base-unit xmlns="" Code="s" CODE="S" dim="T">
- <name>second</name>
- <printSymbol>s</printSymbol>
- <property>time</property>
- </base-unit>
- <base-unit xmlns="" Code="g" CODE="G" dim="M">
- <name>gram</name>
- <printSymbol>g</printSymbol>
- <property>mass</property>
- </base-unit>
- <base-unit xmlns="" Code="rad" CODE="RAD" dim="A">
- <name>radian</name>
- <printSymbol>rad</printSymbol>
- <property>plane angle</property>
- </base-unit>
- <base-unit xmlns="" Code="K" CODE="K" dim="C">
- <name>Kelvin</name>
- <printSymbol>K</printSymbol>
- <property>temperature</property>
- </base-unit>
- <base-unit xmlns="" Code="C" CODE="C" dim="Q">
- <name>Coulomb</name>
- <printSymbol>C</printSymbol>
- <property>electric charge</property>
- </base-unit>
- <base-unit xmlns="" Code="cd" CODE="CD" dim="F">
- <name>candela</name>
- <printSymbol>cd</printSymbol>
- <property>luminous intensity</property>
- </base-unit>
- <unit xmlns="" Code="10*" CODE="10*" isMetric="no" class="dimless">
- <name>the number ten for arbitrary powers</name>
- <printSymbol>10</printSymbol>
- <property>number</property>
- <value Unit="1" UNIT="1" value="10">10</value>
- </unit>
- <unit xmlns="" Code="10^" CODE="10^" isMetric="no" class="dimless">
- <name>the number ten for arbitrary powers</name>
- <printSymbol>10</printSymbol>
- <property>number</property>
- <value Unit="1" UNIT="1" value="10">10</value>
- </unit>
- <unit xmlns="" Code="[pi]" CODE="[PI]" isMetric="no" class="dimless">
- <name>the number pi</name>
- <printSymbol>π</printSymbol>
- <property>number</property>
- <value Unit="1" UNIT="1"
- value="3.1415926535897932384626433832795028841971693993751058209749445923">π</value>
- </unit>
- <unit xmlns="" Code="%" CODE="%" isMetric="no" class="dimless">
- <name>percent</name>
- <printSymbol>%</printSymbol>
- <property>fraction</property>
- <value Unit="10*-2" UNIT="10*-2" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[ppth]" CODE="[PPTH]" isMetric="no" class="dimless">
- <name>parts per thousand</name>
- <printSymbol>ppth</printSymbol>
- <property>fraction</property>
- <value Unit="10*-3" UNIT="10*-3" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[ppm]" CODE="[PPM]" isMetric="no" class="dimless">
- <name>parts per million</name>
- <printSymbol>ppm</printSymbol>
- <property>fraction</property>
- <value Unit="10*-6" UNIT="10*-6" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[ppb]" CODE="[PPB]" isMetric="no" class="dimless">
- <name>parts per billion</name>
- <printSymbol>ppb</printSymbol>
- <property>fraction</property>
- <value Unit="10*-9" UNIT="10*-9" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[pptr]" CODE="[PPTR]" isMetric="no" class="dimless">
- <name>parts per trillion</name>
- <printSymbol>pptr</printSymbol>
- <property>fraction</property>
- <value Unit="10*-12" UNIT="10*-12" value="1">1</value>
- </unit>
- <unit xmlns="" Code="mol" CODE="MOL" isMetric="yes" class="si">
- <name>mole</name>
- <printSymbol>mol</printSymbol>
- <property>amount of substance</property>
- <value Unit="10*23" UNIT="10*23" value="6.0221367">6.0221367</value>
- </unit>
- <unit xmlns="" Code="sr" CODE="SR" isMetric="yes" class="si">
- <name>steradian</name>
- <printSymbol>sr</printSymbol>
- <property>solid angle</property>
- <value Unit="rad2" UNIT="RAD2" value="1">1</value>
- </unit>
- <unit xmlns="" Code="Hz" CODE="HZ" isMetric="yes" class="si">
- <name>Hertz</name>
- <printSymbol>Hz</printSymbol>
- <property>frequency</property>
- <value Unit="s-1" UNIT="S-1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="N" CODE="N" isMetric="yes" class="si">
- <name>Newton</name>
- <printSymbol>N</printSymbol>
- <property>force</property>
- <value Unit="kg.m/s2" UNIT="KG.M/S2" value="1">1</value>
- </unit>
- <unit xmlns="" Code="Pa" CODE="PAL" isMetric="yes" class="si">
- <name>Pascal</name>
- <printSymbol>Pa</printSymbol>
- <property>pressure</property>
- <value Unit="N/m2" UNIT="N/M2" value="1">1</value>
- </unit>
- <unit xmlns="" Code="J" CODE="J" isMetric="yes" class="si">
- <name>Joule</name>
- <printSymbol>J</printSymbol>
- <property>energy</property>
- <value Unit="N.m" UNIT="N.M" value="1">1</value>
- </unit>
- <unit xmlns="" Code="W" CODE="W" isMetric="yes" class="si">
- <name>Watt</name>
- <printSymbol>W</printSymbol>
- <property>power</property>
- <value Unit="J/s" UNIT="J/S" value="1">1</value>
- </unit>
- <unit xmlns="" Code="A" CODE="A" isMetric="yes" class="si">
- <name>Ampère</name>
- <printSymbol>A</printSymbol>
- <property>electric current</property>
- <value Unit="C/s" UNIT="C/S" value="1">1</value>
- </unit>
- <unit xmlns="" Code="V" CODE="V" isMetric="yes" class="si">
- <name>Volt</name>
- <printSymbol>V</printSymbol>
- <property>electric potential</property>
- <value Unit="J/C" UNIT="J/C" value="1">1</value>
- </unit>
- <unit xmlns="" Code="F" CODE="F" isMetric="yes" class="si">
- <name>Farad</name>
- <printSymbol>F</printSymbol>
- <property>electric capacitance</property>
- <value Unit="C/V" UNIT="C/V" value="1">1</value>
- </unit>
- <unit xmlns="" Code="Ohm" CODE="OHM" isMetric="yes" class="si">
- <name>Ohm</name>
- <printSymbol>Ω</printSymbol>
- <property>electric resistance</property>
- <value Unit="V/A" UNIT="V/A" value="1">1</value>
- </unit>
- <unit xmlns="" Code="S" CODE="SIE" isMetric="yes" class="si">
- <name>Siemens</name>
- <printSymbol>S</printSymbol>
- <property>electric conductance</property>
- <value Unit="Ohm-1" UNIT="OHM-1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="Wb" CODE="WB" isMetric="yes" class="si">
- <name>Weber</name>
- <printSymbol>Wb</printSymbol>
- <property>magentic flux</property>
- <value Unit="V.s" UNIT="V.S" value="1">1</value>
- </unit>
- <unit xmlns="" Code="Cel" CODE="CEL" isMetric="yes" isSpecial="yes" class="si">
- <name>degree Celsius</name>
- <printSymbol>°C</printSymbol>
- <property>temperature</property>
- <value Unit="cel(1 K)" UNIT="CEL(1 K)">
- <function name="Cel" value="1" Unit="K"/>
- </value>
- </unit>
- <unit xmlns="" Code="T" CODE="T" isMetric="yes" class="si">
- <name>Tesla</name>
- <printSymbol>T</printSymbol>
- <property>magnetic flux density</property>
- <value Unit="Wb/m2" UNIT="WB/M2" value="1">1</value>
- </unit>
- <unit xmlns="" Code="H" CODE="H" isMetric="yes" class="si">
- <name>Henry</name>
- <printSymbol>H</printSymbol>
- <property>inductance</property>
- <value Unit="Wb/A" UNIT="WB/A" value="1">1</value>
- </unit>
- <unit xmlns="" Code="lm" CODE="LM" isMetric="yes" class="si">
- <name>lumen</name>
- <printSymbol>lm</printSymbol>
- <property>luminous flux</property>
- <value Unit="cd.sr" UNIT="CD.SR" value="1">1</value>
- </unit>
- <unit xmlns="" Code="lx" CODE="LX" isMetric="yes" class="si">
- <name>lux</name>
- <printSymbol>lx</printSymbol>
- <property>illuminance</property>
- <value Unit="lm/m2" UNIT="LM/M2" value="1">1</value>
- </unit>
- <unit xmlns="" Code="Bq" CODE="BQ" isMetric="yes" class="si">
- <name>Becquerel</name>
- <printSymbol>Bq</printSymbol>
- <property>radioactivity</property>
- <value Unit="s-1" UNIT="S-1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="Gy" CODE="GY" isMetric="yes" class="si">
- <name>Gray</name>
- <printSymbol>Gy</printSymbol>
- <property>energy dose</property>
- <value Unit="J/kg" UNIT="J/KG" value="1">1</value>
- </unit>
- <unit xmlns="" Code="Sv" CODE="SV" isMetric="yes" class="si">
- <name>Sievert</name>
- <printSymbol>Sv</printSymbol>
- <property>dose equivalent</property>
- <value Unit="J/kg" UNIT="J/KG" value="1">1</value>
- </unit>
- <unit xmlns="" Code="gon" CODE="GON" isMetric="no" class="iso1000">
- <name>gon</name>
- <name>grade</name>
- <printSymbol>□<sup>g</sup>
- </printSymbol>
- <property>plane angle</property>
- <value Unit="deg" UNIT="DEG" value="0.9">0.9</value>
- </unit>
- <unit xmlns="" Code="deg" CODE="DEG" isMetric="no" class="iso1000">
- <name>degree</name>
- <printSymbol>°</printSymbol>
- <property>plane angle</property>
- <value Unit="[pi].rad/360" UNIT="[PI].RAD/360" value="2">2</value>
- </unit>
- <unit xmlns="" Code="'" CODE="'" isMetric="no" class="iso1000">
- <name>minute</name>
- <printSymbol>'</printSymbol>
- <property>plane angle</property>
- <value Unit="deg/60" UNIT="DEG/60" value="1">1</value>
- </unit>
- <unit xmlns="" Code="''" CODE="''" isMetric="no" class="iso1000">
- <name>second</name>
- <printSymbol>''</printSymbol>
- <property>plane angle</property>
- <value Unit="'/60" UNIT="'/60" value="1">1</value>
- </unit>
- <unit xmlns="" Code="l" CODE="L" isMetric="yes" class="iso1000">
- <name>liter</name>
- <printSymbol>l</printSymbol>
- <property>volume</property>
- <value Unit="dm3" UNIT="DM3" value="1">1</value>
- </unit>
- <unit xmlns="" Code="L" isMetric="yes" class="iso1000">
- <name>liter</name>
- <printSymbol>L</printSymbol>
- <property>volume</property>
- <value Unit="l" value="1">1</value>
- </unit>
- <unit xmlns="" Code="ar" CODE="AR" isMetric="yes" class="iso1000">
- <name>are</name>
- <printSymbol>a</printSymbol>
- <property>area</property>
- <value Unit="m2" UNIT="M2" value="100">100</value>
- </unit>
- <unit xmlns="" Code="min" CODE="MIN" isMetric="no" class="iso1000">
- <name>minute</name>
- <printSymbol>min</printSymbol>
- <property>time</property>
- <value Unit="s" UNIT="S" value="60">60</value>
- </unit>
- <unit xmlns="" Code="h" CODE="HR" isMetric="no" class="iso1000">
- <name>hour</name>
- <printSymbol>h</printSymbol>
- <property>time</property>
- <value Unit="min" UNIT="MIN" value="60">60</value>
- </unit>
- <unit xmlns="" Code="d" CODE="D" isMetric="no" class="iso1000">
- <name>day</name>
- <printSymbol>d</printSymbol>
- <property>time</property>
- <value Unit="h" UNIT="HR" value="24">24</value>
- </unit>
- <unit xmlns="" Code="a_t" CODE="ANN_T" isMetric="no" class="iso1000">
- <name>tropical year</name>
- <printSymbol>a<sub>t</sub>
- </printSymbol>
- <property>time</property>
- <value Unit="d" UNIT="D" value="365.24219">365.24219</value>
- </unit>
- <unit xmlns="" Code="a_j" CODE="ANN_J" isMetric="no" class="iso1000">
- <name>mean Julian year</name>
- <printSymbol>a<sub>j</sub>
- </printSymbol>
- <property>time</property>
- <value Unit="d" UNIT="D" value="365.25">365.25</value>
- </unit>
- <unit xmlns="" Code="a_g" CODE="ANN_G" isMetric="no" class="iso1000">
- <name>mean Gregorian year</name>
- <printSymbol>a<sub>g</sub>
- </printSymbol>
- <property>time</property>
- <value Unit="d" UNIT="D" value="365.2425">365.2425</value>
- </unit>
- <unit xmlns="" Code="a" CODE="ANN" isMetric="no" class="iso1000">
- <name>year</name>
- <printSymbol>a</printSymbol>
- <property>time</property>
- <value Unit="a_j" UNIT="ANN_J" value="1">1</value>
- </unit>
- <unit xmlns="" Code="wk" CODE="WK" isMetric="no" class="iso1000">
- <name>week</name>
- <printSymbol>wk</printSymbol>
- <property>time</property>
- <value Unit="d" UNIT="D" value="7">7</value>
- </unit>
- <unit xmlns="" Code="mo_s" CODE="MO_S" isMetric="no" class="iso1000">
- <name>synodal month</name>
- <printSymbol>mo<sub>s</sub>
- </printSymbol>
- <property>time</property>
- <value Unit="d" UNIT="D" value="29.53059">29.53059</value>
- </unit>
- <unit xmlns="" Code="mo_j" CODE="MO_J" isMetric="no" class="iso1000">
- <name>mean Julian month</name>
- <printSymbol>mo<sub>j</sub>
- </printSymbol>
- <property>time</property>
- <value Unit="a_j/12" UNIT="ANN_J/12" value="1">1</value>
- </unit>
- <unit xmlns="" Code="mo_g" CODE="MO_G" isMetric="no" class="iso1000">
- <name>mean Gregorian month</name>
- <printSymbol>mo<sub>g</sub>
- </printSymbol>
- <property>time</property>
- <value Unit="a_g/12" UNIT="ANN_G/12" value="1">1</value>
- </unit>
- <unit xmlns="" Code="mo" CODE="MO" isMetric="no" class="iso1000">
- <name>month</name>
- <printSymbol>mo</printSymbol>
- <property>time</property>
- <value Unit="mo_j" UNIT="MO_J" value="1">1</value>
- </unit>
- <unit xmlns="" Code="t" CODE="TNE" isMetric="yes" class="iso1000">
- <name>tonne</name>
- <printSymbol>t</printSymbol>
- <property>mass</property>
- <value Unit="kg" UNIT="KG" value="1e3">1 × 10<sup>3</sup>
- </value>
- </unit>
- <unit xmlns="" Code="bar" CODE="BAR" isMetric="yes" class="iso1000">
- <name>bar</name>
- <printSymbol>bar</printSymbol>
- <property>pressure</property>
- <value Unit="Pa" UNIT="PAL" value="1e5">1 × 10<sup>5</sup>
- </value>
- </unit>
- <unit xmlns="" Code="u" CODE="AMU" isMetric="yes" class="iso1000">
- <name>unified atomic mass unit</name>
- <printSymbol>u</printSymbol>
- <property>mass</property>
- <value Unit="g" UNIT="G" value="1.6605402e-24">1.6605402 × 10<sup>-24</sup>
- </value>
- </unit>
- <unit xmlns="" Code="eV" CODE="EV" isMetric="yes" class="iso1000">
- <name>electronvolt</name>
- <printSymbol>eV</printSymbol>
- <property>energy</property>
- <value Unit="[e].V" UNIT="[E].V" value="1">1</value>
- </unit>
- <unit xmlns="" Code="AU" CODE="ASU" isMetric="no" class="iso1000">
- <name>astronomic unit</name>
- <printSymbol>AU</printSymbol>
- <property>length</property>
- <value Unit="Mm" UNIT="MAM" value="149597.870691">149597.870691</value>
- </unit>
- <unit xmlns="" Code="pc" CODE="PRS" isMetric="yes" class="iso1000">
- <name>parsec</name>
- <printSymbol>pc</printSymbol>
- <property>length</property>
- <value Unit="m" UNIT="M" value="3.085678e16">3.085678 × 10<sup>16</sup>
- </value>
- </unit>
- <unit xmlns="" Code="[c]" CODE="[C]" isMetric="yes" class="const">
- <name>velocity of light</name>
- <printSymbol>
- <i>c</i>
- </printSymbol>
- <property>velocity</property>
- <value Unit="m/s" UNIT="M/S" value="299792458">299792458</value>
- </unit>
- <unit xmlns="" Code="[h]" CODE="[H]" isMetric="yes" class="const">
- <name>Planck constant</name>
- <printSymbol>
- <i>h</i>
- </printSymbol>
- <property>action</property>
- <value Unit="J.s" UNIT="J.S" value="6.6260755e-24">6.6260755 × 10<sup>-24</sup>
- </value>
- </unit>
- <unit xmlns="" Code="[k]" CODE="[K]" isMetric="yes" class="const">
- <name>Boltzmann constant</name>
- <printSymbol>
- <i>k</i>
- </printSymbol>
- <property>(unclassified)</property>
- <value Unit="J/K" UNIT="J/K" value="1.380658e-23">1.380658 × 10<sup>-23</sup>
- </value>
- </unit>
- <unit xmlns="" Code="[eps_0]" CODE="[EPS_0]" isMetric="yes" class="const">
- <name>permittivity of vacuum</name>
- <printSymbol>
- <i>ε<sub>
- <r>0</r>
- </sub>
- </i>
- </printSymbol>
- <property>electric permittivity</property>
- <value Unit="F/m" UNIT="F/M" value="8.854187817e-12">8.854187817 × 10<sup>-12</sup>
- </value>
- </unit>
- <unit xmlns="" Code="[mu_0]" CODE="[MU_0]" isMetric="yes" class="const">
- <name>permeability of vacuum</name>
- <printSymbol>
- <i>μ<sub>
- <r>0</r>
- </sub>
- </i>
- </printSymbol>
- <property>magnetic permeability</property>
- <value Unit="4.[pi].10*-7.N/A2" UNIT="4.[PI].10*-7.N/A2" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[e]" CODE="[E]" isMetric="yes" class="const">
- <name>elementary charge</name>
- <printSymbol>
- <i>e</i>
- </printSymbol>
- <property>electric charge</property>
- <value Unit="C" UNIT="C" value="1.60217733e-19">1.60217733 × 10<sup>-19</sup>
- </value>
- </unit>
- <unit xmlns="" Code="[m_e]" CODE="[M_E]" isMetric="yes" class="const">
- <name>electron mass</name>
- <printSymbol>
- <i>m<sub>
- <r>e</r>
- </sub>
- </i>
- </printSymbol>
- <property>mass</property>
- <value Unit="g" UNIT="g" value="9.1093897e-28">9.1093897 × 10<sup>-28</sup>
- </value>
- </unit>
- <unit xmlns="" Code="[m_p]" CODE="[M_P]" isMetric="yes" class="const">
- <name>proton mass</name>
- <printSymbol>
- <i>m<sub>
- <r>p</r>
- </sub>
- </i>
- </printSymbol>
- <property>mass</property>
- <value Unit="g" UNIT="g" value="1.6726231e-24">1.6726231 × 10<sup>-24</sup>
- </value>
- </unit>
- <unit xmlns="" Code="[G]" CODE="[GC]" isMetric="yes" class="const">
- <name>Newtonian constant of gravitation</name>
- <printSymbol>
- <i>G</i>
- </printSymbol>
- <property>(unclassified)</property>
- <value Unit="m3.kg-1.s-2" UNIT="M3.KG-1.S-2" value="6.67259e-11">6.67259 × 10<sup>-11</sup>
- </value>
- </unit>
- <unit xmlns="" Code="[g]" CODE="[G]" isMetric="yes" class="const">
- <name>standard acceleration of free fall</name>
- <printSymbol>
- <i>g<sub>n</sub>
- </i>
- </printSymbol>
- <property>acceleration</property>
- <value Unit="m/s2" UNIT="M/S2" value="980665e-5">9.80665</value>
- </unit>
- <unit xmlns="" Code="atm" CODE="ATM" isMetric="no" class="const">
- <name>standard atmosphere</name>
- <printSymbol>atm</printSymbol>
- <property>pressure</property>
- <value Unit="Pa" UNIT="PAL" value="101325">101325</value>
- </unit>
- <unit xmlns="" Code="[ly]" CODE="[LY]" isMetric="yes" class="const">
- <name>light-year</name>
- <printSymbol>l.y.</printSymbol>
- <property>length</property>
- <value Unit="[c].a_j" UNIT="[C].ANN_J" value="1">1</value>
- </unit>
- <unit xmlns="" Code="gf" CODE="GF" isMetric="yes" class="const">
- <name>gram-force</name>
- <printSymbol>gf</printSymbol>
- <property>force</property>
- <value Unit="g.[g]" UNIT="G.[G]" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[lbf_av]" CODE="[LBF_AV]" isMetric="no" class="const">
- <name>pound force</name>
- <printSymbol>lbf</printSymbol>
- <property>force</property>
- <value Unit="[lb_av].[g]" UNIT="[LB_AV].[G]" value="1">1</value>
- </unit>
- <unit xmlns="" Code="Ky" CODE="KY" isMetric="yes" class="cgs">
- <name>Kayser</name>
- <printSymbol>K</printSymbol>
- <property>lineic number</property>
- <value Unit="cm-1" UNIT="CM-1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="Gal" CODE="GL" isMetric="yes" class="cgs">
- <name>Gal</name>
- <printSymbol>Gal</printSymbol>
- <property>acceleration</property>
- <value Unit="cm/s2" UNIT="CM/S2" value="1">1</value>
- </unit>
- <unit xmlns="" Code="dyn" CODE="DYN" isMetric="yes" class="cgs">
- <name>dyne</name>
- <printSymbol>dyn</printSymbol>
- <property>force</property>
- <value Unit="g.cm/s2" UNIT="G.CM/S2" value="1">1</value>
- </unit>
- <unit xmlns="" Code="erg" CODE="ERG" isMetric="yes" class="cgs">
- <name>erg</name>
- <printSymbol>erg</printSymbol>
- <property>energy</property>
- <value Unit="dyn.cm" UNIT="DYN.CM" value="1">1</value>
- </unit>
- <unit xmlns="" Code="P" CODE="P" isMetric="yes" class="cgs">
- <name>Poise</name>
- <printSymbol>P</printSymbol>
- <property>dynamic viscosity</property>
- <value Unit="dyn.s/cm2" UNIT="DYN.S/CM2" value="1">1</value>
- </unit>
- <unit xmlns="" Code="Bi" CODE="BI" isMetric="yes" class="cgs">
- <name>Biot</name>
- <printSymbol>Bi</printSymbol>
- <property>electric current</property>
- <value Unit="A" UNIT="A" value="10">10</value>
- </unit>
- <unit xmlns="" Code="St" CODE="ST" isMetric="yes" class="cgs">
- <name>Stokes</name>
- <printSymbol>St</printSymbol>
- <property>kinematic viscosity</property>
- <value Unit="cm2/s" UNIT="CM2/S" value="1">1</value>
- </unit>
- <unit xmlns="" Code="Mx" CODE="MX" isMetric="yes" class="cgs">
- <name>Maxwell</name>
- <printSymbol>Mx</printSymbol>
- <property>flux of magnetic induction</property>
- <value Unit="Wb" UNIT="WB" value="1e-8">1 × 10<sup>-8</sup>
- </value>
- </unit>
- <unit xmlns="" Code="G" CODE="GS" isMetric="yes" class="cgs">
- <name>Gauss</name>
- <printSymbol>Gs</printSymbol>
- <property>magnetic flux density</property>
- <value Unit="T" UNIT="T" value="1e-4">1 × 10<sup>-4</sup>
- </value>
- </unit>
- <unit xmlns="" Code="Oe" CODE="OE" isMetric="yes" class="cgs">
- <name>Oersted</name>
- <printSymbol>Oe</printSymbol>
- <property>magnetic field intensity</property>
- <value Unit="/[pi].A/m" UNIT="/[PI].A/M" value="250">250</value>
- </unit>
- <unit xmlns="" Code="Gb" CODE="GB" isMetric="yes" class="cgs">
- <name>Gilbert</name>
- <printSymbol>Gb</printSymbol>
- <property>magnetic tension</property>
- <value Unit="Oe.cm" UNIT="OE.CM" value="1">1</value>
- </unit>
- <unit xmlns="" Code="sb" CODE="SB" isMetric="yes" class="cgs">
- <name>stilb</name>
- <printSymbol>sb</printSymbol>
- <property>lum. intensity density</property>
- <value Unit="cd/cm2" UNIT="CD/CM2" value="1">1</value>
- </unit>
- <unit xmlns="" Code="Lmb" CODE="LMB" isMetric="yes" class="cgs">
- <name>Lambert</name>
- <printSymbol>L</printSymbol>
- <property>brightness</property>
- <value Unit="cd/cm2/[pi]" UNIT="CD/CM2/[PI]" value="1">1</value>
- </unit>
- <unit xmlns="" Code="ph" CODE="PHT" isMetric="yes" class="cgs">
- <name>phot</name>
- <printSymbol>ph</printSymbol>
- <property>illuminance</property>
- <value Unit="lx" UNIT="LX" value="1e-4">1 × 10<sup>-4</sup>
- </value>
- </unit>
- <unit xmlns="" Code="Ci" CODE="CI" isMetric="yes" class="cgs">
- <name>Curie</name>
- <printSymbol>Ci</printSymbol>
- <property>radioactivity</property>
- <value Unit="Bq" UNIT="BQ" value="37e9">3.7 × 10<sup>10</sup>
- </value>
- </unit>
- <unit xmlns="" Code="R" CODE="ROE" isMetric="yes" class="cgs">
- <name>Roentgen</name>
- <printSymbol>R</printSymbol>
- <property>ion dose</property>
- <value Unit="C/kg" UNIT="C/KG" value="2.58e-4">2.58 × 10<sup>-4</sup>
- </value>
- </unit>
- <unit xmlns="" Code="RAD" CODE="[RAD]" isMetric="yes" class="cgs">
- <name>radiation absorbed dose</name>
- <printSymbol>RAD</printSymbol>
- <property>energy dose</property>
- <value Unit="erg/g" UNIT="ERG/G" value="100">100</value>
- </unit>
- <unit xmlns="" Code="REM" CODE="[REM]" isMetric="yes" class="cgs">
- <name>radiation equivalent man</name>
- <printSymbol>REM</printSymbol>
- <property>dose equivalent</property>
- <value Unit="RAD" UNIT="[RAD]" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[in_i]" CODE="[IN_I]" isMetric="no" class="intcust">
- <name>inch</name>
- <printSymbol>in</printSymbol>
- <property>length</property>
- <value Unit="cm" UNIT="CM" value="254e-2">2.54</value>
- </unit>
- <unit xmlns="" Code="[ft_i]" CODE="[FT_I]" isMetric="no" class="intcust">
- <name>foot</name>
- <printSymbol>ft</printSymbol>
- <property>length</property>
- <value Unit="[in_i]" UNIT="[IN_I]" value="12">12</value>
- </unit>
- <unit xmlns="" Code="[yd_i]" CODE="[YD_I]" isMetric="no" class="intcust">
- <name>yard</name>
- <printSymbol>yd</printSymbol>
- <property>length</property>
- <value Unit="[ft_i]" UNIT="[FT_I]" value="3">3</value>
- </unit>
- <unit xmlns="" Code="[mi_i]" CODE="[MI_I]" isMetric="no" class="intcust">
- <name>statute mile</name>
- <printSymbol>mi</printSymbol>
- <property>length</property>
- <value Unit="[ft_i]" UNIT="[FT_I]" value="5280">5280</value>
- </unit>
- <unit xmlns="" Code="[fth_i]" CODE="[FTH_I]" isMetric="no" class="intcust">
- <name>fathom</name>
- <printSymbol>fth</printSymbol>
- <property>depth of water</property>
- <value Unit="[ft_i]" UNIT="[FT_I]" value="6">6</value>
- </unit>
- <unit xmlns="" Code="[nmi_i]" CODE="[NMI_I]" isMetric="no" class="intcust">
- <name>nautical mile</name>
- <printSymbol>n.mi</printSymbol>
- <property>length</property>
- <value Unit="m" UNIT="M" value="1852">1852</value>
- </unit>
- <unit xmlns="" Code="[kn_i]" CODE="[KN_I]" isMetric="no" class="intcust">
- <name>knot</name>
- <printSymbol>knot</printSymbol>
- <property>velocity</property>
- <value Unit="[nmi_i]/h" UNIT="[NMI_I]/H" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[sin_i]" CODE="[SIN_I]" isMetric="no" class="intcust">
- <name>square inch</name>
- <property>area</property>
- <value Unit="[in_i]2" UNIT="[IN_I]2" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[sft_i]" CODE="[SFT_I]" isMetric="no" class="intcust">
- <name>square foot</name>
- <property>area</property>
- <value Unit="[ft_i]2" UNIT="[FT_I]2" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[syd_i]" CODE="[SYD_I]" isMetric="no" class="intcust">
- <name>square yard</name>
- <property>area</property>
- <value Unit="[yd_i]2" UNIT="[YD_I]2" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[cin_i]" CODE="[CIN_I]" isMetric="no" class="intcust">
- <name>cubic inch</name>
- <property>volume</property>
- <value Unit="[in_i]3" UNIT="[IN_I]3" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[cft_i]" CODE="[CFT_I]" isMetric="no" class="intcust">
- <name>cubic foot</name>
- <property>volume</property>
- <value Unit="[ft_i]3" UNIT="[FT_I]3" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[cyd_i]" CODE="[CYD_I]" isMetric="no" class="intcust">
- <name>cubic yard</name>
- <printSymbol>cu.yd</printSymbol>
- <property>volume</property>
- <value Unit="[yd_i]3" UNIT="[YD_I]3" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[bf_i]" CODE="[BF_I]" isMetric="no" class="intcust">
- <name>board foot</name>
- <property>volume</property>
- <value Unit="[in_i]3" UNIT="[IN_I]3" value="144">144</value>
- </unit>
- <unit xmlns="" Code="[cr_i]" CODE="[CR_I]" isMetric="no" class="intcust">
- <name>cord</name>
- <property>volume</property>
- <value Unit="[ft_i]3" UNIT="[FT_I]3" value="128">128</value>
- </unit>
- <unit xmlns="" Code="[mil_i]" CODE="[MIL_I]" isMetric="no" class="intcust">
- <name>mil</name>
- <printSymbol>mil</printSymbol>
- <property>length</property>
- <value Unit="[in_i]" UNIT="[IN_I]" value="1e-3">1 × 10<sup>-3</sup>
- </value>
- </unit>
- <unit xmlns="" Code="[cml_i]" CODE="[CML_I]" isMetric="no" class="intcust">
- <name>circular mil</name>
- <printSymbol>circ.mil</printSymbol>
- <property>area</property>
- <value Unit="[pi]/4.[mil_i]2" UNIT="[PI]/4.[MIL_I]2" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[hd_i]" CODE="[HD_I]" isMetric="no" class="intcust">
- <name>hand</name>
- <printSymbol>hd</printSymbol>
- <property>height of horses</property>
- <value Unit="[in_i]" UNIT="[IN_I]" value="4">4</value>
- </unit>
- <unit xmlns="" Code="[ft_us]" CODE="[FT_US]" isMetric="no" class="us-lengths">
- <name>foot</name>
- <printSymbol>ft<sub>us</sub>
- </printSymbol>
- <property>length</property>
- <value Unit="m/3937" UNIT="M/3937" value="1200">1200</value>
- </unit>
- <unit xmlns="" Code="[yd_us]" CODE="[YD_US]" isMetric="no" class="us-lengths">
- <name>yard</name>
- <property>length</property>
- <value Unit="[ft_us]" UNIT="[FT_US]" value="3">3</value>
- </unit>
- <unit xmlns="" Code="[in_us]" CODE="[IN_US]" isMetric="no" class="us-lengths">
- <name>inch</name>
- <property>length</property>
- <value Unit="[ft_us]/12" UNIT="[FT_US]/12" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[rd_us]" CODE="[RD_US]" isMetric="no" class="us-lengths">
- <name>rod</name>
- <property>length</property>
- <value Unit="[ft_us]" UNIT="[FT_US]" value="16.5">16.5</value>
- </unit>
- <unit xmlns="" Code="[ch_us]" CODE="[CH_US]" isMetric="no" class="us-lengths">
- <name>Gunter's chain</name>
- <name>Surveyor's chain</name>
- <property>length</property>
- <value Unit="[rd_us]" UNIT="[RD_US]" value="4">4</value>
- </unit>
- <unit xmlns="" Code="[lk_us]" CODE="[LK_US]" isMetric="no" class="us-lengths">
- <name>link for Gunter's chain</name>
- <property>length</property>
- <value Unit="[ch_us]/100" UNIT="[CH_US]/100" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[rch_us]" CODE="[RCH_US]" isMetric="no" class="us-lengths">
- <name>Ramden's chain</name>
- <name>Engineer's chain</name>
- <property>length</property>
- <value Unit="[ft_us]" UNIT="[FT_US]" value="100">100</value>
- </unit>
- <unit xmlns="" Code="[rlk_us]" CODE="[RLK_US]" isMetric="no" class="us-lengths">
- <name>link for Ramden's chain</name>
- <property>length</property>
- <value Unit="[rch_us]/100" UNIT="[RCH_US]/100" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[fth_us]" CODE="[FTH_US]" isMetric="no" class="us-lengths">
- <name>fathom</name>
- <property>length</property>
- <value Unit="[ft_us]" UNIT="[FT_US]" value="6">6</value>
- </unit>
- <unit xmlns="" Code="[fur_us]" CODE="[FUR_US]" isMetric="no" class="us-lengths">
- <name>furlong</name>
- <property>length</property>
- <value Unit="[rd_us]" UNIT="[RD_US]" value="40">40</value>
- </unit>
- <unit xmlns="" Code="[mi_us]" CODE="[MI_US]" isMetric="no" class="us-lengths">
- <name>mile</name>
- <property>length</property>
- <value Unit="[fur_us]" UNIT="[FUR_US]" value="8">8</value>
- </unit>
- <unit xmlns="" Code="[acr_us]" CODE="[ACR_US]" isMetric="no" class="us-lengths">
- <name>acre</name>
- <property>area</property>
- <value Unit="[rd_us]2" UNIT="[RD_US]2" value="160">160</value>
- </unit>
- <unit xmlns="" Code="[srd_us]" CODE="[SRD_US]" isMetric="no" class="us-lengths">
- <name>square rod</name>
- <property>area</property>
- <value Unit="[rd_us]2" UNIT="[RD_US]2" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[smi_us]" CODE="[SMI_US]" isMetric="no" class="us-lengths">
- <name>square mile</name>
- <property>area</property>
- <value Unit="[mi_us]2" UNIT="[MI_US]2" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[sct]" CODE="[SCT]" isMetric="no" class="us-lengths">
- <name>section</name>
- <property>area</property>
- <value Unit="[mi_us]2" UNIT="[MI_US]2" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[twp]" CODE="[TWP]" isMetric="no" class="us-lengths">
- <name>township</name>
- <property>area</property>
- <value Unit="[sct]" UNIT="[SCT]" value="36">36</value>
- </unit>
- <unit xmlns="" Code="[mil_us]" CODE="[MIL_US]" isMetric="no" class="us-lengths">
- <name>mil</name>
- <property>length</property>
- <value Unit="[in_us]" UNIT="[IN_US]" value="1e-3">1 × 10<sup>-3</sup>
- </value>
- </unit>
- <unit xmlns="" Code="[in_br]" CODE="[IN_BR]" isMetric="no" class="brit-length">
- <name>inch</name>
- <property>length</property>
- <value Unit="cm" UNIT="CM" value="2.539998">2.539998</value>
- </unit>
- <unit xmlns="" Code="[ft_br]" CODE="[FT_BR]" isMetric="no" class="brit-length">
- <name>foot</name>
- <property>length</property>
- <value Unit="[in_br]" UNIT="[IN_BR]" value="12">12</value>
- </unit>
- <unit xmlns="" Code="[rd_br]" CODE="[RD_BR]" isMetric="no" class="brit-length">
- <name>rod</name>
- <property>length</property>
- <value Unit="[ft_br]" UNIT="[FT_BR]" value="16.5">16.5</value>
- </unit>
- <unit xmlns="" Code="[ch_br]" CODE="[CH_BR]" isMetric="no" class="brit-length">
- <name>Gunter's chain</name>
- <property>length</property>
- <value Unit="[rd_br]" UNIT="[RD_BR]" value="4">4</value>
- </unit>
- <unit xmlns="" Code="[lk_br]" CODE="[LK_BR]" isMetric="no" class="brit-length">
- <name>link for Gunter's chain</name>
- <property>length</property>
- <value Unit="[ch_br]/100" UNIT="[CH_BR]/100" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[fth_br]" CODE="[FTH_BR]" isMetric="no" class="brit-length">
- <name>fathom</name>
- <property>length</property>
- <value Unit="[ft_br]" UNIT="[FT_BR]" value="6">6</value>
- </unit>
- <unit xmlns="" Code="[pc_br]" CODE="[PC_BR]" isMetric="no" class="brit-length">
- <name>pace</name>
- <property>length</property>
- <value Unit="[ft_br]" UNIT="[FT_BR]" value="2.5">2.5</value>
- </unit>
- <unit xmlns="" Code="[yd_br]" CODE="[YD_BR]" isMetric="no" class="brit-length">
- <name>yard</name>
- <property>length</property>
- <value Unit="[ft_br]" UNIT="[FT_BR]" value="3">3</value>
- </unit>
- <unit xmlns="" Code="[mi_br]" CODE="[MI_BR]" isMetric="no" class="brit-length">
- <name>mile</name>
- <property>length</property>
- <value Unit="[ft_br]" UNIT="[FT_BR]" value="5280">5280</value>
- </unit>
- <unit xmlns="" Code="[nmi_br]" CODE="[NMI_BR]" isMetric="no" class="brit-length">
- <name>nautical mile</name>
- <property>length</property>
- <value Unit="[ft_br]" UNIT="[FT_BR]" value="6080">6080</value>
- </unit>
- <unit xmlns="" Code="[kn_br]" CODE="[KN_BR]" isMetric="no" class="brit-length">
- <name>knot</name>
- <property>velocity</property>
- <value Unit="[nmi_br]/h" UNIT="[NMI_BR]/H" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[acr_br]" CODE="[ACR_BR]" isMetric="no" class="brit-length">
- <name>acre</name>
- <property>area</property>
- <value Unit="[yd_br]2" UNIT="[YD_BR]2" value="4840">4840</value>
- </unit>
- <unit xmlns="" Code="[gal_us]" CODE="[GAL_US]" isMetric="no" class="us-volumes">
- <name>Queen Anne's wine gallon</name>
- <property>fluid volume</property>
- <value Unit="[in_i]3" UNIT="[IN_I]3" value="231">231</value>
- </unit>
- <unit xmlns="" Code="[bbl_us]" CODE="[BBL_US]" isMetric="no" class="us-volumes">
- <name>barrel</name>
- <property>fluid volume</property>
- <value Unit="[gal_us]" UNIT="[GAL_US]" value="42">42</value>
- </unit>
- <unit xmlns="" Code="[qt_us]" CODE="[QT_US]" isMetric="no" class="us-volumes">
- <name>quart</name>
- <property>fluid volume</property>
- <value Unit="[gal_us]/4" UNIT="[GAL_US]/4" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[pt_us]" CODE="[PT_US]" isMetric="no" class="us-volumes">
- <name>pint</name>
- <property>fluid volume</property>
- <value Unit="[qt_us]/2" UNIT="[QT_US]/2" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[gil_us]" CODE="[GIL_US]" isMetric="no" class="us-volumes">
- <name>gill</name>
- <property>fluid volume</property>
- <value Unit="[pt_us]/4" UNIT="[PT_US]/4" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[foz_us]" CODE="[FOZ_US]" isMetric="no" class="us-volumes">
- <name>fluid ounce</name>
- <printSymbol>oz fl</printSymbol>
- <property>fluid volume</property>
- <value Unit="[gil_us]/4" UNIT="[GIL_US]/4" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[fdr_us]" CODE="[FDR_US]" isMetric="no" class="us-volumes">
- <name>fluid dram</name>
- <property>fluid volume</property>
- <value Unit="[foz_us]/8" UNIT="[FOZ_US]/8" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[min_us]" CODE="[MIN_US]" isMetric="no" class="us-volumes">
- <name>minim</name>
- <property>fluid volume</property>
- <value Unit="[fdr_us]/60" UNIT="[FDR_US]/60" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[crd_us]" CODE="[CRD_US]" isMetric="no" class="us-volumes">
- <name>cord</name>
- <property>fluid volume</property>
- <value Unit="[ft_i]3" UNIT="[FT_I]3" value="128">128</value>
- </unit>
- <unit xmlns="" Code="[bu_us]" CODE="[BU_US]" isMetric="no" class="us-volumes">
- <name>bushel</name>
- <property>dry volume</property>
- <value Unit="[in_i]3" UNIT="[IN_I]3" value="2150.42">2150.42</value>
- </unit>
- <unit xmlns="" Code="[gal_wi]" CODE="[GAL_WI]" isMetric="no" class="us-volumes">
- <name>historical winchester gallon</name>
- <property>dry volume</property>
- <value Unit="[bu_us]/8" UNIT="[BU_US]/8" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[pk_us]" CODE="[PK_US]" isMetric="no" class="us-volumes">
- <name>peck</name>
- <property>dry volume</property>
- <value Unit="[bu_us]/4" UNIT="[BU_US]/4" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[dqt_us]" CODE="[DQT_US]" isMetric="no" class="us-volumes">
- <name>dry quart</name>
- <property>dry volume</property>
- <value Unit="[pk_us]/8" UNIT="[PK_US]/8" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[dpt_us]" CODE="[DPT_US]" isMetric="no" class="us-volumes">
- <name>dry pint</name>
- <property>dry volume</property>
- <value Unit="[dqt_us]/2" UNIT="[DQT_US]/2" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[tbs_us]" CODE="[TBS_US]" isMetric="no" class="us-volumes">
- <name>tablespoon</name>
- <property>volume</property>
- <value Unit="[foz_us]/2" UNIT="[FOZ_US]/2" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[tsp_us]" CODE="[TSP_US]" isMetric="no" class="us-volumes">
- <name>teaspoon</name>
- <property>volume</property>
- <value Unit="[tbs_us]/3" UNIT="[TBS_US]/3" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[cup_us]" CODE="[CUP_US]" isMetric="no" class="us-volumes">
- <name>cup</name>
- <property>volume</property>
- <value Unit="[tbs_us]" UNIT="[TBS_US]" value="16">16</value>
- </unit>
- <unit xmlns="" Code="[foz_m]" CODE="[FOZ_M]" isMetric="no" class="us-volumes">
- <name>metric fluid ounce</name>
- <printSymbol>oz fl</printSymbol>
- <property>fluid volume</property>
- <value Unit="mL" UNIT="ML" value="30">30</value>
- </unit>
- <unit xmlns="" Code="[cup_m]" CODE="[CUP_M]" isMetric="no" class="us-volumes">
- <name>metric cup</name>
- <property>volume</property>
- <value Unit="mL" UNIT="ML" value="240">240</value>
- </unit>
- <unit xmlns="" Code="[tsp_m]" CODE="[TSP_M]" isMetric="no" class="us-volumes">
- <name>metric teaspoon</name>
- <property>volume</property>
- <value Unit="mL" UNIT="mL" value="5">5</value>
- </unit>
- <unit xmlns="" Code="[tbs_m]" CODE="[TBS_M]" isMetric="no" class="us-volumes">
- <name>metric tablespoon</name>
- <property>volume</property>
- <value Unit="mL" UNIT="mL" value="15">15</value>
- </unit>
- <unit xmlns="" Code="[gal_br]" CODE="[GAL_BR]" isMetric="no" class="brit-volumes">
- <name>gallon</name>
- <property>volume</property>
- <value Unit="l" UNIT="L" value="4.54609">4.54609</value>
- </unit>
- <unit xmlns="" Code="[pk_br]" CODE="[PK_BR]" isMetric="no" class="brit-volumes">
- <name>peck</name>
- <property>volume</property>
- <value Unit="[gal_br]" UNIT="[GAL_BR]" value="2">2</value>
- </unit>
- <unit xmlns="" Code="[bu_br]" CODE="[BU_BR]" isMetric="no" class="brit-volumes">
- <name>bushel</name>
- <property>volume</property>
- <value Unit="[pk_br]" UNIT="[PK_BR]" value="4">4</value>
- </unit>
- <unit xmlns="" Code="[qt_br]" CODE="[QT_BR]" isMetric="no" class="brit-volumes">
- <name>quart</name>
- <property>volume</property>
- <value Unit="[gal_br]/4" UNIT="[GAL_BR]/4" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[pt_br]" CODE="[PT_BR]" isMetric="no" class="brit-volumes">
- <name>pint</name>
- <property>volume</property>
- <value Unit="[qt_br]/2" UNIT="[QT_BR]/2" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[gil_br]" CODE="[GIL_BR]" isMetric="no" class="brit-volumes">
- <name>gill</name>
- <property>volume</property>
- <value Unit="[pt_br]/4" UNIT="[PT_BR]/4" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[foz_br]" CODE="[FOZ_BR]" isMetric="no" class="brit-volumes">
- <name>fluid ounce</name>
- <property>volume</property>
- <value Unit="[gil_br]/5" UNIT="[GIL_BR]/5" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[fdr_br]" CODE="[FDR_BR]" isMetric="no" class="brit-volumes">
- <name>fluid dram</name>
- <property>volume</property>
- <value Unit="[foz_br]/8" UNIT="[FOZ_BR]/8" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[min_br]" CODE="[MIN_BR]" isMetric="no" class="brit-volumes">
- <name>minim</name>
- <property>volume</property>
- <value Unit="[fdr_br]/60" UNIT="[FDR_BR]/60" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[gr]" CODE="[GR]" isMetric="no" class="avoirdupois">
- <name>grain</name>
- <property>mass</property>
- <value Unit="mg" UNIT="MG" value="64.79891">64.79891</value>
- </unit>
- <unit xmlns="" Code="[lb_av]" CODE="[LB_AV]" isMetric="no" class="avoirdupois">
- <name>pound</name>
- <printSymbol>lb</printSymbol>
- <property>mass</property>
- <value Unit="[gr]" UNIT="[GR]" value="7000">7000</value>
- </unit>
- <unit xmlns="" Code="[oz_av]" CODE="[OZ_AV]" isMetric="no" class="avoirdupois">
- <name>ounce</name>
- <printSymbol>oz</printSymbol>
- <property>mass</property>
- <value Unit="[lb_av]/16" UNIT="[LB_AV]/16" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[dr_av]" CODE="[DR_AV]" isMetric="no" class="avoirdupois">
- <name>dram</name>
- <property>mass</property>
- <value Unit="[oz_av]/16" UNIT="[OZ_AV]/16" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[scwt_av]" CODE="[SCWT_AV]" isMetric="no" class="avoirdupois">
- <name>short hundredweight</name>
- <name>U.S. hundredweight</name>
- <property>mass</property>
- <value Unit="[lb_av]" UNIT="[LB_AV]" value="100">100</value>
- </unit>
- <unit xmlns="" Code="[lcwt_av]" CODE="[LCWT_AV]" isMetric="no" class="avoirdupois">
- <name>long hunderdweight</name>
- <name>British hundredweight</name>
- <property>mass</property>
- <value Unit="[lb_av]" UNIT="[LB_AV]" value="112">112</value>
- </unit>
- <unit xmlns="" Code="[ston_av]" CODE="[STON_AV]" isMetric="no" class="avoirdupois">
- <name>short ton</name>
- <name>U.S. ton</name>
- <property>mass</property>
- <value Unit="[scwt_av]" UNIT="[SCWT_AV]" value="20">20</value>
- </unit>
- <unit xmlns="" Code="[lton_av]" CODE="[LTON_AV]" isMetric="no" class="avoirdupois">
- <name>long ton</name>
- <name>British ton</name>
- <property>mass</property>
- <value Unit="[lcwt_av]" UNIT="[LCWT_AV]" value="20">20</value>
- </unit>
- <unit xmlns="" Code="[stone_av]" CODE="[STONE_AV]" isMetric="no" class="avoirdupois">
- <name>stone</name>
- <name>British stone</name>
- <property>mass</property>
- <value Unit="[lb_av]" UNIT="[LB_AV]" value="14">14</value>
- </unit>
- <unit xmlns="" Code="[pwt_tr]" CODE="[PWT_TR]" isMetric="no" class="troy">
- <name>pennyweight</name>
- <property>mass</property>
- <value Unit="[gr]" UNIT="[GR]" value="24">24</value>
- </unit>
- <unit xmlns="" Code="[oz_tr]" CODE="[OZ_TR]" isMetric="no" class="troy">
- <name>ounce</name>
- <property>mass</property>
- <value Unit="[pwt_tr]" UNIT="[PWT_TR]" value="20">20</value>
- </unit>
- <unit xmlns="" Code="[lb_tr]" CODE="[LB_TR]" isMetric="no" class="troy">
- <name>pound</name>
- <property>mass</property>
- <value Unit="[oz_tr]" UNIT="[OZ_TR]" value="12">12</value>
- </unit>
- <unit xmlns="" Code="[sc_ap]" CODE="[SC_AP]" isMetric="no" class="apoth">
- <name>scruple</name>
- <property>mass</property>
- <value Unit="[gr]" UNIT="[GR]" value="20">20</value>
- </unit>
- <unit xmlns="" Code="[dr_ap]" CODE="[DR_AP]" isMetric="no" class="apoth">
- <name>dram</name>
- <name>drachm</name>
- <property>mass</property>
- <value Unit="[sc_ap]" UNIT="[SC_AP]" value="3">3</value>
- </unit>
- <unit xmlns="" Code="[oz_ap]" CODE="[OZ_AP]" isMetric="no" class="apoth">
- <name>ounce</name>
- <property>mass</property>
- <value Unit="[dr_ap]" UNIT="[DR_AP]" value="8">8</value>
- </unit>
- <unit xmlns="" Code="[lb_ap]" CODE="[LB_AP]" isMetric="no" class="apoth">
- <name>pound</name>
- <property>mass</property>
- <value Unit="[oz_ap]" UNIT="[OZ_AP]" value="12">12</value>
- </unit>
- <unit xmlns="" Code="[oz_m]" CODE="[OZ_M]" isMetric="no" class="apoth">
- <name>metric ounce</name>
- <property>mass</property>
- <value Unit="g" UNIT="g" value="28">28</value>
- </unit>
- <unit xmlns="" Code="[lne]" CODE="[LNE]" isMetric="no" class="typeset">
- <name>line</name>
- <property>length</property>
- <value Unit="[in_i]/12" UNIT="[IN_I]/12" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[pnt]" CODE="[PNT]" isMetric="no" class="typeset">
- <name>point</name>
- <property>length</property>
- <value Unit="[lne]/6" UNIT="[LNE]/6" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[pca]" CODE="[PCA]" isMetric="no" class="typeset">
- <name>pica</name>
- <property>length</property>
- <value Unit="[pnt]" UNIT="[PNT]" value="12">12</value>
- </unit>
- <unit xmlns="" Code="[pnt_pr]" CODE="[PNT_PR]" isMetric="no" class="typeset">
- <name>Printer's point</name>
- <property>length</property>
- <value Unit="[in_i]" UNIT="[IN_I]" value="0.013837">0.013837</value>
- </unit>
- <unit xmlns="" Code="[pca_pr]" CODE="[PCA_PR]" isMetric="no" class="typeset">
- <name>Printer's pica</name>
- <property>length</property>
- <value Unit="[pnt_pr]" UNIT="[PNT_PR]" value="12">12</value>
- </unit>
- <unit xmlns="" Code="[pied]" CODE="[PIED]" isMetric="no" class="typeset">
- <name>pied</name>
- <name>French foot</name>
- <property>length</property>
- <value Unit="cm" UNIT="CM" value="32.48">32.48</value>
- </unit>
- <unit xmlns="" Code="[pouce]" CODE="[POUCE]" isMetric="no" class="typeset">
- <name>pouce</name>
- <name>French inch</name>
- <property>length</property>
- <value Unit="[pied]/12" UNIT="[PIED]/12" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[ligne]" CODE="[LIGNE]" isMetric="no" class="typeset">
- <name>ligne</name>
- <name>French line</name>
- <property>length</property>
- <value Unit="[pouce]/12" UNIT="[POUCE]/12" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[didot]" CODE="[DIDOT]" isMetric="no" class="typeset">
- <name>didot</name>
- <name>Didot's point</name>
- <property>length</property>
- <value Unit="[ligne]/6" UNIT="[LIGNE]/6" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[cicero]" CODE="[CICERO]" isMetric="no" class="typeset">
- <name>cicero</name>
- <name>Didot's pica</name>
- <property>length</property>
- <value Unit="[didot]" UNIT="[DIDOT]" value="12">12</value>
- </unit>
- <unit xmlns="" Code="[degF]" CODE="[DEGF]" isMetric="no" isSpecial="yes" class="heat">
- <name>degree Fahrenheit</name>
- <printSymbol>°F</printSymbol>
- <property>temperature</property>
- <value Unit="degf(5 K/9)" UNIT="DEGF(5 K/9)">
- <function name="degF" value="5" Unit="K/9"/>
- </value>
- </unit>
- <unit xmlns="" Code="[degR]" CODE="[degR]" isMetric="no" class="heat">
- <name>degree Rankine</name>
- <printSymbol>°R</printSymbol>
- <property>temperature</property>
- <value value="5" Unit="K/9" UNIT="K/9">5</value>
- </unit>
- <unit xmlns="" Code="cal_[15]" CODE="CAL_[15]" isMetric="yes" class="heat">
- <name>calorie at 15 °C</name>
- <printSymbol>cal<sub>15°C</sub>
- </printSymbol>
- <property>energy</property>
- <value Unit="J" UNIT="J" value="4.18580">4.18580</value>
- </unit>
- <unit xmlns="" Code="cal_[20]" CODE="CAL_[20]" isMetric="yes" class="heat">
- <name>calorie at 20 °C</name>
- <printSymbol>cal<sub>20°C</sub>
- </printSymbol>
- <property>energy</property>
- <value Unit="J" UNIT="J" value="4.18190">4.18190</value>
- </unit>
- <unit xmlns="" Code="cal_m" CODE="CAL_M" isMetric="yes" class="heat">
- <name>mean calorie</name>
- <printSymbol>cal<sub>m</sub>
- </printSymbol>
- <property>energy</property>
- <value Unit="J" UNIT="J" value="4.19002">4.19002</value>
- </unit>
- <unit xmlns="" Code="cal_IT" CODE="CAL_IT" isMetric="yes" class="heat">
- <name>international table calorie</name>
- <printSymbol>cal<sub>IT</sub>
- </printSymbol>
- <property>energy</property>
- <value Unit="J" UNIT="J" value="4.1868">4.1868</value>
- </unit>
- <unit xmlns="" Code="cal_th" CODE="CAL_TH" isMetric="yes" class="heat">
- <name>thermochemical calorie</name>
- <printSymbol>cal<sub>th</sub>
- </printSymbol>
- <property>energy</property>
- <value Unit="J" UNIT="J" value="4.184">4.184</value>
- </unit>
- <unit xmlns="" Code="cal" CODE="CAL" isMetric="yes" class="heat">
- <name>calorie</name>
- <printSymbol>cal</printSymbol>
- <property>energy</property>
- <value Unit="cal_th" UNIT="CAL_TH" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[Cal]" CODE="[CAL]" isMetric="no" class="heat">
- <name>nutrition label Calories</name>
- <printSymbol>Cal</printSymbol>
- <property>energy</property>
- <value Unit="kcal_th" UNIT="KCAL_TH" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[Btu_39]" CODE="[BTU_39]" isMetric="no" class="heat">
- <name>British thermal unit at 39 °F</name>
- <printSymbol>Btu<sub>39°F</sub>
- </printSymbol>
- <property>energy</property>
- <value Unit="kJ" UNIT="kJ" value="1.05967">1.05967</value>
- </unit>
- <unit xmlns="" Code="[Btu_59]" CODE="[BTU_59]" isMetric="no" class="heat">
- <name>British thermal unit at 59 °F</name>
- <printSymbol>Btu<sub>59°F</sub>
- </printSymbol>
- <property>energy</property>
- <value Unit="kJ" UNIT="kJ" value="1.05480">1.05480</value>
- </unit>
- <unit xmlns="" Code="[Btu_60]" CODE="[BTU_60]" isMetric="no" class="heat">
- <name>British thermal unit at 60 °F</name>
- <printSymbol>Btu<sub>60°F</sub>
- </printSymbol>
- <property>energy</property>
- <value Unit="kJ" UNIT="kJ" value="1.05468">1.05468</value>
- </unit>
- <unit xmlns="" Code="[Btu_m]" CODE="[BTU_M]" isMetric="no" class="heat">
- <name>mean British thermal unit</name>
- <printSymbol>Btu<sub>m</sub>
- </printSymbol>
- <property>energy</property>
- <value Unit="kJ" UNIT="kJ" value="1.05587">1.05587</value>
- </unit>
- <unit xmlns="" Code="[Btu_IT]" CODE="[BTU_IT]" isMetric="no" class="heat">
- <name>international table British thermal unit</name>
- <printSymbol>Btu<sub>IT</sub>
- </printSymbol>
- <property>energy</property>
- <value Unit="kJ" UNIT="kJ" value="1.05505585262">1.05505585262</value>
- </unit>
- <unit xmlns="" Code="[Btu_th]" CODE="[BTU_TH]" isMetric="no" class="heat">
- <name>thermochemical British thermal unit</name>
- <printSymbol>Btu<sub>th</sub>
- </printSymbol>
- <property>energy</property>
- <value Unit="kJ" UNIT="kJ" value="1.054350">1.054350</value>
- </unit>
- <unit xmlns="" Code="[Btu]" CODE="[BTU]" isMetric="no" class="heat">
- <name>British thermal unit</name>
- <printSymbol>btu</printSymbol>
- <property>energy</property>
- <value Unit="[Btu_th]" UNIT="[BTU_TH]" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[HP]" CODE="[HP]" isMetric="no" class="heat">
- <name>horsepower</name>
- <property>power</property>
- <value Unit="[ft_i].[lbf_av]/s" UNIT="[FT_I].[LBF_AV]/S" value="550">550</value>
- </unit>
- <unit xmlns="" Code="tex" CODE="TEX" isMetric="yes" class="heat">
- <name>tex</name>
- <printSymbol>tex</printSymbol>
- <property>linear mass density (of textile thread)</property>
- <value value="1" Unit="g/km" UNIT="G/KM">1</value>
- </unit>
- <unit xmlns="" Code="[den]" CODE="[DEN]" isMetric="no" class="heat">
- <name>Denier</name>
- <printSymbol>den</printSymbol>
- <property>linear mass density (of textile thread)</property>
- <value value="1" Unit="g/9/km" UNIT="G/9/KM">1</value>
- </unit>
- <unit xmlns="" Code="m[H2O]" CODE="M[H2O]" isMetric="yes" class="clinical">
- <name>meter of water column</name>
- <printSymbol>m H<sub>
- <r>2</r>
- </sub>O</printSymbol>
- <property>pressure</property>
- <value Unit="kPa" UNIT="KPAL" value="980665e-5">9.80665</value>
- </unit>
- <unit xmlns="" Code="m[Hg]" CODE="M[HG]" isMetric="yes" class="clinical">
- <name>meter of mercury column</name>
- <printSymbol>m Hg</printSymbol>
- <property>pressure</property>
- <value Unit="kPa" UNIT="KPAL" value="133.3220">133.3220</value>
- </unit>
- <unit xmlns="" Code="[in_i'H2O]" CODE="[IN_I'H2O]" isMetric="no" class="clinical">
- <name>inch of water column</name>
- <printSymbol>in H<sub>
- <r>2</r>
- </sub>O</printSymbol>
- <property>pressure</property>
- <value Unit="m[H2O].[in_i]/m" UNIT="M[H2O].[IN_I]/M" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[in_i'Hg]" CODE="[IN_I'HG]" isMetric="no" class="clinical">
- <name>inch of mercury column</name>
- <printSymbol>in Hg</printSymbol>
- <property>pressure</property>
- <value Unit="m[Hg].[in_i]/m" UNIT="M[HG].[IN_I]/M" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[PRU]" CODE="[PRU]" isMetric="no" class="clinical">
- <name>peripheral vascular resistance unit</name>
- <printSymbol>P.R.U.</printSymbol>
- <property>fluid resistance</property>
- <value Unit="mm[Hg].s/ml" UNIT="MM[HG].S/ML" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[wood'U]" CODE="[WOOD'U]" isMetric="no" class="clinical">
- <name>Wood unit</name>
- <printSymbol>Wood U.</printSymbol>
- <property>fluid resistance</property>
- <value Unit="mm[Hg].min/L" UNIT="MM[HG].MIN/L" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[diop]" CODE="[DIOP]" isMetric="no" class="clinical">
- <name>diopter</name>
- <printSymbol>dpt</printSymbol>
- <property>refraction of a lens</property>
- <value Unit="/m" UNIT="/M" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[p'diop]" CODE="[P'DIOP]" isMetric="no" isSpecial="yes"
- class="clinical">
- <name>prism diopter</name>
- <printSymbol>PD</printSymbol>
- <property>refraction of a prism</property>
- <value Unit="100tan(1 rad)" UNIT="100TAN(1 RAD)">
- <function name="tanTimes100" value="1" Unit="deg"/>
- </value>
- </unit>
- <unit xmlns="" Code="%[slope]" CODE="%[SLOPE]" isMetric="no" isSpecial="yes"
- class="clinical">
- <name>percent of slope</name>
- <printSymbol>%</printSymbol>
- <property>slope</property>
- <value Unit="100tan(1 rad)" UNIT="100TAN(1 RAD)">
- <function name="100tan" value="1" Unit="deg"/>
- </value>
- </unit>
- <unit xmlns="" Code="[mesh_i]" CODE="[MESH_I]" isMetric="no" class="clinical">
- <name>mesh</name>
- <property>lineic number</property>
- <value Unit="/[in_i]" UNIT="/[IN_I]" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[Ch]" CODE="[CH]" isMetric="no" class="clinical">
- <name>Charrière</name>
- <name>french</name>
- <printSymbol>Ch</printSymbol>
- <property>gauge of catheters</property>
- <value Unit="mm/3" UNIT="MM/3" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[drp]" CODE="[DRP]" isMetric="no" class="clinical">
- <name>drop</name>
- <printSymbol>drp</printSymbol>
- <property>volume</property>
- <value Unit="ml/20" UNIT="ML/20" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[hnsf'U]" CODE="[HNSF'U]" isMetric="no" class="clinical">
- <name>Hounsfield unit</name>
- <printSymbol>HF</printSymbol>
- <property>x-ray attenuation</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[MET]" CODE="[MET]" isMetric="no" class="clinical">
- <name>metabolic equivalent</name>
- <printSymbol>MET</printSymbol>
- <property>metabolic cost of physical activity</property>
- <value Unit="mL/min/kg" UNIT="ML/MIN/KG" value="3.5">3.5</value>
- </unit>
- <unit xmlns="" Code="[hp'_X]" CODE="[HP'_X]" isMetric="no" isSpecial="yes"
- class="clinical">
- <name>homeopathic potency of decimal series (retired)</name>
- <printSymbol>X</printSymbol>
- <property>homeopathic potency (retired)</property>
- <value Unit="hpX(1 1)" UNIT="HPX(1 1)">
- <function name="hpX" value="1" Unit="1"/>
- </value>
- </unit>
- <unit xmlns="" Code="[hp'_C]" CODE="[HP'_C]" isMetric="no" isSpecial="yes"
- class="clinical">
- <name>homeopathic potency of centesimal series (retired)</name>
- <printSymbol>C</printSymbol>
- <property>homeopathic potency (retired)</property>
- <value Unit="hpC(1 1)" UNIT="HPC(1 1)">
- <function name="hpC" value="1" Unit="1"/>
- </value>
- </unit>
- <unit xmlns="" Code="[hp'_M]" CODE="[HP'_M]" isMetric="no" isSpecial="yes"
- class="clinical">
- <name>homeopathic potency of millesimal series (retired)</name>
- <printSymbol>M</printSymbol>
- <property>homeopathic potency (retired)</property>
- <value Unit="hpM(1 1)" UNIT="HPM(1 1)">
- <function name="hpM" value="1" Unit="1"/>
- </value>
- </unit>
- <unit xmlns="" Code="[hp'_Q]" CODE="[HP'_Q]" isMetric="no" isSpecial="yes"
- class="clinical">
- <name>homeopathic potency of quintamillesimal series (retired)</name>
- <printSymbol>Q</printSymbol>
- <property>homeopathic potency (retired)</property>
- <value Unit="hpQ(1 1)" UNIT="HPQ(1 1)">
- <function name="hpQ" value="1" Unit="1"/>
- </value>
- </unit>
- <unit xmlns="" Code="[hp_X]" CODE="[HP_X]" isMetric="no" isArbitrary="yes"
- class="clinical">
- <name>homeopathic potency of decimal hahnemannian series</name>
- <printSymbol>X</printSymbol>
- <property>homeopathic potency (Hahnemann)</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[hp_C]" CODE="[HP_C]" isMetric="no" isArbitrary="yes"
- class="clinical">
- <name>homeopathic potency of centesimal hahnemannian series</name>
- <printSymbol>C</printSymbol>
- <property>homeopathic potency (Hahnemann)</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[hp_M]" CODE="[HP_M]" isMetric="no" isArbitrary="yes"
- class="clinical">
- <name>homeopathic potency of millesimal hahnemannian series</name>
- <printSymbol>M</printSymbol>
- <property>homeopathic potency (Hahnemann)</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[hp_Q]" CODE="[HP_Q]" isMetric="no" isArbitrary="yes"
- class="clinical">
- <name>homeopathic potency of quintamillesimal hahnemannian series</name>
- <printSymbol>Q</printSymbol>
- <property>homeopathic potency (Hahnemann)</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[kp_X]" CODE="[KP_X]" isMetric="no" isArbitrary="yes"
- class="clinical">
- <name>homeopathic potency of decimal korsakovian series</name>
- <printSymbol>X</printSymbol>
- <property>homeopathic potency (Korsakov)</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[kp_C]" CODE="[KP_C]" isMetric="no" isArbitrary="yes"
- class="clinical">
- <name>homeopathic potency of centesimal korsakovian series</name>
- <printSymbol>C</printSymbol>
- <property>homeopathic potency (Korsakov)</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[kp_M]" CODE="[KP_M]" isMetric="no" isArbitrary="yes"
- class="clinical">
- <name>homeopathic potency of millesimal korsakovian series</name>
- <printSymbol>M</printSymbol>
- <property>homeopathic potency (Korsakov)</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[kp_Q]" CODE="[KP_Q]" isMetric="no" isArbitrary="yes"
- class="clinical">
- <name>homeopathic potency of quintamillesimal korsakovian series</name>
- <printSymbol>Q</printSymbol>
- <property>homeopathic potency (Korsakov)</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="eq" CODE="EQ" isMetric="yes" class="chemical">
- <name>equivalents</name>
- <printSymbol>eq</printSymbol>
- <property>amount of substance</property>
- <value Unit="mol" UNIT="MOL" value="1">1</value>
- </unit>
- <unit xmlns="" Code="osm" CODE="OSM" isMetric="yes" class="chemical">
- <name>osmole</name>
- <printSymbol>osm</printSymbol>
- <property>amount of substance (dissolved particles)</property>
- <value Unit="mol" UNIT="MOL" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[pH]" CODE="[PH]" isMetric="no" isSpecial="yes" class="chemical">
- <name>pH</name>
- <printSymbol>pH</printSymbol>
- <property>acidity</property>
- <value Unit="pH(1 mol/l)" UNIT="PH(1 MOL/L)">
- <function name="pH" value="1" Unit="mol/l"/>
- </value>
- </unit>
- <unit xmlns="" Code="g%" CODE="G%" isMetric="yes" class="chemical">
- <name>gram percent</name>
- <printSymbol>g%</printSymbol>
- <property>mass concentration</property>
- <value Unit="g/dl" UNIT="G/DL" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[S]" CODE="[S]" isMetric="no" class="chemical">
- <name>Svedberg unit</name>
- <printSymbol>S</printSymbol>
- <property>sedimentation coefficient</property>
- <value Unit="10*-13.s" UNIT="10*-13.S" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[HPF]" CODE="[HPF]" isMetric="no" class="chemical">
- <name>high power field</name>
- <printSymbol>HPF</printSymbol>
- <property>view area in microscope</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[LPF]" CODE="[LPF]" isMetric="no" class="chemical">
- <name>low power field</name>
- <printSymbol>LPF</printSymbol>
- <property>view area in microscope</property>
- <value Unit="1" UNIT="1" value="100">100</value>
- </unit>
- <unit xmlns="" Code="kat" CODE="KAT" isMetric="yes" class="chemical">
- <name>katal</name>
- <printSymbol>kat</printSymbol>
- <property>catalytic activity</property>
- <value Unit="mol/s" UNIT="MOL/S" value="1">1</value>
- </unit>
- <unit xmlns="" Code="U" CODE="U" isMetric="yes" class="chemical">
- <name>Unit</name>
- <printSymbol>U</printSymbol>
- <property>catalytic activity</property>
- <value Unit="umol/min" UNIT="UMOL/MIN" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[iU]" CODE="[IU]" isMetric="yes" isArbitrary="yes"
- class="chemical">
- <name>international unit</name>
- <printSymbol>IU</printSymbol>
- <property>arbitrary</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[IU]" CODE="[IU]" isMetric="yes" isArbitrary="yes"
- class="chemical">
- <name>international unit</name>
- <printSymbol>i.U.</printSymbol>
- <property>arbitrary</property>
- <value Unit="[iU]" UNIT="[IU]" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[arb'U]" CODE="[ARB'U]" isMetric="no" isArbitrary="yes"
- class="chemical">
- <name>arbitary unit</name>
- <printSymbol>arb. U</printSymbol>
- <property>arbitrary</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[USP'U]" CODE="[USP'U]" isMetric="no" isArbitrary="yes"
- class="chemical">
- <name>United States Pharmacopeia unit</name>
- <printSymbol>U.S.P.</printSymbol>
- <property>arbitrary</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[GPL'U]" CODE="[GPL'U]" isMetric="no" isArbitrary="yes"
- class="chemical">
- <name>GPL unit</name>
- <property>biologic activity of anticardiolipin IgG</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[MPL'U]" CODE="[MPL'U]" isMetric="no" isArbitrary="yes"
- class="chemical">
- <name>MPL unit</name>
- <property>biologic activity of anticardiolipin IgM</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[APL'U]" CODE="[APL'U]" isMetric="no" isArbitrary="yes"
- class="chemical">
- <name>APL unit</name>
- <property>biologic activity of anticardiolipin IgA</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[beth'U]" CODE="[BETH'U]" isMetric="no" isArbitrary="yes"
- class="chemical">
- <name>Bethesda unit</name>
- <property>biologic activity of factor VIII inhibitor</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[anti'Xa'U]" CODE="[ANTI'XA'U]" isMetric="no" isArbitrary="yes"
- class="chemical">
- <name>anti factor Xa unit</name>
- <property>biologic activity of factor Xa inhibitor (heparin)</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[todd'U]" CODE="[TODD'U]" isMetric="no" isArbitrary="yes"
- class="chemical">
- <name>Todd unit</name>
- <property>biologic activity antistreptolysin O</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[dye'U]" CODE="[DYE'U]" isMetric="no" isArbitrary="yes"
- class="chemical">
- <name>Dye unit</name>
- <property>biologic activity of amylase</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[smgy'U]" CODE="[SMGY'U]" isMetric="no" isArbitrary="yes"
- class="chemical">
- <name>Somogyi unit</name>
- <property>biologic activity of amylase</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[bdsk'U]" CODE="[BDSK'U]" isMetric="no" isArbitrary="yes"
- class="chemical">
- <name>Bodansky unit</name>
- <property>biologic activity of phosphatase</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[ka'U]" CODE="[KA'U]" isMetric="no" isArbitrary="yes"
- class="chemical">
- <name>King-Armstrong unit</name>
- <property>biologic activity of phosphatase</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[knk'U]" CODE="[KNK'U]" isMetric="no" isArbitrary="yes"
- class="chemical">
- <name>Kunkel unit</name>
- <property>arbitrary biologic activity</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[mclg'U]" CODE="[MCLG'U]" isMetric="no" isArbitrary="yes"
- class="chemical">
- <name>Mac Lagan unit</name>
- <property>arbitrary biologic activity</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[tb'U]" CODE="[TB'U]" isMetric="no" isArbitrary="yes"
- class="chemical">
- <name>tuberculin unit</name>
- <property>biologic activity of tuberculin</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[CCID_50]" CODE="[CCID_50]" isMetric="no" isArbitrary="yes"
- class="chemical">
- <name>50% cell culture infectious dose</name>
- <printSymbol>CCID<sub>50</sub>
- </printSymbol>
- <property>biologic activity (infectivity) of an infectious agent preparation</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[TCID_50]" CODE="[TCID_50]" isMetric="no" isArbitrary="yes"
- class="chemical">
- <name>50% tissue culture infectious dose</name>
- <printSymbol>TCID<sub>50</sub>
- </printSymbol>
- <property>biologic activity (infectivity) of an infectious agent preparation</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[EID_50]" CODE="[EID_50]" isMetric="no" isArbitrary="yes"
- class="chemical">
- <name>50% embryo infectious dose</name>
- <printSymbol>EID<sub>50</sub>
- </printSymbol>
- <property>biologic activity (infectivity) of an infectious agent preparation</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[PFU]" CODE="[PFU]" isMetric="no" isArbitrary="yes"
- class="chemical">
- <name>plaque forming units</name>
- <printSymbol>PFU</printSymbol>
- <property>amount of an infectious agent</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[FFU]" CODE="[FFU]" isMetric="no" isArbitrary="yes"
- class="chemical">
- <name>focus forming units</name>
- <printSymbol>FFU</printSymbol>
- <property>amount of an infectious agent</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[CFU]" CODE="[CFU]" isMetric="no" isArbitrary="yes"
- class="chemical">
- <name>colony forming units</name>
- <printSymbol>CFU</printSymbol>
- <property>amount of a proliferating organism</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[BAU]" CODE="[BAU]" isMetric="no" isArbitrary="yes"
- class="chemical">
- <name>bioequivalent allergen unit</name>
- <printSymbol>BAU</printSymbol>
- <property>amount of an allergen callibrated through in-vivo testing based on the ID50EAL method of (intradermal dilution for 50mm sum of erythema diameters</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[AU]" CODE="[AU]" isMetric="no" isArbitrary="yes"
- class="chemical">
- <name>allergen unit</name>
- <printSymbol>AU</printSymbol>
- <property>procedure defined amount of an allergen using some reference standard</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[Amb'a'1'U]" CODE="[AMB'A'1'U]" isMetric="no" isArbitrary="yes"
- class="chemical">
- <name>allergen unit for Ambrosia artemisiifolia</name>
- <printSymbol>Amb a 1 U</printSymbol>
- <property>procedure defined amount of the major allergen of ragweed.</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[PNU]" CODE="[PNU]" isMetric="no" isArbitrary="yes"
- class="chemical">
- <name>protein nitrogen unit</name>
- <printSymbol>PNU</printSymbol>
- <property>procedure defined amount of a protein substance</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[Lf]" CODE="[LF]" isMetric="no" isArbitrary="yes"
- class="chemical">
- <name>Limit of flocculation</name>
- <printSymbol>Lf</printSymbol>
- <property>procedure defined amount of an antigen substance</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[D'ag'U]" CODE="[D'AG'U]" isMetric="no" isArbitrary="yes"
- class="chemical">
- <name>D-antigen unit</name>
- <printSymbol/>
- <property>procedure defined amount of a poliomyelitis d-antigen substance</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[FEU]" CODE="[FEU]" isMetric="no" isArbitrary="yes"
- class="chemical">
- <name>fibrinogen equivalent unit</name>
- <printSymbol/>
- <property>amount of fibrinogen broken down into the measured d-dimers</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[ELU]" CODE="[ELU]" isMetric="no" isArbitrary="yes"
- class="chemical">
- <name>ELISA unit</name>
- <printSymbol/>
- <property>arbitrary ELISA unit</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[EU]" CODE="[EU]" isMetric="no" isArbitrary="yes"
- class="chemical">
- <name>Ehrlich unit</name>
- <printSymbol/>
- <property>Ehrlich unit</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="Np" CODE="NEP" isMetric="yes" isSpecial="yes" class="levels">
- <name>neper</name>
- <printSymbol>Np</printSymbol>
- <property>level</property>
- <value Unit="ln(1 1)" UNIT="LN(1 1)">
- <function name="ln" value="1" Unit="1"/>
- </value>
- </unit>
- <unit xmlns="" Code="B" CODE="B" isMetric="yes" isSpecial="yes" class="levels">
- <name>bel</name>
- <printSymbol>B</printSymbol>
- <property>level</property>
- <value Unit="lg(1 1)" UNIT="LG(1 1)">
- <function name="lg" value="1" Unit="1"/>
- </value>
- </unit>
- <unit xmlns="" Code="B[SPL]" CODE="B[SPL]" isMetric="yes" isSpecial="yes"
- class="levels">
- <name>bel sound pressure</name>
- <printSymbol>B(SPL)</printSymbol>
- <property>pressure level</property>
- <value Unit="2lg(2 10*-5.Pa)" UNIT="2LG(2 10*-5.PAL)">
- <function name="lgTimes2" value="2" Unit="10*-5.Pa"/>
- </value>
- </unit>
- <unit xmlns="" Code="B[V]" CODE="B[V]" isMetric="yes" isSpecial="yes" class="levels">
- <name>bel volt</name>
- <printSymbol>B(V)</printSymbol>
- <property>electric potential level</property>
- <value Unit="2lg(1 V)" UNIT="2LG(1 V)">
- <function name="lgTimes2" value="1" Unit="V"/>
- </value>
- </unit>
- <unit xmlns="" Code="B[mV]" CODE="B[MV]" isMetric="yes" isSpecial="yes" class="levels">
- <name>bel millivolt</name>
- <printSymbol>B(mV)</printSymbol>
- <property>electric potential level</property>
- <value Unit="2lg(1 mV)" UNIT="2LG(1 MV)">
- <function name="lgTimes2" value="1" Unit="mV"/>
- </value>
- </unit>
- <unit xmlns="" Code="B[uV]" CODE="B[UV]" isMetric="yes" isSpecial="yes" class="levels">
- <name>bel microvolt</name>
- <printSymbol>B(μV)</printSymbol>
- <property>electric potential level</property>
- <value Unit="2lg(1 uV)" UNIT="2LG(1 UV)">
- <function name="lgTimes2" value="1" Unit="uV"/>
- </value>
- </unit>
- <unit xmlns="" Code="B[10.nV]" CODE="B[10.NV]" isMetric="yes" isSpecial="yes"
- class="levels">
- <name>bel 10 nanovolt</name>
- <printSymbol>B(10 nV)</printSymbol>
- <property>electric potential level</property>
- <value Unit="2lg(10 nV)" UNIT="2LG(10 NV)">
- <function name="lgTimes2" value="10" Unit="nV"/>
- </value>
- </unit>
- <unit xmlns="" Code="B[W]" CODE="B[W]" isMetric="yes" isSpecial="yes" class="levels">
- <name>bel watt</name>
- <printSymbol>B(W)</printSymbol>
- <property>power level</property>
- <value Unit="lg(1 W)" UNIT="LG(1 W)">
- <function name="lg" value="1" Unit="W"/>
- </value>
- </unit>
- <unit xmlns="" Code="B[kW]" CODE="B[KW]" isMetric="yes" isSpecial="yes" class="levels">
- <name>bel kilowatt</name>
- <printSymbol>B(kW)</printSymbol>
- <property>power level</property>
- <value Unit="lg(1 kW)" UNIT="LG(1 KW)">
- <function name="lg" value="1" Unit="kW"/>
- </value>
- </unit>
- <unit xmlns="" Code="st" CODE="STR" isMetric="yes" class="misc">
- <name>stere</name>
- <printSymbol>st</printSymbol>
- <property>volume</property>
- <value Unit="m3" UNIT="M3" value="1">1</value>
- </unit>
- <unit xmlns="" Code="Ao" CODE="AO" isMetric="no" class="misc">
- <name>Ångström</name>
- <printSymbol>Å</printSymbol>
- <property>length</property>
- <value Unit="nm" UNIT="NM" value="0.1">0.1</value>
- </unit>
- <unit xmlns="" Code="b" CODE="BRN" isMetric="no" class="misc">
- <name>barn</name>
- <printSymbol>b</printSymbol>
- <property>action area</property>
- <value Unit="fm2" UNIT="FM2" value="100">100</value>
- </unit>
- <unit xmlns="" Code="att" CODE="ATT" isMetric="no" class="misc">
- <name>technical atmosphere</name>
- <printSymbol>at</printSymbol>
- <property>pressure</property>
- <value Unit="kgf/cm2" UNIT="KGF/CM2" value="1">1</value>
- </unit>
- <unit xmlns="" Code="mho" CODE="MHO" isMetric="yes" class="misc">
- <name>mho</name>
- <printSymbol>mho</printSymbol>
- <property>electric conductance</property>
- <value Unit="S" UNIT="S" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[psi]" CODE="[PSI]" isMetric="no" class="misc">
- <name>pound per sqare inch</name>
- <printSymbol>psi</printSymbol>
- <property>pressure</property>
- <value Unit="[lbf_av]/[in_i]2" UNIT="[LBF_AV]/[IN_I]2" value="1">1</value>
- </unit>
- <unit xmlns="" Code="circ" CODE="CIRC" isMetric="no" class="misc">
- <name>circle</name>
- <printSymbol>circ</printSymbol>
- <property>plane angle</property>
- <value Unit="[pi].rad" UNIT="[PI].RAD" value="2">2</value>
- </unit>
- <unit xmlns="" Code="sph" CODE="SPH" isMetric="no" class="misc">
- <name>spere</name>
- <printSymbol>sph</printSymbol>
- <property>solid angle</property>
- <value Unit="[pi].sr" UNIT="[PI].SR" value="4">4</value>
- </unit>
- <unit xmlns="" Code="[car_m]" CODE="[CAR_M]" isMetric="no" class="misc">
- <name>metric carat</name>
- <printSymbol>ct<sub>m</sub>
- </printSymbol>
- <property>mass</property>
- <value Unit="g" UNIT="G" value="2e-1">0.2</value>
- </unit>
- <unit xmlns="" Code="[car_Au]" CODE="[CAR_AU]" isMetric="no" class="misc">
- <name>carat of gold alloys</name>
- <printSymbol>ct<sub>
- <r>Au</r>
- </sub>
- </printSymbol>
- <property>mass fraction</property>
- <value Unit="/24" UNIT="/24" value="1">1</value>
- </unit>
- <unit xmlns="" Code="[smoot]" CODE="[SMOOT]" isMetric="no" class="misc">
- <name>Smoot</name>
- <printSymbol/>
- <property>length</property>
- <value Unit="[in_i]" UNIT="[IN_I]" value="67">67</value>
- </unit>
- <unit xmlns="" Code="bit_s" CODE="BIT_S" isMetric="no" isSpecial="yes"
- class="infotech">
- <name>bit</name>
- <printSymbol>bit<sub>s</sub>
- </printSymbol>
- <property>amount of information</property>
- <value Unit="ld(1 1)" UNIT="ld(1 1)">
- <function name="ld" value="1" Unit="1"/>
- </value>
- </unit>
- <unit xmlns="" Code="bit" CODE="BIT" isMetric="yes" class="infotech">
- <name>bit</name>
- <printSymbol>bit</printSymbol>
- <property>amount of information</property>
- <value Unit="1" UNIT="1" value="1">1</value>
- </unit>
- <unit xmlns="" Code="By" CODE="BY" isMetric="yes" class="infotech">
- <name>byte</name>
- <printSymbol>B</printSymbol>
- <property>amount of information</property>
- <value Unit="bit" UNIT="bit" value="8">8</value>
- </unit>
- <unit xmlns="" Code="Bd" CODE="BD" isMetric="yes" class="infotech">
- <name>baud</name>
- <printSymbol>Bd</printSymbol>
- <property>signal transmission rate</property>
- <value Unit="/s" UNIT="/s" value="1">1</value>
- </unit>
- <prefix xmlns="" Code="Ki" CODE="KIB">
- <name>kibi</name>
- <printSymbol>Ki</printSymbol>
- <value value="1024">1024</value>
- </prefix>
- <prefix xmlns="" Code="Mi" CODE="MIB">
- <name>mebi</name>
- <printSymbol>Mi</printSymbol>
- <value value="1048576">1048576</value>
- </prefix>
- <prefix xmlns="" Code="Gi" CODE="GIB">
- <name>gibi</name>
- <printSymbol>Gi</printSymbol>
- <value value="1073741824">1073741824</value>
- </prefix>
- <prefix xmlns="" Code="Ti" CODE="TIB">
- <name>tebi</name>
- <printSymbol>Ti</printSymbol>
- <value value="1099511627776">1099511627776</value>
- </prefix>
+<?xml version="1.0" encoding="ascii"?>
+<root xmlns="http://unitsofmeasure.org/ucum-essence" version="1.9"
+ revision="$Revision: 16410 $"
+ revision-date="$Date: 2013-10-21 21:24:43 -0700 (Mon, 21 Oct 2013) $">
+ <prefix xmlns="" Code="Y" CODE="YA">
+ <name>yotta</name>
+ <printSymbol>Y</printSymbol>
+ <value value="1e24">1 × 10<sup>24</sup>
+ </value>
+ </prefix>
+ <prefix xmlns="" Code="Z" CODE="ZA">
+ <name>zetta</name>
+ <printSymbol>Z</printSymbol>
+ <value value="1e21">1 × 10<sup>21</sup>
+ </value>
+ </prefix>
+ <prefix xmlns="" Code="E" CODE="EX">
+ <name>exa</name>
+ <printSymbol>E</printSymbol>
+ <value value="1e18">1 × 10<sup>18</sup>
+ </value>
+ </prefix>
+ <prefix xmlns="" Code="P" CODE="PT">
+ <name>peta</name>
+ <printSymbol>P</printSymbol>
+ <value value="1e15">1 × 10<sup>15</sup>
+ </value>
+ </prefix>
+ <prefix xmlns="" Code="T" CODE="TR">
+ <name>tera</name>
+ <printSymbol>T</printSymbol>
+ <value value="1e12">1 × 10<sup>12</sup>
+ </value>
+ </prefix>
+ <prefix xmlns="" Code="G" CODE="GA">
+ <name>giga</name>
+ <printSymbol>G</printSymbol>
+ <value value="1e9">1 × 10<sup>9</sup>
+ </value>
+ </prefix>
+ <prefix xmlns="" Code="M" CODE="MA">
+ <name>mega</name>
+ <printSymbol>M</printSymbol>
+ <value value="1e6">1 × 10<sup>6</sup>
+ </value>
+ </prefix>
+ <prefix xmlns="" Code="k" CODE="K">
+ <name>kilo</name>
+ <printSymbol>k</printSymbol>
+ <value value="1e3">1 × 10<sup>3</sup>
+ </value>
+ </prefix>
+ <prefix xmlns="" Code="h" CODE="H">
+ <name>hecto</name>
+ <printSymbol>h</printSymbol>
+ <value value="1e2">1 × 10<sup>2</sup>
+ </value>
+ </prefix>
+ <prefix xmlns="" Code="da" CODE="DA">
+ <name>deka</name>
+ <printSymbol>da</printSymbol>
+ <value value="1e1">1 × 10<sup>1</sup>
+ </value>
+ </prefix>
+ <prefix xmlns="" Code="d" CODE="D">
+ <name>deci</name>
+ <printSymbol>d</printSymbol>
+ <value value="1e-1">1 × 10<sup>-1</sup>
+ </value>
+ </prefix>
+ <prefix xmlns="" Code="c" CODE="C">
+ <name>centi</name>
+ <printSymbol>c</printSymbol>
+ <value value="1e-2">1 × 10<sup>-2</sup>
+ </value>
+ </prefix>
+ <prefix xmlns="" Code="m" CODE="M">
+ <name>milli</name>
+ <printSymbol>m</printSymbol>
+ <value value="1e-3">1 × 10<sup>-3</sup>
+ </value>
+ </prefix>
+ <prefix xmlns="" Code="u" CODE="U">
+ <name>micro</name>
+ <printSymbol>μ</printSymbol>
+ <value value="1e-6">1 × 10<sup>-6</sup>
+ </value>
+ </prefix>
+ <prefix xmlns="" Code="n" CODE="N">
+ <name>nano</name>
+ <printSymbol>n</printSymbol>
+ <value value="1e-9">1 × 10<sup>-9</sup>
+ </value>
+ </prefix>
+ <prefix xmlns="" Code="p" CODE="P">
+ <name>pico</name>
+ <printSymbol>p</printSymbol>
+ <value value="1e-12">1 × 10<sup>-12</sup>
+ </value>
+ </prefix>
+ <prefix xmlns="" Code="f" CODE="F">
+ <name>femto</name>
+ <printSymbol>f</printSymbol>
+ <value value="1e-15">1 × 10<sup>-15</sup>
+ </value>
+ </prefix>
+ <prefix xmlns="" Code="a" CODE="A">
+ <name>atto</name>
+ <printSymbol>a</printSymbol>
+ <value value="1e-18">1 × 10<sup>-18</sup>
+ </value>
+ </prefix>
+ <prefix xmlns="" Code="z" CODE="ZO">
+ <name>zepto</name>
+ <printSymbol>z</printSymbol>
+ <value value="1e-21">1 × 10<sup>-21</sup>
+ </value>
+ </prefix>
+ <prefix xmlns="" Code="y" CODE="YO">
+ <name>yocto</name>
+ <printSymbol>y</printSymbol>
+ <value value="1e-24">1 × 10<sup>-24</sup>
+ </value>
+ </prefix>
+ <base-unit xmlns="" Code="m" CODE="M" dim="L">
+ <name>meter</name>
+ <printSymbol>m</printSymbol>
+ <property>length</property>
+ </base-unit>
+ <base-unit xmlns="" Code="s" CODE="S" dim="T">
+ <name>second</name>
+ <printSymbol>s</printSymbol>
+ <property>time</property>
+ </base-unit>
+ <base-unit xmlns="" Code="g" CODE="G" dim="M">
+ <name>gram</name>
+ <printSymbol>g</printSymbol>
+ <property>mass</property>
+ </base-unit>
+ <base-unit xmlns="" Code="rad" CODE="RAD" dim="A">
+ <name>radian</name>
+ <printSymbol>rad</printSymbol>
+ <property>plane angle</property>
+ </base-unit>
+ <base-unit xmlns="" Code="K" CODE="K" dim="C">
+ <name>Kelvin</name>
+ <printSymbol>K</printSymbol>
+ <property>temperature</property>
+ </base-unit>
+ <base-unit xmlns="" Code="C" CODE="C" dim="Q">
+ <name>Coulomb</name>
+ <printSymbol>C</printSymbol>
+ <property>electric charge</property>
+ </base-unit>
+ <base-unit xmlns="" Code="cd" CODE="CD" dim="F">
+ <name>candela</name>
+ <printSymbol>cd</printSymbol>
+ <property>luminous intensity</property>
+ </base-unit>
+ <unit xmlns="" Code="10*" CODE="10*" isMetric="no" class="dimless">
+ <name>the number ten for arbitrary powers</name>
+ <printSymbol>10</printSymbol>
+ <property>number</property>
+ <value Unit="1" UNIT="1" value="10">10</value>
+ </unit>
+ <unit xmlns="" Code="10^" CODE="10^" isMetric="no" class="dimless">
+ <name>the number ten for arbitrary powers</name>
+ <printSymbol>10</printSymbol>
+ <property>number</property>
+ <value Unit="1" UNIT="1" value="10">10</value>
+ </unit>
+ <unit xmlns="" Code="[pi]" CODE="[PI]" isMetric="no" class="dimless">
+ <name>the number pi</name>
+ <printSymbol>π</printSymbol>
+ <property>number</property>
+ <value Unit="1" UNIT="1"
+ value="3.1415926535897932384626433832795028841971693993751058209749445923">π</value>
+ </unit>
+ <unit xmlns="" Code="%" CODE="%" isMetric="no" class="dimless">
+ <name>percent</name>
+ <printSymbol>%</printSymbol>
+ <property>fraction</property>
+ <value Unit="10*-2" UNIT="10*-2" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[ppth]" CODE="[PPTH]" isMetric="no" class="dimless">
+ <name>parts per thousand</name>
+ <printSymbol>ppth</printSymbol>
+ <property>fraction</property>
+ <value Unit="10*-3" UNIT="10*-3" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[ppm]" CODE="[PPM]" isMetric="no" class="dimless">
+ <name>parts per million</name>
+ <printSymbol>ppm</printSymbol>
+ <property>fraction</property>
+ <value Unit="10*-6" UNIT="10*-6" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[ppb]" CODE="[PPB]" isMetric="no" class="dimless">
+ <name>parts per billion</name>
+ <printSymbol>ppb</printSymbol>
+ <property>fraction</property>
+ <value Unit="10*-9" UNIT="10*-9" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[pptr]" CODE="[PPTR]" isMetric="no" class="dimless">
+ <name>parts per trillion</name>
+ <printSymbol>pptr</printSymbol>
+ <property>fraction</property>
+ <value Unit="10*-12" UNIT="10*-12" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="mol" CODE="MOL" isMetric="yes" class="si">
+ <name>mole</name>
+ <printSymbol>mol</printSymbol>
+ <property>amount of substance</property>
+ <value Unit="10*23" UNIT="10*23" value="6.0221367">6.0221367</value>
+ </unit>
+ <unit xmlns="" Code="sr" CODE="SR" isMetric="yes" class="si">
+ <name>steradian</name>
+ <printSymbol>sr</printSymbol>
+ <property>solid angle</property>
+ <value Unit="rad2" UNIT="RAD2" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="Hz" CODE="HZ" isMetric="yes" class="si">
+ <name>Hertz</name>
+ <printSymbol>Hz</printSymbol>
+ <property>frequency</property>
+ <value Unit="s-1" UNIT="S-1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="N" CODE="N" isMetric="yes" class="si">
+ <name>Newton</name>
+ <printSymbol>N</printSymbol>
+ <property>force</property>
+ <value Unit="kg.m/s2" UNIT="KG.M/S2" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="Pa" CODE="PAL" isMetric="yes" class="si">
+ <name>Pascal</name>
+ <printSymbol>Pa</printSymbol>
+ <property>pressure</property>
+ <value Unit="N/m2" UNIT="N/M2" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="J" CODE="J" isMetric="yes" class="si">
+ <name>Joule</name>
+ <printSymbol>J</printSymbol>
+ <property>energy</property>
+ <value Unit="N.m" UNIT="N.M" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="W" CODE="W" isMetric="yes" class="si">
+ <name>Watt</name>
+ <printSymbol>W</printSymbol>
+ <property>power</property>
+ <value Unit="J/s" UNIT="J/S" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="A" CODE="A" isMetric="yes" class="si">
+ <name>Ampère</name>
+ <printSymbol>A</printSymbol>
+ <property>electric current</property>
+ <value Unit="C/s" UNIT="C/S" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="V" CODE="V" isMetric="yes" class="si">
+ <name>Volt</name>
+ <printSymbol>V</printSymbol>
+ <property>electric potential</property>
+ <value Unit="J/C" UNIT="J/C" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="F" CODE="F" isMetric="yes" class="si">
+ <name>Farad</name>
+ <printSymbol>F</printSymbol>
+ <property>electric capacitance</property>
+ <value Unit="C/V" UNIT="C/V" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="Ohm" CODE="OHM" isMetric="yes" class="si">
+ <name>Ohm</name>
+ <printSymbol>Ω</printSymbol>
+ <property>electric resistance</property>
+ <value Unit="V/A" UNIT="V/A" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="S" CODE="SIE" isMetric="yes" class="si">
+ <name>Siemens</name>
+ <printSymbol>S</printSymbol>
+ <property>electric conductance</property>
+ <value Unit="Ohm-1" UNIT="OHM-1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="Wb" CODE="WB" isMetric="yes" class="si">
+ <name>Weber</name>
+ <printSymbol>Wb</printSymbol>
+ <property>magentic flux</property>
+ <value Unit="V.s" UNIT="V.S" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="Cel" CODE="CEL" isMetric="yes" isSpecial="yes" class="si">
+ <name>degree Celsius</name>
+ <printSymbol>°C</printSymbol>
+ <property>temperature</property>
+ <value Unit="cel(1 K)" UNIT="CEL(1 K)">
+ <function name="Cel" value="1" Unit="K"/>
+ </value>
+ </unit>
+ <unit xmlns="" Code="T" CODE="T" isMetric="yes" class="si">
+ <name>Tesla</name>
+ <printSymbol>T</printSymbol>
+ <property>magnetic flux density</property>
+ <value Unit="Wb/m2" UNIT="WB/M2" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="H" CODE="H" isMetric="yes" class="si">
+ <name>Henry</name>
+ <printSymbol>H</printSymbol>
+ <property>inductance</property>
+ <value Unit="Wb/A" UNIT="WB/A" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="lm" CODE="LM" isMetric="yes" class="si">
+ <name>lumen</name>
+ <printSymbol>lm</printSymbol>
+ <property>luminous flux</property>
+ <value Unit="cd.sr" UNIT="CD.SR" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="lx" CODE="LX" isMetric="yes" class="si">
+ <name>lux</name>
+ <printSymbol>lx</printSymbol>
+ <property>illuminance</property>
+ <value Unit="lm/m2" UNIT="LM/M2" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="Bq" CODE="BQ" isMetric="yes" class="si">
+ <name>Becquerel</name>
+ <printSymbol>Bq</printSymbol>
+ <property>radioactivity</property>
+ <value Unit="s-1" UNIT="S-1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="Gy" CODE="GY" isMetric="yes" class="si">
+ <name>Gray</name>
+ <printSymbol>Gy</printSymbol>
+ <property>energy dose</property>
+ <value Unit="J/kg" UNIT="J/KG" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="Sv" CODE="SV" isMetric="yes" class="si">
+ <name>Sievert</name>
+ <printSymbol>Sv</printSymbol>
+ <property>dose equivalent</property>
+ <value Unit="J/kg" UNIT="J/KG" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="gon" CODE="GON" isMetric="no" class="iso1000">
+ <name>gon</name>
+ <name>grade</name>
+ <printSymbol>□<sup>g</sup>
+ </printSymbol>
+ <property>plane angle</property>
+ <value Unit="deg" UNIT="DEG" value="0.9">0.9</value>
+ </unit>
+ <unit xmlns="" Code="deg" CODE="DEG" isMetric="no" class="iso1000">
+ <name>degree</name>
+ <printSymbol>°</printSymbol>
+ <property>plane angle</property>
+ <value Unit="[pi].rad/360" UNIT="[PI].RAD/360" value="2">2</value>
+ </unit>
+ <unit xmlns="" Code="'" CODE="'" isMetric="no" class="iso1000">
+ <name>minute</name>
+ <printSymbol>'</printSymbol>
+ <property>plane angle</property>
+ <value Unit="deg/60" UNIT="DEG/60" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="''" CODE="''" isMetric="no" class="iso1000">
+ <name>second</name>
+ <printSymbol>''</printSymbol>
+ <property>plane angle</property>
+ <value Unit="'/60" UNIT="'/60" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="l" CODE="L" isMetric="yes" class="iso1000">
+ <name>liter</name>
+ <printSymbol>l</printSymbol>
+ <property>volume</property>
+ <value Unit="dm3" UNIT="DM3" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="L" isMetric="yes" class="iso1000">
+ <name>liter</name>
+ <printSymbol>L</printSymbol>
+ <property>volume</property>
+ <value Unit="l" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="ar" CODE="AR" isMetric="yes" class="iso1000">
+ <name>are</name>
+ <printSymbol>a</printSymbol>
+ <property>area</property>
+ <value Unit="m2" UNIT="M2" value="100">100</value>
+ </unit>
+ <unit xmlns="" Code="min" CODE="MIN" isMetric="no" class="iso1000">
+ <name>minute</name>
+ <printSymbol>min</printSymbol>
+ <property>time</property>
+ <value Unit="s" UNIT="S" value="60">60</value>
+ </unit>
+ <unit xmlns="" Code="h" CODE="HR" isMetric="no" class="iso1000">
+ <name>hour</name>
+ <printSymbol>h</printSymbol>
+ <property>time</property>
+ <value Unit="min" UNIT="MIN" value="60">60</value>
+ </unit>
+ <unit xmlns="" Code="d" CODE="D" isMetric="no" class="iso1000">
+ <name>day</name>
+ <printSymbol>d</printSymbol>
+ <property>time</property>
+ <value Unit="h" UNIT="HR" value="24">24</value>
+ </unit>
+ <unit xmlns="" Code="a_t" CODE="ANN_T" isMetric="no" class="iso1000">
+ <name>tropical year</name>
+ <printSymbol>a<sub>t</sub>
+ </printSymbol>
+ <property>time</property>
+ <value Unit="d" UNIT="D" value="365.24219">365.24219</value>
+ </unit>
+ <unit xmlns="" Code="a_j" CODE="ANN_J" isMetric="no" class="iso1000">
+ <name>mean Julian year</name>
+ <printSymbol>a<sub>j</sub>
+ </printSymbol>
+ <property>time</property>
+ <value Unit="d" UNIT="D" value="365.25">365.25</value>
+ </unit>
+ <unit xmlns="" Code="a_g" CODE="ANN_G" isMetric="no" class="iso1000">
+ <name>mean Gregorian year</name>
+ <printSymbol>a<sub>g</sub>
+ </printSymbol>
+ <property>time</property>
+ <value Unit="d" UNIT="D" value="365.2425">365.2425</value>
+ </unit>
+ <unit xmlns="" Code="a" CODE="ANN" isMetric="no" class="iso1000">
+ <name>year</name>
+ <printSymbol>a</printSymbol>
+ <property>time</property>
+ <value Unit="a_j" UNIT="ANN_J" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="wk" CODE="WK" isMetric="no" class="iso1000">
+ <name>week</name>
+ <printSymbol>wk</printSymbol>
+ <property>time</property>
+ <value Unit="d" UNIT="D" value="7">7</value>
+ </unit>
+ <unit xmlns="" Code="mo_s" CODE="MO_S" isMetric="no" class="iso1000">
+ <name>synodal month</name>
+ <printSymbol>mo<sub>s</sub>
+ </printSymbol>
+ <property>time</property>
+ <value Unit="d" UNIT="D" value="29.53059">29.53059</value>
+ </unit>
+ <unit xmlns="" Code="mo_j" CODE="MO_J" isMetric="no" class="iso1000">
+ <name>mean Julian month</name>
+ <printSymbol>mo<sub>j</sub>
+ </printSymbol>
+ <property>time</property>
+ <value Unit="a_j/12" UNIT="ANN_J/12" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="mo_g" CODE="MO_G" isMetric="no" class="iso1000">
+ <name>mean Gregorian month</name>
+ <printSymbol>mo<sub>g</sub>
+ </printSymbol>
+ <property>time</property>
+ <value Unit="a_g/12" UNIT="ANN_G/12" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="mo" CODE="MO" isMetric="no" class="iso1000">
+ <name>month</name>
+ <printSymbol>mo</printSymbol>
+ <property>time</property>
+ <value Unit="mo_j" UNIT="MO_J" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="t" CODE="TNE" isMetric="yes" class="iso1000">
+ <name>tonne</name>
+ <printSymbol>t</printSymbol>
+ <property>mass</property>
+ <value Unit="kg" UNIT="KG" value="1e3">1 × 10<sup>3</sup>
+ </value>
+ </unit>
+ <unit xmlns="" Code="bar" CODE="BAR" isMetric="yes" class="iso1000">
+ <name>bar</name>
+ <printSymbol>bar</printSymbol>
+ <property>pressure</property>
+ <value Unit="Pa" UNIT="PAL" value="1e5">1 × 10<sup>5</sup>
+ </value>
+ </unit>
+ <unit xmlns="" Code="u" CODE="AMU" isMetric="yes" class="iso1000">
+ <name>unified atomic mass unit</name>
+ <printSymbol>u</printSymbol>
+ <property>mass</property>
+ <value Unit="g" UNIT="G" value="1.6605402e-24">1.6605402 × 10<sup>-24</sup>
+ </value>
+ </unit>
+ <unit xmlns="" Code="eV" CODE="EV" isMetric="yes" class="iso1000">
+ <name>electronvolt</name>
+ <printSymbol>eV</printSymbol>
+ <property>energy</property>
+ <value Unit="[e].V" UNIT="[E].V" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="AU" CODE="ASU" isMetric="no" class="iso1000">
+ <name>astronomic unit</name>
+ <printSymbol>AU</printSymbol>
+ <property>length</property>
+ <value Unit="Mm" UNIT="MAM" value="149597.870691">149597.870691</value>
+ </unit>
+ <unit xmlns="" Code="pc" CODE="PRS" isMetric="yes" class="iso1000">
+ <name>parsec</name>
+ <printSymbol>pc</printSymbol>
+ <property>length</property>
+ <value Unit="m" UNIT="M" value="3.085678e16">3.085678 × 10<sup>16</sup>
+ </value>
+ </unit>
+ <unit xmlns="" Code="[c]" CODE="[C]" isMetric="yes" class="const">
+ <name>velocity of light</name>
+ <printSymbol>
+ <i>c</i>
+ </printSymbol>
+ <property>velocity</property>
+ <value Unit="m/s" UNIT="M/S" value="299792458">299792458</value>
+ </unit>
+ <unit xmlns="" Code="[h]" CODE="[H]" isMetric="yes" class="const">
+ <name>Planck constant</name>
+ <printSymbol>
+ <i>h</i>
+ </printSymbol>
+ <property>action</property>
+ <value Unit="J.s" UNIT="J.S" value="6.6260755e-24">6.6260755 × 10<sup>-24</sup>
+ </value>
+ </unit>
+ <unit xmlns="" Code="[k]" CODE="[K]" isMetric="yes" class="const">
+ <name>Boltzmann constant</name>
+ <printSymbol>
+ <i>k</i>
+ </printSymbol>
+ <property>(unclassified)</property>
+ <value Unit="J/K" UNIT="J/K" value="1.380658e-23">1.380658 × 10<sup>-23</sup>
+ </value>
+ </unit>
+ <unit xmlns="" Code="[eps_0]" CODE="[EPS_0]" isMetric="yes" class="const">
+ <name>permittivity of vacuum</name>
+ <printSymbol>
+ <i>ε<sub>
+ <r>0</r>
+ </sub>
+ </i>
+ </printSymbol>
+ <property>electric permittivity</property>
+ <value Unit="F/m" UNIT="F/M" value="8.854187817e-12">8.854187817 × 10<sup>-12</sup>
+ </value>
+ </unit>
+ <unit xmlns="" Code="[mu_0]" CODE="[MU_0]" isMetric="yes" class="const">
+ <name>permeability of vacuum</name>
+ <printSymbol>
+ <i>μ<sub>
+ <r>0</r>
+ </sub>
+ </i>
+ </printSymbol>
+ <property>magnetic permeability</property>
+ <value Unit="4.[pi].10*-7.N/A2" UNIT="4.[PI].10*-7.N/A2" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[e]" CODE="[E]" isMetric="yes" class="const">
+ <name>elementary charge</name>
+ <printSymbol>
+ <i>e</i>
+ </printSymbol>
+ <property>electric charge</property>
+ <value Unit="C" UNIT="C" value="1.60217733e-19">1.60217733 × 10<sup>-19</sup>
+ </value>
+ </unit>
+ <unit xmlns="" Code="[m_e]" CODE="[M_E]" isMetric="yes" class="const">
+ <name>electron mass</name>
+ <printSymbol>
+ <i>m<sub>
+ <r>e</r>
+ </sub>
+ </i>
+ </printSymbol>
+ <property>mass</property>
+ <value Unit="g" UNIT="g" value="9.1093897e-28">9.1093897 × 10<sup>-28</sup>
+ </value>
+ </unit>
+ <unit xmlns="" Code="[m_p]" CODE="[M_P]" isMetric="yes" class="const">
+ <name>proton mass</name>
+ <printSymbol>
+ <i>m<sub>
+ <r>p</r>
+ </sub>
+ </i>
+ </printSymbol>
+ <property>mass</property>
+ <value Unit="g" UNIT="g" value="1.6726231e-24">1.6726231 × 10<sup>-24</sup>
+ </value>
+ </unit>
+ <unit xmlns="" Code="[G]" CODE="[GC]" isMetric="yes" class="const">
+ <name>Newtonian constant of gravitation</name>
+ <printSymbol>
+ <i>G</i>
+ </printSymbol>
+ <property>(unclassified)</property>
+ <value Unit="m3.kg-1.s-2" UNIT="M3.KG-1.S-2" value="6.67259e-11">6.67259 × 10<sup>-11</sup>
+ </value>
+ </unit>
+ <unit xmlns="" Code="[g]" CODE="[G]" isMetric="yes" class="const">
+ <name>standard acceleration of free fall</name>
+ <printSymbol>
+ <i>g<sub>n</sub>
+ </i>
+ </printSymbol>
+ <property>acceleration</property>
+ <value Unit="m/s2" UNIT="M/S2" value="980665e-5">9.80665</value>
+ </unit>
+ <unit xmlns="" Code="atm" CODE="ATM" isMetric="no" class="const">
+ <name>standard atmosphere</name>
+ <printSymbol>atm</printSymbol>
+ <property>pressure</property>
+ <value Unit="Pa" UNIT="PAL" value="101325">101325</value>
+ </unit>
+ <unit xmlns="" Code="[ly]" CODE="[LY]" isMetric="yes" class="const">
+ <name>light-year</name>
+ <printSymbol>l.y.</printSymbol>
+ <property>length</property>
+ <value Unit="[c].a_j" UNIT="[C].ANN_J" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="gf" CODE="GF" isMetric="yes" class="const">
+ <name>gram-force</name>
+ <printSymbol>gf</printSymbol>
+ <property>force</property>
+ <value Unit="g.[g]" UNIT="G.[G]" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[lbf_av]" CODE="[LBF_AV]" isMetric="no" class="const">
+ <name>pound force</name>
+ <printSymbol>lbf</printSymbol>
+ <property>force</property>
+ <value Unit="[lb_av].[g]" UNIT="[LB_AV].[G]" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="Ky" CODE="KY" isMetric="yes" class="cgs">
+ <name>Kayser</name>
+ <printSymbol>K</printSymbol>
+ <property>lineic number</property>
+ <value Unit="cm-1" UNIT="CM-1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="Gal" CODE="GL" isMetric="yes" class="cgs">
+ <name>Gal</name>
+ <printSymbol>Gal</printSymbol>
+ <property>acceleration</property>
+ <value Unit="cm/s2" UNIT="CM/S2" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="dyn" CODE="DYN" isMetric="yes" class="cgs">
+ <name>dyne</name>
+ <printSymbol>dyn</printSymbol>
+ <property>force</property>
+ <value Unit="g.cm/s2" UNIT="G.CM/S2" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="erg" CODE="ERG" isMetric="yes" class="cgs">
+ <name>erg</name>
+ <printSymbol>erg</printSymbol>
+ <property>energy</property>
+ <value Unit="dyn.cm" UNIT="DYN.CM" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="P" CODE="P" isMetric="yes" class="cgs">
+ <name>Poise</name>
+ <printSymbol>P</printSymbol>
+ <property>dynamic viscosity</property>
+ <value Unit="dyn.s/cm2" UNIT="DYN.S/CM2" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="Bi" CODE="BI" isMetric="yes" class="cgs">
+ <name>Biot</name>
+ <printSymbol>Bi</printSymbol>
+ <property>electric current</property>
+ <value Unit="A" UNIT="A" value="10">10</value>
+ </unit>
+ <unit xmlns="" Code="St" CODE="ST" isMetric="yes" class="cgs">
+ <name>Stokes</name>
+ <printSymbol>St</printSymbol>
+ <property>kinematic viscosity</property>
+ <value Unit="cm2/s" UNIT="CM2/S" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="Mx" CODE="MX" isMetric="yes" class="cgs">
+ <name>Maxwell</name>
+ <printSymbol>Mx</printSymbol>
+ <property>flux of magnetic induction</property>
+ <value Unit="Wb" UNIT="WB" value="1e-8">1 × 10<sup>-8</sup>
+ </value>
+ </unit>
+ <unit xmlns="" Code="G" CODE="GS" isMetric="yes" class="cgs">
+ <name>Gauss</name>
+ <printSymbol>Gs</printSymbol>
+ <property>magnetic flux density</property>
+ <value Unit="T" UNIT="T" value="1e-4">1 × 10<sup>-4</sup>
+ </value>
+ </unit>
+ <unit xmlns="" Code="Oe" CODE="OE" isMetric="yes" class="cgs">
+ <name>Oersted</name>
+ <printSymbol>Oe</printSymbol>
+ <property>magnetic field intensity</property>
+ <value Unit="/[pi].A/m" UNIT="/[PI].A/M" value="250">250</value>
+ </unit>
+ <unit xmlns="" Code="Gb" CODE="GB" isMetric="yes" class="cgs">
+ <name>Gilbert</name>
+ <printSymbol>Gb</printSymbol>
+ <property>magnetic tension</property>
+ <value Unit="Oe.cm" UNIT="OE.CM" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="sb" CODE="SB" isMetric="yes" class="cgs">
+ <name>stilb</name>
+ <printSymbol>sb</printSymbol>
+ <property>lum. intensity density</property>
+ <value Unit="cd/cm2" UNIT="CD/CM2" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="Lmb" CODE="LMB" isMetric="yes" class="cgs">
+ <name>Lambert</name>
+ <printSymbol>L</printSymbol>
+ <property>brightness</property>
+ <value Unit="cd/cm2/[pi]" UNIT="CD/CM2/[PI]" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="ph" CODE="PHT" isMetric="yes" class="cgs">
+ <name>phot</name>
+ <printSymbol>ph</printSymbol>
+ <property>illuminance</property>
+ <value Unit="lx" UNIT="LX" value="1e-4">1 × 10<sup>-4</sup>
+ </value>
+ </unit>
+ <unit xmlns="" Code="Ci" CODE="CI" isMetric="yes" class="cgs">
+ <name>Curie</name>
+ <printSymbol>Ci</printSymbol>
+ <property>radioactivity</property>
+ <value Unit="Bq" UNIT="BQ" value="37e9">3.7 × 10<sup>10</sup>
+ </value>
+ </unit>
+ <unit xmlns="" Code="R" CODE="ROE" isMetric="yes" class="cgs">
+ <name>Roentgen</name>
+ <printSymbol>R</printSymbol>
+ <property>ion dose</property>
+ <value Unit="C/kg" UNIT="C/KG" value="2.58e-4">2.58 × 10<sup>-4</sup>
+ </value>
+ </unit>
+ <unit xmlns="" Code="RAD" CODE="[RAD]" isMetric="yes" class="cgs">
+ <name>radiation absorbed dose</name>
+ <printSymbol>RAD</printSymbol>
+ <property>energy dose</property>
+ <value Unit="erg/g" UNIT="ERG/G" value="100">100</value>
+ </unit>
+ <unit xmlns="" Code="REM" CODE="[REM]" isMetric="yes" class="cgs">
+ <name>radiation equivalent man</name>
+ <printSymbol>REM</printSymbol>
+ <property>dose equivalent</property>
+ <value Unit="RAD" UNIT="[RAD]" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[in_i]" CODE="[IN_I]" isMetric="no" class="intcust">
+ <name>inch</name>
+ <printSymbol>in</printSymbol>
+ <property>length</property>
+ <value Unit="cm" UNIT="CM" value="254e-2">2.54</value>
+ </unit>
+ <unit xmlns="" Code="[ft_i]" CODE="[FT_I]" isMetric="no" class="intcust">
+ <name>foot</name>
+ <printSymbol>ft</printSymbol>
+ <property>length</property>
+ <value Unit="[in_i]" UNIT="[IN_I]" value="12">12</value>
+ </unit>
+ <unit xmlns="" Code="[yd_i]" CODE="[YD_I]" isMetric="no" class="intcust">
+ <name>yard</name>
+ <printSymbol>yd</printSymbol>
+ <property>length</property>
+ <value Unit="[ft_i]" UNIT="[FT_I]" value="3">3</value>
+ </unit>
+ <unit xmlns="" Code="[mi_i]" CODE="[MI_I]" isMetric="no" class="intcust">
+ <name>statute mile</name>
+ <printSymbol>mi</printSymbol>
+ <property>length</property>
+ <value Unit="[ft_i]" UNIT="[FT_I]" value="5280">5280</value>
+ </unit>
+ <unit xmlns="" Code="[fth_i]" CODE="[FTH_I]" isMetric="no" class="intcust">
+ <name>fathom</name>
+ <printSymbol>fth</printSymbol>
+ <property>depth of water</property>
+ <value Unit="[ft_i]" UNIT="[FT_I]" value="6">6</value>
+ </unit>
+ <unit xmlns="" Code="[nmi_i]" CODE="[NMI_I]" isMetric="no" class="intcust">
+ <name>nautical mile</name>
+ <printSymbol>n.mi</printSymbol>
+ <property>length</property>
+ <value Unit="m" UNIT="M" value="1852">1852</value>
+ </unit>
+ <unit xmlns="" Code="[kn_i]" CODE="[KN_I]" isMetric="no" class="intcust">
+ <name>knot</name>
+ <printSymbol>knot</printSymbol>
+ <property>velocity</property>
+ <value Unit="[nmi_i]/h" UNIT="[NMI_I]/H" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[sin_i]" CODE="[SIN_I]" isMetric="no" class="intcust">
+ <name>square inch</name>
+ <property>area</property>
+ <value Unit="[in_i]2" UNIT="[IN_I]2" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[sft_i]" CODE="[SFT_I]" isMetric="no" class="intcust">
+ <name>square foot</name>
+ <property>area</property>
+ <value Unit="[ft_i]2" UNIT="[FT_I]2" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[syd_i]" CODE="[SYD_I]" isMetric="no" class="intcust">
+ <name>square yard</name>
+ <property>area</property>
+ <value Unit="[yd_i]2" UNIT="[YD_I]2" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[cin_i]" CODE="[CIN_I]" isMetric="no" class="intcust">
+ <name>cubic inch</name>
+ <property>volume</property>
+ <value Unit="[in_i]3" UNIT="[IN_I]3" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[cft_i]" CODE="[CFT_I]" isMetric="no" class="intcust">
+ <name>cubic foot</name>
+ <property>volume</property>
+ <value Unit="[ft_i]3" UNIT="[FT_I]3" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[cyd_i]" CODE="[CYD_I]" isMetric="no" class="intcust">
+ <name>cubic yard</name>
+ <printSymbol>cu.yd</printSymbol>
+ <property>volume</property>
+ <value Unit="[yd_i]3" UNIT="[YD_I]3" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[bf_i]" CODE="[BF_I]" isMetric="no" class="intcust">
+ <name>board foot</name>
+ <property>volume</property>
+ <value Unit="[in_i]3" UNIT="[IN_I]3" value="144">144</value>
+ </unit>
+ <unit xmlns="" Code="[cr_i]" CODE="[CR_I]" isMetric="no" class="intcust">
+ <name>cord</name>
+ <property>volume</property>
+ <value Unit="[ft_i]3" UNIT="[FT_I]3" value="128">128</value>
+ </unit>
+ <unit xmlns="" Code="[mil_i]" CODE="[MIL_I]" isMetric="no" class="intcust">
+ <name>mil</name>
+ <printSymbol>mil</printSymbol>
+ <property>length</property>
+ <value Unit="[in_i]" UNIT="[IN_I]" value="1e-3">1 × 10<sup>-3</sup>
+ </value>
+ </unit>
+ <unit xmlns="" Code="[cml_i]" CODE="[CML_I]" isMetric="no" class="intcust">
+ <name>circular mil</name>
+ <printSymbol>circ.mil</printSymbol>
+ <property>area</property>
+ <value Unit="[pi]/4.[mil_i]2" UNIT="[PI]/4.[MIL_I]2" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[hd_i]" CODE="[HD_I]" isMetric="no" class="intcust">
+ <name>hand</name>
+ <printSymbol>hd</printSymbol>
+ <property>height of horses</property>
+ <value Unit="[in_i]" UNIT="[IN_I]" value="4">4</value>
+ </unit>
+ <unit xmlns="" Code="[ft_us]" CODE="[FT_US]" isMetric="no" class="us-lengths">
+ <name>foot</name>
+ <printSymbol>ft<sub>us</sub>
+ </printSymbol>
+ <property>length</property>
+ <value Unit="m/3937" UNIT="M/3937" value="1200">1200</value>
+ </unit>
+ <unit xmlns="" Code="[yd_us]" CODE="[YD_US]" isMetric="no" class="us-lengths">
+ <name>yard</name>
+ <property>length</property>
+ <value Unit="[ft_us]" UNIT="[FT_US]" value="3">3</value>
+ </unit>
+ <unit xmlns="" Code="[in_us]" CODE="[IN_US]" isMetric="no" class="us-lengths">
+ <name>inch</name>
+ <property>length</property>
+ <value Unit="[ft_us]/12" UNIT="[FT_US]/12" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[rd_us]" CODE="[RD_US]" isMetric="no" class="us-lengths">
+ <name>rod</name>
+ <property>length</property>
+ <value Unit="[ft_us]" UNIT="[FT_US]" value="16.5">16.5</value>
+ </unit>
+ <unit xmlns="" Code="[ch_us]" CODE="[CH_US]" isMetric="no" class="us-lengths">
+ <name>Gunter's chain</name>
+ <name>Surveyor's chain</name>
+ <property>length</property>
+ <value Unit="[rd_us]" UNIT="[RD_US]" value="4">4</value>
+ </unit>
+ <unit xmlns="" Code="[lk_us]" CODE="[LK_US]" isMetric="no" class="us-lengths">
+ <name>link for Gunter's chain</name>
+ <property>length</property>
+ <value Unit="[ch_us]/100" UNIT="[CH_US]/100" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[rch_us]" CODE="[RCH_US]" isMetric="no" class="us-lengths">
+ <name>Ramden's chain</name>
+ <name>Engineer's chain</name>
+ <property>length</property>
+ <value Unit="[ft_us]" UNIT="[FT_US]" value="100">100</value>
+ </unit>
+ <unit xmlns="" Code="[rlk_us]" CODE="[RLK_US]" isMetric="no" class="us-lengths">
+ <name>link for Ramden's chain</name>
+ <property>length</property>
+ <value Unit="[rch_us]/100" UNIT="[RCH_US]/100" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[fth_us]" CODE="[FTH_US]" isMetric="no" class="us-lengths">
+ <name>fathom</name>
+ <property>length</property>
+ <value Unit="[ft_us]" UNIT="[FT_US]" value="6">6</value>
+ </unit>
+ <unit xmlns="" Code="[fur_us]" CODE="[FUR_US]" isMetric="no" class="us-lengths">
+ <name>furlong</name>
+ <property>length</property>
+ <value Unit="[rd_us]" UNIT="[RD_US]" value="40">40</value>
+ </unit>
+ <unit xmlns="" Code="[mi_us]" CODE="[MI_US]" isMetric="no" class="us-lengths">
+ <name>mile</name>
+ <property>length</property>
+ <value Unit="[fur_us]" UNIT="[FUR_US]" value="8">8</value>
+ </unit>
+ <unit xmlns="" Code="[acr_us]" CODE="[ACR_US]" isMetric="no" class="us-lengths">
+ <name>acre</name>
+ <property>area</property>
+ <value Unit="[rd_us]2" UNIT="[RD_US]2" value="160">160</value>
+ </unit>
+ <unit xmlns="" Code="[srd_us]" CODE="[SRD_US]" isMetric="no" class="us-lengths">
+ <name>square rod</name>
+ <property>area</property>
+ <value Unit="[rd_us]2" UNIT="[RD_US]2" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[smi_us]" CODE="[SMI_US]" isMetric="no" class="us-lengths">
+ <name>square mile</name>
+ <property>area</property>
+ <value Unit="[mi_us]2" UNIT="[MI_US]2" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[sct]" CODE="[SCT]" isMetric="no" class="us-lengths">
+ <name>section</name>
+ <property>area</property>
+ <value Unit="[mi_us]2" UNIT="[MI_US]2" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[twp]" CODE="[TWP]" isMetric="no" class="us-lengths">
+ <name>township</name>
+ <property>area</property>
+ <value Unit="[sct]" UNIT="[SCT]" value="36">36</value>
+ </unit>
+ <unit xmlns="" Code="[mil_us]" CODE="[MIL_US]" isMetric="no" class="us-lengths">
+ <name>mil</name>
+ <property>length</property>
+ <value Unit="[in_us]" UNIT="[IN_US]" value="1e-3">1 × 10<sup>-3</sup>
+ </value>
+ </unit>
+ <unit xmlns="" Code="[in_br]" CODE="[IN_BR]" isMetric="no" class="brit-length">
+ <name>inch</name>
+ <property>length</property>
+ <value Unit="cm" UNIT="CM" value="2.539998">2.539998</value>
+ </unit>
+ <unit xmlns="" Code="[ft_br]" CODE="[FT_BR]" isMetric="no" class="brit-length">
+ <name>foot</name>
+ <property>length</property>
+ <value Unit="[in_br]" UNIT="[IN_BR]" value="12">12</value>
+ </unit>
+ <unit xmlns="" Code="[rd_br]" CODE="[RD_BR]" isMetric="no" class="brit-length">
+ <name>rod</name>
+ <property>length</property>
+ <value Unit="[ft_br]" UNIT="[FT_BR]" value="16.5">16.5</value>
+ </unit>
+ <unit xmlns="" Code="[ch_br]" CODE="[CH_BR]" isMetric="no" class="brit-length">
+ <name>Gunter's chain</name>
+ <property>length</property>
+ <value Unit="[rd_br]" UNIT="[RD_BR]" value="4">4</value>
+ </unit>
+ <unit xmlns="" Code="[lk_br]" CODE="[LK_BR]" isMetric="no" class="brit-length">
+ <name>link for Gunter's chain</name>
+ <property>length</property>
+ <value Unit="[ch_br]/100" UNIT="[CH_BR]/100" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[fth_br]" CODE="[FTH_BR]" isMetric="no" class="brit-length">
+ <name>fathom</name>
+ <property>length</property>
+ <value Unit="[ft_br]" UNIT="[FT_BR]" value="6">6</value>
+ </unit>
+ <unit xmlns="" Code="[pc_br]" CODE="[PC_BR]" isMetric="no" class="brit-length">
+ <name>pace</name>
+ <property>length</property>
+ <value Unit="[ft_br]" UNIT="[FT_BR]" value="2.5">2.5</value>
+ </unit>
+ <unit xmlns="" Code="[yd_br]" CODE="[YD_BR]" isMetric="no" class="brit-length">
+ <name>yard</name>
+ <property>length</property>
+ <value Unit="[ft_br]" UNIT="[FT_BR]" value="3">3</value>
+ </unit>
+ <unit xmlns="" Code="[mi_br]" CODE="[MI_BR]" isMetric="no" class="brit-length">
+ <name>mile</name>
+ <property>length</property>
+ <value Unit="[ft_br]" UNIT="[FT_BR]" value="5280">5280</value>
+ </unit>
+ <unit xmlns="" Code="[nmi_br]" CODE="[NMI_BR]" isMetric="no" class="brit-length">
+ <name>nautical mile</name>
+ <property>length</property>
+ <value Unit="[ft_br]" UNIT="[FT_BR]" value="6080">6080</value>
+ </unit>
+ <unit xmlns="" Code="[kn_br]" CODE="[KN_BR]" isMetric="no" class="brit-length">
+ <name>knot</name>
+ <property>velocity</property>
+ <value Unit="[nmi_br]/h" UNIT="[NMI_BR]/H" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[acr_br]" CODE="[ACR_BR]" isMetric="no" class="brit-length">
+ <name>acre</name>
+ <property>area</property>
+ <value Unit="[yd_br]2" UNIT="[YD_BR]2" value="4840">4840</value>
+ </unit>
+ <unit xmlns="" Code="[gal_us]" CODE="[GAL_US]" isMetric="no" class="us-volumes">
+ <name>Queen Anne's wine gallon</name>
+ <property>fluid volume</property>
+ <value Unit="[in_i]3" UNIT="[IN_I]3" value="231">231</value>
+ </unit>
+ <unit xmlns="" Code="[bbl_us]" CODE="[BBL_US]" isMetric="no" class="us-volumes">
+ <name>barrel</name>
+ <property>fluid volume</property>
+ <value Unit="[gal_us]" UNIT="[GAL_US]" value="42">42</value>
+ </unit>
+ <unit xmlns="" Code="[qt_us]" CODE="[QT_US]" isMetric="no" class="us-volumes">
+ <name>quart</name>
+ <property>fluid volume</property>
+ <value Unit="[gal_us]/4" UNIT="[GAL_US]/4" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[pt_us]" CODE="[PT_US]" isMetric="no" class="us-volumes">
+ <name>pint</name>
+ <property>fluid volume</property>
+ <value Unit="[qt_us]/2" UNIT="[QT_US]/2" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[gil_us]" CODE="[GIL_US]" isMetric="no" class="us-volumes">
+ <name>gill</name>
+ <property>fluid volume</property>
+ <value Unit="[pt_us]/4" UNIT="[PT_US]/4" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[foz_us]" CODE="[FOZ_US]" isMetric="no" class="us-volumes">
+ <name>fluid ounce</name>
+ <printSymbol>oz fl</printSymbol>
+ <property>fluid volume</property>
+ <value Unit="[gil_us]/4" UNIT="[GIL_US]/4" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[fdr_us]" CODE="[FDR_US]" isMetric="no" class="us-volumes">
+ <name>fluid dram</name>
+ <property>fluid volume</property>
+ <value Unit="[foz_us]/8" UNIT="[FOZ_US]/8" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[min_us]" CODE="[MIN_US]" isMetric="no" class="us-volumes">
+ <name>minim</name>
+ <property>fluid volume</property>
+ <value Unit="[fdr_us]/60" UNIT="[FDR_US]/60" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[crd_us]" CODE="[CRD_US]" isMetric="no" class="us-volumes">
+ <name>cord</name>
+ <property>fluid volume</property>
+ <value Unit="[ft_i]3" UNIT="[FT_I]3" value="128">128</value>
+ </unit>
+ <unit xmlns="" Code="[bu_us]" CODE="[BU_US]" isMetric="no" class="us-volumes">
+ <name>bushel</name>
+ <property>dry volume</property>
+ <value Unit="[in_i]3" UNIT="[IN_I]3" value="2150.42">2150.42</value>
+ </unit>
+ <unit xmlns="" Code="[gal_wi]" CODE="[GAL_WI]" isMetric="no" class="us-volumes">
+ <name>historical winchester gallon</name>
+ <property>dry volume</property>
+ <value Unit="[bu_us]/8" UNIT="[BU_US]/8" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[pk_us]" CODE="[PK_US]" isMetric="no" class="us-volumes">
+ <name>peck</name>
+ <property>dry volume</property>
+ <value Unit="[bu_us]/4" UNIT="[BU_US]/4" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[dqt_us]" CODE="[DQT_US]" isMetric="no" class="us-volumes">
+ <name>dry quart</name>
+ <property>dry volume</property>
+ <value Unit="[pk_us]/8" UNIT="[PK_US]/8" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[dpt_us]" CODE="[DPT_US]" isMetric="no" class="us-volumes">
+ <name>dry pint</name>
+ <property>dry volume</property>
+ <value Unit="[dqt_us]/2" UNIT="[DQT_US]/2" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[tbs_us]" CODE="[TBS_US]" isMetric="no" class="us-volumes">
+ <name>tablespoon</name>
+ <property>volume</property>
+ <value Unit="[foz_us]/2" UNIT="[FOZ_US]/2" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[tsp_us]" CODE="[TSP_US]" isMetric="no" class="us-volumes">
+ <name>teaspoon</name>
+ <property>volume</property>
+ <value Unit="[tbs_us]/3" UNIT="[TBS_US]/3" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[cup_us]" CODE="[CUP_US]" isMetric="no" class="us-volumes">
+ <name>cup</name>
+ <property>volume</property>
+ <value Unit="[tbs_us]" UNIT="[TBS_US]" value="16">16</value>
+ </unit>
+ <unit xmlns="" Code="[foz_m]" CODE="[FOZ_M]" isMetric="no" class="us-volumes">
+ <name>metric fluid ounce</name>
+ <printSymbol>oz fl</printSymbol>
+ <property>fluid volume</property>
+ <value Unit="mL" UNIT="ML" value="30">30</value>
+ </unit>
+ <unit xmlns="" Code="[cup_m]" CODE="[CUP_M]" isMetric="no" class="us-volumes">
+ <name>metric cup</name>
+ <property>volume</property>
+ <value Unit="mL" UNIT="ML" value="240">240</value>
+ </unit>
+ <unit xmlns="" Code="[tsp_m]" CODE="[TSP_M]" isMetric="no" class="us-volumes">
+ <name>metric teaspoon</name>
+ <property>volume</property>
+ <value Unit="mL" UNIT="mL" value="5">5</value>
+ </unit>
+ <unit xmlns="" Code="[tbs_m]" CODE="[TBS_M]" isMetric="no" class="us-volumes">
+ <name>metric tablespoon</name>
+ <property>volume</property>
+ <value Unit="mL" UNIT="mL" value="15">15</value>
+ </unit>
+ <unit xmlns="" Code="[gal_br]" CODE="[GAL_BR]" isMetric="no" class="brit-volumes">
+ <name>gallon</name>
+ <property>volume</property>
+ <value Unit="l" UNIT="L" value="4.54609">4.54609</value>
+ </unit>
+ <unit xmlns="" Code="[pk_br]" CODE="[PK_BR]" isMetric="no" class="brit-volumes">
+ <name>peck</name>
+ <property>volume</property>
+ <value Unit="[gal_br]" UNIT="[GAL_BR]" value="2">2</value>
+ </unit>
+ <unit xmlns="" Code="[bu_br]" CODE="[BU_BR]" isMetric="no" class="brit-volumes">
+ <name>bushel</name>
+ <property>volume</property>
+ <value Unit="[pk_br]" UNIT="[PK_BR]" value="4">4</value>
+ </unit>
+ <unit xmlns="" Code="[qt_br]" CODE="[QT_BR]" isMetric="no" class="brit-volumes">
+ <name>quart</name>
+ <property>volume</property>
+ <value Unit="[gal_br]/4" UNIT="[GAL_BR]/4" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[pt_br]" CODE="[PT_BR]" isMetric="no" class="brit-volumes">
+ <name>pint</name>
+ <property>volume</property>
+ <value Unit="[qt_br]/2" UNIT="[QT_BR]/2" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[gil_br]" CODE="[GIL_BR]" isMetric="no" class="brit-volumes">
+ <name>gill</name>
+ <property>volume</property>
+ <value Unit="[pt_br]/4" UNIT="[PT_BR]/4" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[foz_br]" CODE="[FOZ_BR]" isMetric="no" class="brit-volumes">
+ <name>fluid ounce</name>
+ <property>volume</property>
+ <value Unit="[gil_br]/5" UNIT="[GIL_BR]/5" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[fdr_br]" CODE="[FDR_BR]" isMetric="no" class="brit-volumes">
+ <name>fluid dram</name>
+ <property>volume</property>
+ <value Unit="[foz_br]/8" UNIT="[FOZ_BR]/8" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[min_br]" CODE="[MIN_BR]" isMetric="no" class="brit-volumes">
+ <name>minim</name>
+ <property>volume</property>
+ <value Unit="[fdr_br]/60" UNIT="[FDR_BR]/60" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[gr]" CODE="[GR]" isMetric="no" class="avoirdupois">
+ <name>grain</name>
+ <property>mass</property>
+ <value Unit="mg" UNIT="MG" value="64.79891">64.79891</value>
+ </unit>
+ <unit xmlns="" Code="[lb_av]" CODE="[LB_AV]" isMetric="no" class="avoirdupois">
+ <name>pound</name>
+ <printSymbol>lb</printSymbol>
+ <property>mass</property>
+ <value Unit="[gr]" UNIT="[GR]" value="7000">7000</value>
+ </unit>
+ <unit xmlns="" Code="[oz_av]" CODE="[OZ_AV]" isMetric="no" class="avoirdupois">
+ <name>ounce</name>
+ <printSymbol>oz</printSymbol>
+ <property>mass</property>
+ <value Unit="[lb_av]/16" UNIT="[LB_AV]/16" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[dr_av]" CODE="[DR_AV]" isMetric="no" class="avoirdupois">
+ <name>dram</name>
+ <property>mass</property>
+ <value Unit="[oz_av]/16" UNIT="[OZ_AV]/16" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[scwt_av]" CODE="[SCWT_AV]" isMetric="no" class="avoirdupois">
+ <name>short hundredweight</name>
+ <name>U.S. hundredweight</name>
+ <property>mass</property>
+ <value Unit="[lb_av]" UNIT="[LB_AV]" value="100">100</value>
+ </unit>
+ <unit xmlns="" Code="[lcwt_av]" CODE="[LCWT_AV]" isMetric="no" class="avoirdupois">
+ <name>long hunderdweight</name>
+ <name>British hundredweight</name>
+ <property>mass</property>
+ <value Unit="[lb_av]" UNIT="[LB_AV]" value="112">112</value>
+ </unit>
+ <unit xmlns="" Code="[ston_av]" CODE="[STON_AV]" isMetric="no" class="avoirdupois">
+ <name>short ton</name>
+ <name>U.S. ton</name>
+ <property>mass</property>
+ <value Unit="[scwt_av]" UNIT="[SCWT_AV]" value="20">20</value>
+ </unit>
+ <unit xmlns="" Code="[lton_av]" CODE="[LTON_AV]" isMetric="no" class="avoirdupois">
+ <name>long ton</name>
+ <name>British ton</name>
+ <property>mass</property>
+ <value Unit="[lcwt_av]" UNIT="[LCWT_AV]" value="20">20</value>
+ </unit>
+ <unit xmlns="" Code="[stone_av]" CODE="[STONE_AV]" isMetric="no" class="avoirdupois">
+ <name>stone</name>
+ <name>British stone</name>
+ <property>mass</property>
+ <value Unit="[lb_av]" UNIT="[LB_AV]" value="14">14</value>
+ </unit>
+ <unit xmlns="" Code="[pwt_tr]" CODE="[PWT_TR]" isMetric="no" class="troy">
+ <name>pennyweight</name>
+ <property>mass</property>
+ <value Unit="[gr]" UNIT="[GR]" value="24">24</value>
+ </unit>
+ <unit xmlns="" Code="[oz_tr]" CODE="[OZ_TR]" isMetric="no" class="troy">
+ <name>ounce</name>
+ <property>mass</property>
+ <value Unit="[pwt_tr]" UNIT="[PWT_TR]" value="20">20</value>
+ </unit>
+ <unit xmlns="" Code="[lb_tr]" CODE="[LB_TR]" isMetric="no" class="troy">
+ <name>pound</name>
+ <property>mass</property>
+ <value Unit="[oz_tr]" UNIT="[OZ_TR]" value="12">12</value>
+ </unit>
+ <unit xmlns="" Code="[sc_ap]" CODE="[SC_AP]" isMetric="no" class="apoth">
+ <name>scruple</name>
+ <property>mass</property>
+ <value Unit="[gr]" UNIT="[GR]" value="20">20</value>
+ </unit>
+ <unit xmlns="" Code="[dr_ap]" CODE="[DR_AP]" isMetric="no" class="apoth">
+ <name>dram</name>
+ <name>drachm</name>
+ <property>mass</property>
+ <value Unit="[sc_ap]" UNIT="[SC_AP]" value="3">3</value>
+ </unit>
+ <unit xmlns="" Code="[oz_ap]" CODE="[OZ_AP]" isMetric="no" class="apoth">
+ <name>ounce</name>
+ <property>mass</property>
+ <value Unit="[dr_ap]" UNIT="[DR_AP]" value="8">8</value>
+ </unit>
+ <unit xmlns="" Code="[lb_ap]" CODE="[LB_AP]" isMetric="no" class="apoth">
+ <name>pound</name>
+ <property>mass</property>
+ <value Unit="[oz_ap]" UNIT="[OZ_AP]" value="12">12</value>
+ </unit>
+ <unit xmlns="" Code="[oz_m]" CODE="[OZ_M]" isMetric="no" class="apoth">
+ <name>metric ounce</name>
+ <property>mass</property>
+ <value Unit="g" UNIT="g" value="28">28</value>
+ </unit>
+ <unit xmlns="" Code="[lne]" CODE="[LNE]" isMetric="no" class="typeset">
+ <name>line</name>
+ <property>length</property>
+ <value Unit="[in_i]/12" UNIT="[IN_I]/12" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[pnt]" CODE="[PNT]" isMetric="no" class="typeset">
+ <name>point</name>
+ <property>length</property>
+ <value Unit="[lne]/6" UNIT="[LNE]/6" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[pca]" CODE="[PCA]" isMetric="no" class="typeset">
+ <name>pica</name>
+ <property>length</property>
+ <value Unit="[pnt]" UNIT="[PNT]" value="12">12</value>
+ </unit>
+ <unit xmlns="" Code="[pnt_pr]" CODE="[PNT_PR]" isMetric="no" class="typeset">
+ <name>Printer's point</name>
+ <property>length</property>
+ <value Unit="[in_i]" UNIT="[IN_I]" value="0.013837">0.013837</value>
+ </unit>
+ <unit xmlns="" Code="[pca_pr]" CODE="[PCA_PR]" isMetric="no" class="typeset">
+ <name>Printer's pica</name>
+ <property>length</property>
+ <value Unit="[pnt_pr]" UNIT="[PNT_PR]" value="12">12</value>
+ </unit>
+ <unit xmlns="" Code="[pied]" CODE="[PIED]" isMetric="no" class="typeset">
+ <name>pied</name>
+ <name>French foot</name>
+ <property>length</property>
+ <value Unit="cm" UNIT="CM" value="32.48">32.48</value>
+ </unit>
+ <unit xmlns="" Code="[pouce]" CODE="[POUCE]" isMetric="no" class="typeset">
+ <name>pouce</name>
+ <name>French inch</name>
+ <property>length</property>
+ <value Unit="[pied]/12" UNIT="[PIED]/12" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[ligne]" CODE="[LIGNE]" isMetric="no" class="typeset">
+ <name>ligne</name>
+ <name>French line</name>
+ <property>length</property>
+ <value Unit="[pouce]/12" UNIT="[POUCE]/12" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[didot]" CODE="[DIDOT]" isMetric="no" class="typeset">
+ <name>didot</name>
+ <name>Didot's point</name>
+ <property>length</property>
+ <value Unit="[ligne]/6" UNIT="[LIGNE]/6" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[cicero]" CODE="[CICERO]" isMetric="no" class="typeset">
+ <name>cicero</name>
+ <name>Didot's pica</name>
+ <property>length</property>
+ <value Unit="[didot]" UNIT="[DIDOT]" value="12">12</value>
+ </unit>
+ <unit xmlns="" Code="[degF]" CODE="[DEGF]" isMetric="no" isSpecial="yes" class="heat">
+ <name>degree Fahrenheit</name>
+ <printSymbol>°F</printSymbol>
+ <property>temperature</property>
+ <value Unit="degf(5 K/9)" UNIT="DEGF(5 K/9)">
+ <function name="degF" value="5" Unit="K/9"/>
+ </value>
+ </unit>
+ <unit xmlns="" Code="[degR]" CODE="[degR]" isMetric="no" class="heat">
+ <name>degree Rankine</name>
+ <printSymbol>°R</printSymbol>
+ <property>temperature</property>
+ <value value="5" Unit="K/9" UNIT="K/9">5</value>
+ </unit>
+ <unit xmlns="" Code="cal_[15]" CODE="CAL_[15]" isMetric="yes" class="heat">
+ <name>calorie at 15 °C</name>
+ <printSymbol>cal<sub>15°C</sub>
+ </printSymbol>
+ <property>energy</property>
+ <value Unit="J" UNIT="J" value="4.18580">4.18580</value>
+ </unit>
+ <unit xmlns="" Code="cal_[20]" CODE="CAL_[20]" isMetric="yes" class="heat">
+ <name>calorie at 20 °C</name>
+ <printSymbol>cal<sub>20°C</sub>
+ </printSymbol>
+ <property>energy</property>
+ <value Unit="J" UNIT="J" value="4.18190">4.18190</value>
+ </unit>
+ <unit xmlns="" Code="cal_m" CODE="CAL_M" isMetric="yes" class="heat">
+ <name>mean calorie</name>
+ <printSymbol>cal<sub>m</sub>
+ </printSymbol>
+ <property>energy</property>
+ <value Unit="J" UNIT="J" value="4.19002">4.19002</value>
+ </unit>
+ <unit xmlns="" Code="cal_IT" CODE="CAL_IT" isMetric="yes" class="heat">
+ <name>international table calorie</name>
+ <printSymbol>cal<sub>IT</sub>
+ </printSymbol>
+ <property>energy</property>
+ <value Unit="J" UNIT="J" value="4.1868">4.1868</value>
+ </unit>
+ <unit xmlns="" Code="cal_th" CODE="CAL_TH" isMetric="yes" class="heat">
+ <name>thermochemical calorie</name>
+ <printSymbol>cal<sub>th</sub>
+ </printSymbol>
+ <property>energy</property>
+ <value Unit="J" UNIT="J" value="4.184">4.184</value>
+ </unit>
+ <unit xmlns="" Code="cal" CODE="CAL" isMetric="yes" class="heat">
+ <name>calorie</name>
+ <printSymbol>cal</printSymbol>
+ <property>energy</property>
+ <value Unit="cal_th" UNIT="CAL_TH" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[Cal]" CODE="[CAL]" isMetric="no" class="heat">
+ <name>nutrition label Calories</name>
+ <printSymbol>Cal</printSymbol>
+ <property>energy</property>
+ <value Unit="kcal_th" UNIT="KCAL_TH" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[Btu_39]" CODE="[BTU_39]" isMetric="no" class="heat">
+ <name>British thermal unit at 39 °F</name>
+ <printSymbol>Btu<sub>39°F</sub>
+ </printSymbol>
+ <property>energy</property>
+ <value Unit="kJ" UNIT="kJ" value="1.05967">1.05967</value>
+ </unit>
+ <unit xmlns="" Code="[Btu_59]" CODE="[BTU_59]" isMetric="no" class="heat">
+ <name>British thermal unit at 59 °F</name>
+ <printSymbol>Btu<sub>59°F</sub>
+ </printSymbol>
+ <property>energy</property>
+ <value Unit="kJ" UNIT="kJ" value="1.05480">1.05480</value>
+ </unit>
+ <unit xmlns="" Code="[Btu_60]" CODE="[BTU_60]" isMetric="no" class="heat">
+ <name>British thermal unit at 60 °F</name>
+ <printSymbol>Btu<sub>60°F</sub>
+ </printSymbol>
+ <property>energy</property>
+ <value Unit="kJ" UNIT="kJ" value="1.05468">1.05468</value>
+ </unit>
+ <unit xmlns="" Code="[Btu_m]" CODE="[BTU_M]" isMetric="no" class="heat">
+ <name>mean British thermal unit</name>
+ <printSymbol>Btu<sub>m</sub>
+ </printSymbol>
+ <property>energy</property>
+ <value Unit="kJ" UNIT="kJ" value="1.05587">1.05587</value>
+ </unit>
+ <unit xmlns="" Code="[Btu_IT]" CODE="[BTU_IT]" isMetric="no" class="heat">
+ <name>international table British thermal unit</name>
+ <printSymbol>Btu<sub>IT</sub>
+ </printSymbol>
+ <property>energy</property>
+ <value Unit="kJ" UNIT="kJ" value="1.05505585262">1.05505585262</value>
+ </unit>
+ <unit xmlns="" Code="[Btu_th]" CODE="[BTU_TH]" isMetric="no" class="heat">
+ <name>thermochemical British thermal unit</name>
+ <printSymbol>Btu<sub>th</sub>
+ </printSymbol>
+ <property>energy</property>
+ <value Unit="kJ" UNIT="kJ" value="1.054350">1.054350</value>
+ </unit>
+ <unit xmlns="" Code="[Btu]" CODE="[BTU]" isMetric="no" class="heat">
+ <name>British thermal unit</name>
+ <printSymbol>btu</printSymbol>
+ <property>energy</property>
+ <value Unit="[Btu_th]" UNIT="[BTU_TH]" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[HP]" CODE="[HP]" isMetric="no" class="heat">
+ <name>horsepower</name>
+ <property>power</property>
+ <value Unit="[ft_i].[lbf_av]/s" UNIT="[FT_I].[LBF_AV]/S" value="550">550</value>
+ </unit>
+ <unit xmlns="" Code="tex" CODE="TEX" isMetric="yes" class="heat">
+ <name>tex</name>
+ <printSymbol>tex</printSymbol>
+ <property>linear mass density (of textile thread)</property>
+ <value value="1" Unit="g/km" UNIT="G/KM">1</value>
+ </unit>
+ <unit xmlns="" Code="[den]" CODE="[DEN]" isMetric="no" class="heat">
+ <name>Denier</name>
+ <printSymbol>den</printSymbol>
+ <property>linear mass density (of textile thread)</property>
+ <value value="1" Unit="g/9/km" UNIT="G/9/KM">1</value>
+ </unit>
+ <unit xmlns="" Code="m[H2O]" CODE="M[H2O]" isMetric="yes" class="clinical">
+ <name>meter of water column</name>
+ <printSymbol>m H<sub>
+ <r>2</r>
+ </sub>O</printSymbol>
+ <property>pressure</property>
+ <value Unit="kPa" UNIT="KPAL" value="980665e-5">9.80665</value>
+ </unit>
+ <unit xmlns="" Code="m[Hg]" CODE="M[HG]" isMetric="yes" class="clinical">
+ <name>meter of mercury column</name>
+ <printSymbol>m Hg</printSymbol>
+ <property>pressure</property>
+ <value Unit="kPa" UNIT="KPAL" value="133.3220">133.3220</value>
+ </unit>
+ <unit xmlns="" Code="[in_i'H2O]" CODE="[IN_I'H2O]" isMetric="no" class="clinical">
+ <name>inch of water column</name>
+ <printSymbol>in H<sub>
+ <r>2</r>
+ </sub>O</printSymbol>
+ <property>pressure</property>
+ <value Unit="m[H2O].[in_i]/m" UNIT="M[H2O].[IN_I]/M" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[in_i'Hg]" CODE="[IN_I'HG]" isMetric="no" class="clinical">
+ <name>inch of mercury column</name>
+ <printSymbol>in Hg</printSymbol>
+ <property>pressure</property>
+ <value Unit="m[Hg].[in_i]/m" UNIT="M[HG].[IN_I]/M" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[PRU]" CODE="[PRU]" isMetric="no" class="clinical">
+ <name>peripheral vascular resistance unit</name>
+ <printSymbol>P.R.U.</printSymbol>
+ <property>fluid resistance</property>
+ <value Unit="mm[Hg].s/ml" UNIT="MM[HG].S/ML" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[wood'U]" CODE="[WOOD'U]" isMetric="no" class="clinical">
+ <name>Wood unit</name>
+ <printSymbol>Wood U.</printSymbol>
+ <property>fluid resistance</property>
+ <value Unit="mm[Hg].min/L" UNIT="MM[HG].MIN/L" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[diop]" CODE="[DIOP]" isMetric="no" class="clinical">
+ <name>diopter</name>
+ <printSymbol>dpt</printSymbol>
+ <property>refraction of a lens</property>
+ <value Unit="/m" UNIT="/M" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[p'diop]" CODE="[P'DIOP]" isMetric="no" isSpecial="yes"
+ class="clinical">
+ <name>prism diopter</name>
+ <printSymbol>PD</printSymbol>
+ <property>refraction of a prism</property>
+ <value Unit="100tan(1 rad)" UNIT="100TAN(1 RAD)">
+ <function name="tanTimes100" value="1" Unit="deg"/>
+ </value>
+ </unit>
+ <unit xmlns="" Code="%[slope]" CODE="%[SLOPE]" isMetric="no" isSpecial="yes"
+ class="clinical">
+ <name>percent of slope</name>
+ <printSymbol>%</printSymbol>
+ <property>slope</property>
+ <value Unit="100tan(1 rad)" UNIT="100TAN(1 RAD)">
+ <function name="100tan" value="1" Unit="deg"/>
+ </value>
+ </unit>
+ <unit xmlns="" Code="[mesh_i]" CODE="[MESH_I]" isMetric="no" class="clinical">
+ <name>mesh</name>
+ <property>lineic number</property>
+ <value Unit="/[in_i]" UNIT="/[IN_I]" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[Ch]" CODE="[CH]" isMetric="no" class="clinical">
+ <name>Charrière</name>
+ <name>french</name>
+ <printSymbol>Ch</printSymbol>
+ <property>gauge of catheters</property>
+ <value Unit="mm/3" UNIT="MM/3" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[drp]" CODE="[DRP]" isMetric="no" class="clinical">
+ <name>drop</name>
+ <printSymbol>drp</printSymbol>
+ <property>volume</property>
+ <value Unit="ml/20" UNIT="ML/20" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[hnsf'U]" CODE="[HNSF'U]" isMetric="no" class="clinical">
+ <name>Hounsfield unit</name>
+ <printSymbol>HF</printSymbol>
+ <property>x-ray attenuation</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[MET]" CODE="[MET]" isMetric="no" class="clinical">
+ <name>metabolic equivalent</name>
+ <printSymbol>MET</printSymbol>
+ <property>metabolic cost of physical activity</property>
+ <value Unit="mL/min/kg" UNIT="ML/MIN/KG" value="3.5">3.5</value>
+ </unit>
+ <unit xmlns="" Code="[hp'_X]" CODE="[HP'_X]" isMetric="no" isSpecial="yes"
+ class="clinical">
+ <name>homeopathic potency of decimal series (retired)</name>
+ <printSymbol>X</printSymbol>
+ <property>homeopathic potency (retired)</property>
+ <value Unit="hpX(1 1)" UNIT="HPX(1 1)">
+ <function name="hpX" value="1" Unit="1"/>
+ </value>
+ </unit>
+ <unit xmlns="" Code="[hp'_C]" CODE="[HP'_C]" isMetric="no" isSpecial="yes"
+ class="clinical">
+ <name>homeopathic potency of centesimal series (retired)</name>
+ <printSymbol>C</printSymbol>
+ <property>homeopathic potency (retired)</property>
+ <value Unit="hpC(1 1)" UNIT="HPC(1 1)">
+ <function name="hpC" value="1" Unit="1"/>
+ </value>
+ </unit>
+ <unit xmlns="" Code="[hp'_M]" CODE="[HP'_M]" isMetric="no" isSpecial="yes"
+ class="clinical">
+ <name>homeopathic potency of millesimal series (retired)</name>
+ <printSymbol>M</printSymbol>
+ <property>homeopathic potency (retired)</property>
+ <value Unit="hpM(1 1)" UNIT="HPM(1 1)">
+ <function name="hpM" value="1" Unit="1"/>
+ </value>
+ </unit>
+ <unit xmlns="" Code="[hp'_Q]" CODE="[HP'_Q]" isMetric="no" isSpecial="yes"
+ class="clinical">
+ <name>homeopathic potency of quintamillesimal series (retired)</name>
+ <printSymbol>Q</printSymbol>
+ <property>homeopathic potency (retired)</property>
+ <value Unit="hpQ(1 1)" UNIT="HPQ(1 1)">
+ <function name="hpQ" value="1" Unit="1"/>
+ </value>
+ </unit>
+ <unit xmlns="" Code="[hp_X]" CODE="[HP_X]" isMetric="no" isArbitrary="yes"
+ class="clinical">
+ <name>homeopathic potency of decimal hahnemannian series</name>
+ <printSymbol>X</printSymbol>
+ <property>homeopathic potency (Hahnemann)</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[hp_C]" CODE="[HP_C]" isMetric="no" isArbitrary="yes"
+ class="clinical">
+ <name>homeopathic potency of centesimal hahnemannian series</name>
+ <printSymbol>C</printSymbol>
+ <property>homeopathic potency (Hahnemann)</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[hp_M]" CODE="[HP_M]" isMetric="no" isArbitrary="yes"
+ class="clinical">
+ <name>homeopathic potency of millesimal hahnemannian series</name>
+ <printSymbol>M</printSymbol>
+ <property>homeopathic potency (Hahnemann)</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[hp_Q]" CODE="[HP_Q]" isMetric="no" isArbitrary="yes"
+ class="clinical">
+ <name>homeopathic potency of quintamillesimal hahnemannian series</name>
+ <printSymbol>Q</printSymbol>
+ <property>homeopathic potency (Hahnemann)</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[kp_X]" CODE="[KP_X]" isMetric="no" isArbitrary="yes"
+ class="clinical">
+ <name>homeopathic potency of decimal korsakovian series</name>
+ <printSymbol>X</printSymbol>
+ <property>homeopathic potency (Korsakov)</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[kp_C]" CODE="[KP_C]" isMetric="no" isArbitrary="yes"
+ class="clinical">
+ <name>homeopathic potency of centesimal korsakovian series</name>
+ <printSymbol>C</printSymbol>
+ <property>homeopathic potency (Korsakov)</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[kp_M]" CODE="[KP_M]" isMetric="no" isArbitrary="yes"
+ class="clinical">
+ <name>homeopathic potency of millesimal korsakovian series</name>
+ <printSymbol>M</printSymbol>
+ <property>homeopathic potency (Korsakov)</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[kp_Q]" CODE="[KP_Q]" isMetric="no" isArbitrary="yes"
+ class="clinical">
+ <name>homeopathic potency of quintamillesimal korsakovian series</name>
+ <printSymbol>Q</printSymbol>
+ <property>homeopathic potency (Korsakov)</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="eq" CODE="EQ" isMetric="yes" class="chemical">
+ <name>equivalents</name>
+ <printSymbol>eq</printSymbol>
+ <property>amount of substance</property>
+ <value Unit="mol" UNIT="MOL" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="osm" CODE="OSM" isMetric="yes" class="chemical">
+ <name>osmole</name>
+ <printSymbol>osm</printSymbol>
+ <property>amount of substance (dissolved particles)</property>
+ <value Unit="mol" UNIT="MOL" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[pH]" CODE="[PH]" isMetric="no" isSpecial="yes" class="chemical">
+ <name>pH</name>
+ <printSymbol>pH</printSymbol>
+ <property>acidity</property>
+ <value Unit="pH(1 mol/l)" UNIT="PH(1 MOL/L)">
+ <function name="pH" value="1" Unit="mol/l"/>
+ </value>
+ </unit>
+ <unit xmlns="" Code="g%" CODE="G%" isMetric="yes" class="chemical">
+ <name>gram percent</name>
+ <printSymbol>g%</printSymbol>
+ <property>mass concentration</property>
+ <value Unit="g/dl" UNIT="G/DL" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[S]" CODE="[S]" isMetric="no" class="chemical">
+ <name>Svedberg unit</name>
+ <printSymbol>S</printSymbol>
+ <property>sedimentation coefficient</property>
+ <value Unit="10*-13.s" UNIT="10*-13.S" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[HPF]" CODE="[HPF]" isMetric="no" class="chemical">
+ <name>high power field</name>
+ <printSymbol>HPF</printSymbol>
+ <property>view area in microscope</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[LPF]" CODE="[LPF]" isMetric="no" class="chemical">
+ <name>low power field</name>
+ <printSymbol>LPF</printSymbol>
+ <property>view area in microscope</property>
+ <value Unit="1" UNIT="1" value="100">100</value>
+ </unit>
+ <unit xmlns="" Code="kat" CODE="KAT" isMetric="yes" class="chemical">
+ <name>katal</name>
+ <printSymbol>kat</printSymbol>
+ <property>catalytic activity</property>
+ <value Unit="mol/s" UNIT="MOL/S" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="U" CODE="U" isMetric="yes" class="chemical">
+ <name>Unit</name>
+ <printSymbol>U</printSymbol>
+ <property>catalytic activity</property>
+ <value Unit="umol/min" UNIT="UMOL/MIN" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[iU]" CODE="[IU]" isMetric="yes" isArbitrary="yes"
+ class="chemical">
+ <name>international unit</name>
+ <printSymbol>IU</printSymbol>
+ <property>arbitrary</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[IU]" CODE="[IU]" isMetric="yes" isArbitrary="yes"
+ class="chemical">
+ <name>international unit</name>
+ <printSymbol>i.U.</printSymbol>
+ <property>arbitrary</property>
+ <value Unit="[iU]" UNIT="[IU]" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[arb'U]" CODE="[ARB'U]" isMetric="no" isArbitrary="yes"
+ class="chemical">
+ <name>arbitary unit</name>
+ <printSymbol>arb. U</printSymbol>
+ <property>arbitrary</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[USP'U]" CODE="[USP'U]" isMetric="no" isArbitrary="yes"
+ class="chemical">
+ <name>United States Pharmacopeia unit</name>
+ <printSymbol>U.S.P.</printSymbol>
+ <property>arbitrary</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[GPL'U]" CODE="[GPL'U]" isMetric="no" isArbitrary="yes"
+ class="chemical">
+ <name>GPL unit</name>
+ <property>biologic activity of anticardiolipin IgG</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[MPL'U]" CODE="[MPL'U]" isMetric="no" isArbitrary="yes"
+ class="chemical">
+ <name>MPL unit</name>
+ <property>biologic activity of anticardiolipin IgM</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[APL'U]" CODE="[APL'U]" isMetric="no" isArbitrary="yes"
+ class="chemical">
+ <name>APL unit</name>
+ <property>biologic activity of anticardiolipin IgA</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[beth'U]" CODE="[BETH'U]" isMetric="no" isArbitrary="yes"
+ class="chemical">
+ <name>Bethesda unit</name>
+ <property>biologic activity of factor VIII inhibitor</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[anti'Xa'U]" CODE="[ANTI'XA'U]" isMetric="no" isArbitrary="yes"
+ class="chemical">
+ <name>anti factor Xa unit</name>
+ <property>biologic activity of factor Xa inhibitor (heparin)</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[todd'U]" CODE="[TODD'U]" isMetric="no" isArbitrary="yes"
+ class="chemical">
+ <name>Todd unit</name>
+ <property>biologic activity antistreptolysin O</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[dye'U]" CODE="[DYE'U]" isMetric="no" isArbitrary="yes"
+ class="chemical">
+ <name>Dye unit</name>
+ <property>biologic activity of amylase</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[smgy'U]" CODE="[SMGY'U]" isMetric="no" isArbitrary="yes"
+ class="chemical">
+ <name>Somogyi unit</name>
+ <property>biologic activity of amylase</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[bdsk'U]" CODE="[BDSK'U]" isMetric="no" isArbitrary="yes"
+ class="chemical">
+ <name>Bodansky unit</name>
+ <property>biologic activity of phosphatase</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[ka'U]" CODE="[KA'U]" isMetric="no" isArbitrary="yes"
+ class="chemical">
+ <name>King-Armstrong unit</name>
+ <property>biologic activity of phosphatase</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[knk'U]" CODE="[KNK'U]" isMetric="no" isArbitrary="yes"
+ class="chemical">
+ <name>Kunkel unit</name>
+ <property>arbitrary biologic activity</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[mclg'U]" CODE="[MCLG'U]" isMetric="no" isArbitrary="yes"
+ class="chemical">
+ <name>Mac Lagan unit</name>
+ <property>arbitrary biologic activity</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[tb'U]" CODE="[TB'U]" isMetric="no" isArbitrary="yes"
+ class="chemical">
+ <name>tuberculin unit</name>
+ <property>biologic activity of tuberculin</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[CCID_50]" CODE="[CCID_50]" isMetric="no" isArbitrary="yes"
+ class="chemical">
+ <name>50% cell culture infectious dose</name>
+ <printSymbol>CCID<sub>50</sub>
+ </printSymbol>
+ <property>biologic activity (infectivity) of an infectious agent preparation</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[TCID_50]" CODE="[TCID_50]" isMetric="no" isArbitrary="yes"
+ class="chemical">
+ <name>50% tissue culture infectious dose</name>
+ <printSymbol>TCID<sub>50</sub>
+ </printSymbol>
+ <property>biologic activity (infectivity) of an infectious agent preparation</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[EID_50]" CODE="[EID_50]" isMetric="no" isArbitrary="yes"
+ class="chemical">
+ <name>50% embryo infectious dose</name>
+ <printSymbol>EID<sub>50</sub>
+ </printSymbol>
+ <property>biologic activity (infectivity) of an infectious agent preparation</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[PFU]" CODE="[PFU]" isMetric="no" isArbitrary="yes"
+ class="chemical">
+ <name>plaque forming units</name>
+ <printSymbol>PFU</printSymbol>
+ <property>amount of an infectious agent</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[FFU]" CODE="[FFU]" isMetric="no" isArbitrary="yes"
+ class="chemical">
+ <name>focus forming units</name>
+ <printSymbol>FFU</printSymbol>
+ <property>amount of an infectious agent</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[CFU]" CODE="[CFU]" isMetric="no" isArbitrary="yes"
+ class="chemical">
+ <name>colony forming units</name>
+ <printSymbol>CFU</printSymbol>
+ <property>amount of a proliferating organism</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[BAU]" CODE="[BAU]" isMetric="no" isArbitrary="yes"
+ class="chemical">
+ <name>bioequivalent allergen unit</name>
+ <printSymbol>BAU</printSymbol>
+ <property>amount of an allergen callibrated through in-vivo testing based on the ID50EAL method of (intradermal dilution for 50mm sum of erythema diameters</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[AU]" CODE="[AU]" isMetric="no" isArbitrary="yes"
+ class="chemical">
+ <name>allergen unit</name>
+ <printSymbol>AU</printSymbol>
+ <property>procedure defined amount of an allergen using some reference standard</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[Amb'a'1'U]" CODE="[AMB'A'1'U]" isMetric="no" isArbitrary="yes"
+ class="chemical">
+ <name>allergen unit for Ambrosia artemisiifolia</name>
+ <printSymbol>Amb a 1 U</printSymbol>
+ <property>procedure defined amount of the major allergen of ragweed.</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[PNU]" CODE="[PNU]" isMetric="no" isArbitrary="yes"
+ class="chemical">
+ <name>protein nitrogen unit</name>
+ <printSymbol>PNU</printSymbol>
+ <property>procedure defined amount of a protein substance</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[Lf]" CODE="[LF]" isMetric="no" isArbitrary="yes"
+ class="chemical">
+ <name>Limit of flocculation</name>
+ <printSymbol>Lf</printSymbol>
+ <property>procedure defined amount of an antigen substance</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[D'ag'U]" CODE="[D'AG'U]" isMetric="no" isArbitrary="yes"
+ class="chemical">
+ <name>D-antigen unit</name>
+ <printSymbol/>
+ <property>procedure defined amount of a poliomyelitis d-antigen substance</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[FEU]" CODE="[FEU]" isMetric="no" isArbitrary="yes"
+ class="chemical">
+ <name>fibrinogen equivalent unit</name>
+ <printSymbol/>
+ <property>amount of fibrinogen broken down into the measured d-dimers</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[ELU]" CODE="[ELU]" isMetric="no" isArbitrary="yes"
+ class="chemical">
+ <name>ELISA unit</name>
+ <printSymbol/>
+ <property>arbitrary ELISA unit</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[EU]" CODE="[EU]" isMetric="no" isArbitrary="yes"
+ class="chemical">
+ <name>Ehrlich unit</name>
+ <printSymbol/>
+ <property>Ehrlich unit</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="Np" CODE="NEP" isMetric="yes" isSpecial="yes" class="levels">
+ <name>neper</name>
+ <printSymbol>Np</printSymbol>
+ <property>level</property>
+ <value Unit="ln(1 1)" UNIT="LN(1 1)">
+ <function name="ln" value="1" Unit="1"/>
+ </value>
+ </unit>
+ <unit xmlns="" Code="B" CODE="B" isMetric="yes" isSpecial="yes" class="levels">
+ <name>bel</name>
+ <printSymbol>B</printSymbol>
+ <property>level</property>
+ <value Unit="lg(1 1)" UNIT="LG(1 1)">
+ <function name="lg" value="1" Unit="1"/>
+ </value>
+ </unit>
+ <unit xmlns="" Code="B[SPL]" CODE="B[SPL]" isMetric="yes" isSpecial="yes"
+ class="levels">
+ <name>bel sound pressure</name>
+ <printSymbol>B(SPL)</printSymbol>
+ <property>pressure level</property>
+ <value Unit="2lg(2 10*-5.Pa)" UNIT="2LG(2 10*-5.PAL)">
+ <function name="lgTimes2" value="2" Unit="10*-5.Pa"/>
+ </value>
+ </unit>
+ <unit xmlns="" Code="B[V]" CODE="B[V]" isMetric="yes" isSpecial="yes" class="levels">
+ <name>bel volt</name>
+ <printSymbol>B(V)</printSymbol>
+ <property>electric potential level</property>
+ <value Unit="2lg(1 V)" UNIT="2LG(1 V)">
+ <function name="lgTimes2" value="1" Unit="V"/>
+ </value>
+ </unit>
+ <unit xmlns="" Code="B[mV]" CODE="B[MV]" isMetric="yes" isSpecial="yes" class="levels">
+ <name>bel millivolt</name>
+ <printSymbol>B(mV)</printSymbol>
+ <property>electric potential level</property>
+ <value Unit="2lg(1 mV)" UNIT="2LG(1 MV)">
+ <function name="lgTimes2" value="1" Unit="mV"/>
+ </value>
+ </unit>
+ <unit xmlns="" Code="B[uV]" CODE="B[UV]" isMetric="yes" isSpecial="yes" class="levels">
+ <name>bel microvolt</name>
+ <printSymbol>B(μV)</printSymbol>
+ <property>electric potential level</property>
+ <value Unit="2lg(1 uV)" UNIT="2LG(1 UV)">
+ <function name="lgTimes2" value="1" Unit="uV"/>
+ </value>
+ </unit>
+ <unit xmlns="" Code="B[10.nV]" CODE="B[10.NV]" isMetric="yes" isSpecial="yes"
+ class="levels">
+ <name>bel 10 nanovolt</name>
+ <printSymbol>B(10 nV)</printSymbol>
+ <property>electric potential level</property>
+ <value Unit="2lg(10 nV)" UNIT="2LG(10 NV)">
+ <function name="lgTimes2" value="10" Unit="nV"/>
+ </value>
+ </unit>
+ <unit xmlns="" Code="B[W]" CODE="B[W]" isMetric="yes" isSpecial="yes" class="levels">
+ <name>bel watt</name>
+ <printSymbol>B(W)</printSymbol>
+ <property>power level</property>
+ <value Unit="lg(1 W)" UNIT="LG(1 W)">
+ <function name="lg" value="1" Unit="W"/>
+ </value>
+ </unit>
+ <unit xmlns="" Code="B[kW]" CODE="B[KW]" isMetric="yes" isSpecial="yes" class="levels">
+ <name>bel kilowatt</name>
+ <printSymbol>B(kW)</printSymbol>
+ <property>power level</property>
+ <value Unit="lg(1 kW)" UNIT="LG(1 KW)">
+ <function name="lg" value="1" Unit="kW"/>
+ </value>
+ </unit>
+ <unit xmlns="" Code="st" CODE="STR" isMetric="yes" class="misc">
+ <name>stere</name>
+ <printSymbol>st</printSymbol>
+ <property>volume</property>
+ <value Unit="m3" UNIT="M3" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="Ao" CODE="AO" isMetric="no" class="misc">
+ <name>Ångström</name>
+ <printSymbol>Å</printSymbol>
+ <property>length</property>
+ <value Unit="nm" UNIT="NM" value="0.1">0.1</value>
+ </unit>
+ <unit xmlns="" Code="b" CODE="BRN" isMetric="no" class="misc">
+ <name>barn</name>
+ <printSymbol>b</printSymbol>
+ <property>action area</property>
+ <value Unit="fm2" UNIT="FM2" value="100">100</value>
+ </unit>
+ <unit xmlns="" Code="att" CODE="ATT" isMetric="no" class="misc">
+ <name>technical atmosphere</name>
+ <printSymbol>at</printSymbol>
+ <property>pressure</property>
+ <value Unit="kgf/cm2" UNIT="KGF/CM2" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="mho" CODE="MHO" isMetric="yes" class="misc">
+ <name>mho</name>
+ <printSymbol>mho</printSymbol>
+ <property>electric conductance</property>
+ <value Unit="S" UNIT="S" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[psi]" CODE="[PSI]" isMetric="no" class="misc">
+ <name>pound per sqare inch</name>
+ <printSymbol>psi</printSymbol>
+ <property>pressure</property>
+ <value Unit="[lbf_av]/[in_i]2" UNIT="[LBF_AV]/[IN_I]2" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="circ" CODE="CIRC" isMetric="no" class="misc">
+ <name>circle</name>
+ <printSymbol>circ</printSymbol>
+ <property>plane angle</property>
+ <value Unit="[pi].rad" UNIT="[PI].RAD" value="2">2</value>
+ </unit>
+ <unit xmlns="" Code="sph" CODE="SPH" isMetric="no" class="misc">
+ <name>spere</name>
+ <printSymbol>sph</printSymbol>
+ <property>solid angle</property>
+ <value Unit="[pi].sr" UNIT="[PI].SR" value="4">4</value>
+ </unit>
+ <unit xmlns="" Code="[car_m]" CODE="[CAR_M]" isMetric="no" class="misc">
+ <name>metric carat</name>
+ <printSymbol>ct<sub>m</sub>
+ </printSymbol>
+ <property>mass</property>
+ <value Unit="g" UNIT="G" value="2e-1">0.2</value>
+ </unit>
+ <unit xmlns="" Code="[car_Au]" CODE="[CAR_AU]" isMetric="no" class="misc">
+ <name>carat of gold alloys</name>
+ <printSymbol>ct<sub>
+ <r>Au</r>
+ </sub>
+ </printSymbol>
+ <property>mass fraction</property>
+ <value Unit="/24" UNIT="/24" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="[smoot]" CODE="[SMOOT]" isMetric="no" class="misc">
+ <name>Smoot</name>
+ <printSymbol/>
+ <property>length</property>
+ <value Unit="[in_i]" UNIT="[IN_I]" value="67">67</value>
+ </unit>
+ <unit xmlns="" Code="bit_s" CODE="BIT_S" isMetric="no" isSpecial="yes"
+ class="infotech">
+ <name>bit</name>
+ <printSymbol>bit<sub>s</sub>
+ </printSymbol>
+ <property>amount of information</property>
+ <value Unit="ld(1 1)" UNIT="ld(1 1)">
+ <function name="ld" value="1" Unit="1"/>
+ </value>
+ </unit>
+ <unit xmlns="" Code="bit" CODE="BIT" isMetric="yes" class="infotech">
+ <name>bit</name>
+ <printSymbol>bit</printSymbol>
+ <property>amount of information</property>
+ <value Unit="1" UNIT="1" value="1">1</value>
+ </unit>
+ <unit xmlns="" Code="By" CODE="BY" isMetric="yes" class="infotech">
+ <name>byte</name>
+ <printSymbol>B</printSymbol>
+ <property>amount of information</property>
+ <value Unit="bit" UNIT="bit" value="8">8</value>
+ </unit>
+ <unit xmlns="" Code="Bd" CODE="BD" isMetric="yes" class="infotech">
+ <name>baud</name>
+ <printSymbol>Bd</printSymbol>
+ <property>signal transmission rate</property>
+ <value Unit="/s" UNIT="/s" value="1">1</value>
+ </unit>
+ <prefix xmlns="" Code="Ki" CODE="KIB">
+ <name>kibi</name>
+ <printSymbol>Ki</printSymbol>
+ <value value="1024">1024</value>
+ </prefix>
+ <prefix xmlns="" Code="Mi" CODE="MIB">
+ <name>mebi</name>
+ <printSymbol>Mi</printSymbol>
+ <value value="1048576">1048576</value>
+ </prefix>
+ <prefix xmlns="" Code="Gi" CODE="GIB">
+ <name>gibi</name>
+ <printSymbol>Gi</printSymbol>
+ <value value="1073741824">1073741824</value>
+ </prefix>
+ <prefix xmlns="" Code="Ti" CODE="TIB">
+ <name>tebi</name>
+ <printSymbol>Ti</printSymbol>
+ <value value="1099511627776">1099511627776</value>
+ </prefix>
</root>
\ No newline at end of file
diff --git a/bundles/org.eclipse.uomo.ucum/.classpath b/bundles/org.eclipse.uomo.ucum/.classpath
index a625c7f..23d1b61 100644
--- a/bundles/org.eclipse.uomo.ucum/.classpath
+++ b/bundles/org.eclipse.uomo.ucum/.classpath
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src/main/java/"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src/main/java/"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/bundles/org.eclipse.uomo.ucum/.gitignore b/bundles/org.eclipse.uomo.ucum/.gitignore
index 2c36b17..21d5518 100644
--- a/bundles/org.eclipse.uomo.ucum/.gitignore
+++ b/bundles/org.eclipse.uomo.ucum/.gitignore
@@ -1,2 +1,2 @@
-/target
-/.settings
+/target
+/.settings
diff --git a/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/UcumFormatService.java b/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/UcumFormatService.java
index a03a847..ca9d5a6 100644
--- a/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/UcumFormatService.java
+++ b/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/UcumFormatService.java
@@ -1,56 +1,56 @@
-/**
- * Copyright (c) 2005, 2010, Werner Keil, JScience and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Werner Keil, Jean-Marie Dautelle - initial API and implementation
- */
-package org.eclipse.uomo.ucum;
-
-import java.io.IOException;
-import java.text.ParsePosition;
-
-import org.unitsofmeasurement.service.UnitFormatService;
-import org.unitsofmeasurement.unit.Unit;
-
-/**
- * <p> This interface provides methods for OSGi bundles to parse/format units
- * as per the <a href="http://www.unitsofmeasure.org/">
- * Unified Code for Units of Measure (UCUM)</a> specification.</p>
- *
- * @author <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
- * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
- * @see <a href="http://aurora.regenstrief.org/~ucum/ucum.html">UCUM Full Specification</a>
- * @version 1.1 ($Revision: 306 $), $Date: 2010-10-29 21:42:27 +0100 (Fr, 29 Okt 2010) $
- */
-public interface UcumFormatService extends UnitFormatService {
-
- /**
- * Formats the specified unit.
- *
- * @param unit the unit to format.
- * @param appendable the appendable destination.
- * @return the appendable destination passed in with formatted text appended.
- * @throws IOException if an error occurs.
- */
- Appendable format(Unit<?> unit, Appendable appendable)
- throws IOException;
-
- /**
- * Parses a portion of the specified {@link CharSequence} from the
- * specified position to produce a unit. If there is no unit to parse
- * the unitary unit (dimensionless) is returned.
- *
- * @param csq the <code>CharSequence</code> to parse.
- * @param cursor the cursor holding the current parsing index or <code>
- * null</code> to parse the whole character sequence.
- * @return the unit parsed from the specified character sub-sequence.
- * @throws IllegalArgumentException if any problem occurs while parsing the
- * specified character sequence (e.g. illegal syntax).
- */
- Unit<?> parse(CharSequence csq, ParsePosition cursor)
- throws IllegalArgumentException;
-}
+/**
+ * Copyright (c) 2005, 2010, Werner Keil, JScience and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Werner Keil, Jean-Marie Dautelle - initial API and implementation
+ */
+package org.eclipse.uomo.ucum;
+
+import java.io.IOException;
+import java.text.ParsePosition;
+
+import org.unitsofmeasurement.service.UnitFormatService;
+import org.unitsofmeasurement.unit.Unit;
+
+/**
+ * <p> This interface provides methods for OSGi bundles to parse/format units
+ * as per the <a href="http://www.unitsofmeasure.org/">
+ * Unified Code for Units of Measure (UCUM)</a> specification.</p>
+ *
+ * @author <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
+ * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
+ * @see <a href="http://aurora.regenstrief.org/~ucum/ucum.html">UCUM Full Specification</a>
+ * @version 1.1 ($Revision: 306 $), $Date: 2010-10-29 21:42:27 +0100 (Fr, 29 Okt 2010) $
+ */
+public interface UcumFormatService extends UnitFormatService {
+
+ /**
+ * Formats the specified unit.
+ *
+ * @param unit the unit to format.
+ * @param appendable the appendable destination.
+ * @return the appendable destination passed in with formatted text appended.
+ * @throws IOException if an error occurs.
+ */
+ Appendable format(Unit<?> unit, Appendable appendable)
+ throws IOException;
+
+ /**
+ * Parses a portion of the specified {@link CharSequence} from the
+ * specified position to produce a unit. If there is no unit to parse
+ * the unitary unit (dimensionless) is returned.
+ *
+ * @param csq the <code>CharSequence</code> to parse.
+ * @param cursor the cursor holding the current parsing index or <code>
+ * null</code> to parse the whole character sequence.
+ * @return the unit parsed from the specified character sub-sequence.
+ * @throws IllegalArgumentException if any problem occurs while parsing the
+ * specified character sequence (e.g. illegal syntax).
+ */
+ Unit<?> parse(CharSequence csq, ParsePosition cursor)
+ throws IllegalArgumentException;
+}
diff --git a/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/expression/Factor.java b/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/expression/Factor.java
index 91d3e61..6f124dc 100644
--- a/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/expression/Factor.java
+++ b/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/expression/Factor.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * Crown Copyright (c) 2006, 2008, Copyright (c) 2006, 2008 Kestral Computing P/L.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kestral Computing P/L - initial implementation
- *******************************************************************************/
-
-package org.eclipse.uomo.ucum.expression;
-
-
-public class Factor extends Component {
-
- private int value;
-
- /**
- *
- */
- public Factor() {
- super();
- // TODO Auto-generated constructor stub
- }
-
- /**
- * @param value
- */
- public Factor(int value) {
- super();
- this.value = value;
- }
-
- /**
- * @return the value
- */
- public int getValue() {
- return value;
- }
-
- /**
- * @param value the value to set
- */
- public void setValue(int value) {
- this.value = value;
- }
-
-
-}
+/*******************************************************************************
+ * Crown Copyright (c) 2006, 2008, Copyright (c) 2006, 2008 Kestral Computing P/L.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Kestral Computing P/L - initial implementation
+ *******************************************************************************/
+
+package org.eclipse.uomo.ucum.expression;
+
+
+public class Factor extends Component {
+
+ private int value;
+
+ /**
+ *
+ */
+ public Factor() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param value
+ */
+ public Factor(int value) {
+ super();
+ this.value = value;
+ }
+
+ /**
+ * @return the value
+ */
+ public int getValue() {
+ return value;
+ }
+
+ /**
+ * @param value the value to set
+ */
+ public void setValue(int value) {
+ this.value = value;
+ }
+
+
+}
diff --git a/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/expression/Symbol.java b/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/expression/Symbol.java
index 3f7aaa3..0728179 100644
--- a/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/expression/Symbol.java
+++ b/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/expression/Symbol.java
@@ -1,92 +1,92 @@
-/*******************************************************************************
- * Crown Copyright (c) 2006, 2011, Copyright (c) 2006, 2008 Kestral Computing P/L.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kestral Computing P/L - initial implementation
- *******************************************************************************/
-
-package org.eclipse.uomo.ucum.expression;
-
-import org.eclipse.uomo.ucum.model.Prefix;
-import org.eclipse.uomo.ucum.model.UcumUnit;
-
-public class Symbol extends Component {
-
- private UcumUnit unit; // may be Base Unit or DefinedUnit
- private Prefix prefix; // only if unit is metric
- private int exponent;
-
- /**
- *
- */
- public Symbol() {
- super();
- }
-
- /**
- * @param unit
- * @param prefix
- * @param exponent
- */
- public Symbol(UcumUnit unit, Prefix prefix, int exponent) {
- super();
- this.unit = unit;
- this.prefix = prefix;
- this.exponent = exponent;
- }
-
- /**
- * @return the unit
- */
- public UcumUnit getUnit() {
- return unit;
- }
-
- /**
- * @param unit the unit to set
- */
- public void setUnit(UcumUnit unit) {
- this.unit = unit;
- }
-
- /**
- * @return the prefix
- */
- public Prefix getPrefix() {
- return prefix;
- }
-
- /**
- * @param prefix the prefix to set
- */
- public void setPrefix(Prefix prefix) {
- this.prefix = prefix;
- }
-
- /**
- * @return the exponent
- */
- public int getExponent() {
- return exponent;
- }
-
- /**
- * @param exponent the exponent to set
- */
- public void setExponent(int exponent) {
- this.exponent = exponent;
- }
-
- public boolean hasPrefix() {
- return prefix != null;
- }
-
- public void invertExponent() {
- exponent = -exponent;
- }
-
-}
+/*******************************************************************************
+ * Crown Copyright (c) 2006, 2011, Copyright (c) 2006, 2008 Kestral Computing P/L.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Kestral Computing P/L - initial implementation
+ *******************************************************************************/
+
+package org.eclipse.uomo.ucum.expression;
+
+import org.eclipse.uomo.ucum.model.Prefix;
+import org.eclipse.uomo.ucum.model.UcumUnit;
+
+public class Symbol extends Component {
+
+ private UcumUnit unit; // may be Base Unit or DefinedUnit
+ private Prefix prefix; // only if unit is metric
+ private int exponent;
+
+ /**
+ *
+ */
+ public Symbol() {
+ super();
+ }
+
+ /**
+ * @param unit
+ * @param prefix
+ * @param exponent
+ */
+ public Symbol(UcumUnit unit, Prefix prefix, int exponent) {
+ super();
+ this.unit = unit;
+ this.prefix = prefix;
+ this.exponent = exponent;
+ }
+
+ /**
+ * @return the unit
+ */
+ public UcumUnit getUnit() {
+ return unit;
+ }
+
+ /**
+ * @param unit the unit to set
+ */
+ public void setUnit(UcumUnit unit) {
+ this.unit = unit;
+ }
+
+ /**
+ * @return the prefix
+ */
+ public Prefix getPrefix() {
+ return prefix;
+ }
+
+ /**
+ * @param prefix the prefix to set
+ */
+ public void setPrefix(Prefix prefix) {
+ this.prefix = prefix;
+ }
+
+ /**
+ * @return the exponent
+ */
+ public int getExponent() {
+ return exponent;
+ }
+
+ /**
+ * @param exponent the exponent to set
+ */
+ public void setExponent(int exponent) {
+ this.exponent = exponent;
+ }
+
+ public boolean hasPrefix() {
+ return prefix != null;
+ }
+
+ public void invertExponent() {
+ exponent = -exponent;
+ }
+
+}
diff --git a/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/impl/Canonical.java b/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/impl/Canonical.java
index 68694b3..46a3b54 100644
--- a/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/impl/Canonical.java
+++ b/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/impl/Canonical.java
@@ -1,79 +1,79 @@
-/*******************************************************************************
- * Crown Copyright (c) 2006, 2008, Copyright (c) 2006, 2008 Kestral Computing P/L.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kestral Computing P/L - initial implementation
- *******************************************************************************/
-
-package org.eclipse.uomo.ucum.impl;
-
-import java.math.BigDecimal;
-import java.math.MathContext;
-
-import org.eclipse.uomo.ucum.expression.Term;
-
-// TODO replace this with extended QuantityAmount
-class Canonical {
-
- private BigDecimal value;
- private Term unit;
-
- /**
- * @param value
- * @param unit
- */
- public Canonical(BigDecimal value, Term unit) {
- super();
- this.value = value;
- this.unit = unit;
- }
-
- /**
- * @return the value
- */
- public BigDecimal getValue() {
- return value;
- }
-
- /**
- * @return the unit
- */
- public Term getUnit() {
- return unit;
- }
-
- /**
- * @param value the value to set
- */
- public void setValue(BigDecimal value) {
- this.value = value;
- }
-
- void multiplyValue(Number number) {
- value = value.multiply((BigDecimal) number);
- }
-
- void multiplyValue(int multiplicand) {
- value = value.multiply(new BigDecimal(multiplicand));
- }
-
- public boolean hasUnit() {
- return unit != null;
- }
-
- /**
- * @param unit the unit to set
- */
- public void setUnit(Term unit) {
- this.unit = unit;
- }
-
- void divideValue(BigDecimal divisor) {
- value = value.divide(divisor, new MathContext(20));
- }
-
-}
+/*******************************************************************************
+ * Crown Copyright (c) 2006, 2008, Copyright (c) 2006, 2008 Kestral Computing P/L.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Kestral Computing P/L - initial implementation
+ *******************************************************************************/
+
+package org.eclipse.uomo.ucum.impl;
+
+import java.math.BigDecimal;
+import java.math.MathContext;
+
+import org.eclipse.uomo.ucum.expression.Term;
+
+// TODO replace this with extended QuantityAmount
+class Canonical {
+
+ private BigDecimal value;
+ private Term unit;
+
+ /**
+ * @param value
+ * @param unit
+ */
+ public Canonical(BigDecimal value, Term unit) {
+ super();
+ this.value = value;
+ this.unit = unit;
+ }
+
+ /**
+ * @return the value
+ */
+ public BigDecimal getValue() {
+ return value;
+ }
+
+ /**
+ * @return the unit
+ */
+ public Term getUnit() {
+ return unit;
+ }
+
+ /**
+ * @param value the value to set
+ */
+ public void setValue(BigDecimal value) {
+ this.value = value;
+ }
+
+ void multiplyValue(Number number) {
+ value = value.multiply((BigDecimal) number);
+ }
+
+ void multiplyValue(int multiplicand) {
+ value = value.multiply(new BigDecimal(multiplicand));
+ }
+
+ public boolean hasUnit() {
+ return unit != null;
+ }
+
+ /**
+ * @param unit the unit to set
+ */
+ public void setUnit(Term unit) {
+ this.unit = unit;
+ }
+
+ void divideValue(BigDecimal divisor) {
+ value = value.divide(divisor, new MathContext(20));
+ }
+
+}
diff --git a/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/impl/UcumConverter.java b/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/impl/UcumConverter.java
index 442480f..1a9b99a 100644
--- a/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/impl/UcumConverter.java
+++ b/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/impl/UcumConverter.java
@@ -1,327 +1,327 @@
-/*******************************************************************************
- * Crown Copyright (c) 2006, 2011, Copyright (c) 2006, 2008 Kestral Computing P/L.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kestral Computing P/L - initial implementation
- *
- *******************************************************************************/
-
-package org.eclipse.uomo.ucum.impl;
-
-import static org.eclipse.uomo.core.impl.OutputHelper.isConsoleOutput;
-import static org.eclipse.uomo.core.impl.OutputHelper.println;
-import static org.eclipse.uomo.ucum.model.ConceptKind.*;
-import static org.eclipse.uomo.ucum.expression.Operator.*;
-
-import java.math.BigDecimal;
-import java.math.MathContext;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.uomo.core.UOMoRuntimeException;
-import org.eclipse.uomo.ucum.expression.Component;
-import org.eclipse.uomo.ucum.expression.Factor;
-import org.eclipse.uomo.ucum.expression.Symbol;
-import org.eclipse.uomo.ucum.expression.Term;
-import org.eclipse.uomo.ucum.model.DefinedUnit;
-import org.eclipse.uomo.ucum.model.UcumModel;
-import org.eclipse.uomo.ucum.parsers.ExpressionComposer;
-import org.eclipse.uomo.ucum.parsers.ExpressionParser;
-import org.eclipse.uomo.ucum.special.SpecialUnitHandler;
-import org.eclipse.uomo.units.AbstractConverter;
-import org.eclipse.uomo.util.Registry;
-import org.unitsofmeasurement.unit.UnitConverter;
-
-/**
- * = [mu_0] = 4.[pi].10*-7.N/A2 = (g.m/s2)/(C/s)2? = g.m/s2/(C2/s2) =
- * g.m/s2/C2.s2 = g.m/C2.s2/s2 = g.m/C2 = m.g.C-2
- *
- * @author Grahame Grieve
- * @author Werner Keil
- */
-class UcumConverter extends AbstractConverter {
-
- /**
- *
- */
- private static final long serialVersionUID = -895607408258138526L;
- private final UcumModel model;
- @SuppressWarnings("rawtypes")
- private final Registry<SpecialUnitHandler> handlers;
- private final UnitConverter compound;
-
- private Factor one = new Factor(1);
-
- /**
- * @param model
- */
- public UcumConverter(UcumModel model, Registry handlers) {
- super();
- this.model = model;
- this.handlers = handlers;
- List<UnitConverter> compounds = getCompoundConverters();
- compound = compounds.get(0);
- }
-
- public Canonical convert(Term term) throws UOMoRuntimeException {
- return convertTerm(term);
- }
-
- private Canonical convertTerm(Term term) throws UOMoRuntimeException {
- Canonical res = new Canonical(BigDecimal.ONE, new Term());
- if (term.hasComp())
- res.getUnit().setComp(convertComp(res, term.getComp()));
- if (term.hasOp())
- res.getUnit().setOp(term.getOp());
- if (term.hasTerm()) {
- Canonical t = convertTerm(term.getTerm());
- res.setValue(res.getValue().multiply(t.getValue()));
- if (t.hasUnit())
- res.getUnit().setTermCheckOp(t.getUnit());
- else
- res.getUnit().setOp(null);
- }
-
- // normalise
- debug("normalise", res.getUnit()); //$NON-NLS-1$
- if (res.getUnit().hasOp() && res.getUnit().getOp() == DIVISION) {
- res.getUnit().setOp(MULTIPLICATION);
- flipExponents(res.getUnit().getTerm());
- debug("flipped", res.getUnit()); //$NON-NLS-1$
- }
-
- if (!res.getUnit().hasComp() || res.getUnit().getComp() == one) {
- res.setUnit(res.getUnit().getTerm());
- debug("trimmed", res.getUnit()); //$NON-NLS-1$
- }
-
- // everything in scope is a multiplication operation. If comp is a term,
- // then
- // we are going to tack our term on the end of that term as a
- // multiplication, and
- // make comp our term
-
- if (res.hasUnit() && res.getUnit().hasComp()
- && res.getUnit().getComp() instanceof Term) {
- Term end = getEndTerm((Term) res.getUnit().getComp());
- assert end.getOp() == null;
- end.setOp(MULTIPLICATION);
- end.setTermCheckOp(res.getUnit().getTerm());
- res.setUnit((Term) res.getUnit().getComp());
- debug("reorged", res.getUnit()); //$NON-NLS-1$
- }
-
- if (res.hasUnit()
- && (!res.getUnit().hasComp() || res.getUnit().getComp() == one)) {
- res.setUnit(res.getUnit().getTerm());
- debug("trimmed", res.getUnit()); //$NON-NLS-1$
- }
- // now we have a linear list of terms, each with one component.
- // we scan through the list looking for common components to factor out
- // we have to scan into the list because we may have deep duplicates
- // from the previous flattening operation. we also remove anything
- // that's
- // ended up with an exponent of 0 during this operation
- if (res.hasUnit())
- res.setUnit(removeDuplicateComponents(res.getUnit()));
-
- if (res.hasUnit() && !res.getUnit().hasTerm())
- res.getUnit().setOp(null);
- debug("norm finished", res.getUnit()); //$NON-NLS-1$
- // System.out.println("value: "+res.getValue().toPlainString()+"; units: "+new
- // ExpressionComposer().compose(res.getUnit()));
- return res;
- }
-
- private void debug(String state, Term unit) {
- if (isConsoleOutput()) { // avoiding any call if no debug output set
- println(state + ": " + new ExpressionComposer().compose(unit)); //$NON-NLS-1$
- }
- }
-
- private Term getEndTerm(Term term) {
- if (term.hasTerm())
- return getEndTerm(term.getTerm());
- else
- return term;
- }
-
- private Term removeDuplicateComponents(Term unit) {
- if (unit == null)
- return null;
- assert unit.getComp() instanceof Symbol; // because that should be all
- // that's left
- Symbol symO = (Symbol) unit.getComp();
- Term inner = findDuplicateCompOwner(unit.getTerm(), symO);
- if (inner != null) {
- Symbol symI = (Symbol) inner.getComp();
- symI.setExponent(symI.getExponent() + symO.getExponent());
- return removeDuplicateComponents(unit.getTerm());
- }
- if (symO.getExponent() == 0)
- return removeDuplicateComponents(unit.getTerm());
- unit.setTermCheckOp(removeDuplicateComponents(unit.getTerm()));
- return unit;
- }
-
- private Term findDuplicateCompOwner(Term term, Symbol comp) {
- if (term == null)
- return null;
- if (term.getComp() instanceof Symbol) {
- Symbol sym = (Symbol) term.getComp();
- if (sym.getPrefix() == comp.getPrefix() && // i.e. null
- sym.getUnit() == comp.getUnit())
- return term;
- }
- return findDuplicateCompOwner(term.getTerm(), comp);
- }
-
- private void flipExponents(Term term) {
- if (term.getComp() instanceof Symbol) {
- ((Symbol) term.getComp()).invertExponent();
- }
- if (term.hasTerm()) {
- flipExponents(term.getTerm());
- }
- }
-
- private Component convertComp(Canonical ctxt, Component comp)
- throws UOMoRuntimeException {
- if (comp instanceof Term) {
- Canonical t = convertTerm((Term) comp);
- ctxt.multiplyValue(t.getValue());
- return t.getUnit();
- } else if (comp instanceof Factor) {
- ctxt.multiplyValue(((Factor) comp).getValue());
- return one; // nothing to convert
- } else if (comp instanceof Symbol)
- return convertSymbol(ctxt, (Symbol) comp);
- else
- throw new UOMoRuntimeException("unknown component type " //$NON-NLS-1$
- + comp.getClass().toString());
- }
-
- private Component convertSymbol(Canonical ctxt, Symbol comp)
- throws UOMoRuntimeException {
- if (comp.hasPrefix()) {
-// ctxt.multiplyValue(comp.getPrefix().getValue());
- ctxt.multiplyValue(((BigDecimal)comp.getPrefix().getValue()).pow(
- comp.getExponent(), MathContext.DECIMAL128));
- }
-
- if (comp.getUnit().getKind() == BASEUNIT) {
- Symbol res = new Symbol();
- res.setUnit(comp.getUnit());
- res.setExponent(comp.getExponent());
- return res;
- } else {
- DefinedUnit unit = (DefinedUnit) comp.getUnit();
- String u = unit.getValue().getUnit();
- if (unit.isSpecial()) {
- if (!handlers.exists(unit.getCode()))
- throw new UOMoRuntimeException("Not handled yet (special unit)"); //$NON-NLS-1$
- else {
- u = handlers.get(unit.getCode()).getUnits();
- ctxt.multiplyValue(handlers.get(unit.getCode()).value());
- }
- } else
- ctxt.multiplyValue(unit.getValue().value());
- Term canonical = new ExpressionParser(model).parse(u);
- if (canonical.hasComp() && !canonical.hasOp()
- && !canonical.hasTerm()) {
- Component ret = convertComp(ctxt, canonical.getComp());
- if (comp.getExponent() == 1)
- return ret;
- else if (ret instanceof Factor) {
- ((Factor) ret).setValue(comp.getExponent()
- + ((Factor) ret).getValue());
- return ret;
- } else if (ret instanceof Symbol) {
- ((Symbol) ret).setExponent(comp.getExponent()
- * ((Symbol) ret).getExponent());
- return ret;
- } else if (ret instanceof Term) {
- applyExponent((Term) ret, comp.getExponent());
- return ret;
- } else
- throw new UOMoRuntimeException("unknown component type " //$NON-NLS-1$
- + comp.getClass().toString());
- } else {
- Canonical t1 = convertTerm(canonical);
- Term ret = t1.getUnit();
- if (comp.getExponent() == -1 && ret.hasComp() && ret.hasOp()
- && ret.hasTerm() && ret.getTerm().hasComp()
- && !ret.getTerm().hasOp() && !ret.getTerm().hasTerm()) {
- Component t = ret.getTerm().getComp();
- ret.getTerm().setComp(ret.getComp());
- ret.setComp(t);
- ctxt.divideValue(t1.getValue());
- return ret;
- } else if (comp.getExponent() != 1) {
- ctxt.multiplyValue(t1.getValue());
- // what we have to do is push the exponent into the all the
- // symbols contained herein
- applyExponent(ret, comp.getExponent());
- return ret;
- } else {
- ctxt.multiplyValue(t1.getValue());
- return ret;
- }
- }
- }
- }
-
- private void applyExponent(Term term, int exponent) {
- if (term == null)
- return;
- if (term.hasComp()) {
- if (term.getComp() instanceof Term) {
- applyExponent((Term) term.getComp(), exponent);
- } else if (term.getComp() instanceof Symbol) {
- Symbol sym = (Symbol) term.getComp();
- sym.setExponent(sym.getExponent() * exponent);
- }
-
- }
- applyExponent(term.getTerm(), exponent);
- }
-
- public UnitConverter concatenate(UnitConverter converter) {
- return compound.concatenate(converter);
- }
-
- public double convert(double value) {
- return compound.convert(value);
- }
-
- public BigDecimal convert(BigDecimal value, MathContext ctx)
- throws ArithmeticException {
- return compound.convert(value, ctx);
- }
-
- public List<UnitConverter> getCompoundConverters() {
- final List<UnitConverter> compound = new ArrayList<UnitConverter>();
- compound.add(this);
- return compound;
- }
-
- public UnitConverter inverse() {
- return compound.inverse();
- }
-
- public boolean isIdentity() {
- return false;
- }
-
- public boolean isLinear() {
- return false;
- }
-
- public Number convert(Number value) {
- return compound.convert(value);
- }
-}
+/*******************************************************************************
+ * Crown Copyright (c) 2006, 2011, Copyright (c) 2006, 2008 Kestral Computing P/L.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Kestral Computing P/L - initial implementation
+ *
+ *******************************************************************************/
+
+package org.eclipse.uomo.ucum.impl;
+
+import static org.eclipse.uomo.core.impl.OutputHelper.isConsoleOutput;
+import static org.eclipse.uomo.core.impl.OutputHelper.println;
+import static org.eclipse.uomo.ucum.model.ConceptKind.*;
+import static org.eclipse.uomo.ucum.expression.Operator.*;
+
+import java.math.BigDecimal;
+import java.math.MathContext;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.uomo.core.UOMoRuntimeException;
+import org.eclipse.uomo.ucum.expression.Component;
+import org.eclipse.uomo.ucum.expression.Factor;
+import org.eclipse.uomo.ucum.expression.Symbol;
+import org.eclipse.uomo.ucum.expression.Term;
+import org.eclipse.uomo.ucum.model.DefinedUnit;
+import org.eclipse.uomo.ucum.model.UcumModel;
+import org.eclipse.uomo.ucum.parsers.ExpressionComposer;
+import org.eclipse.uomo.ucum.parsers.ExpressionParser;
+import org.eclipse.uomo.ucum.special.SpecialUnitHandler;
+import org.eclipse.uomo.units.AbstractConverter;
+import org.eclipse.uomo.util.Registry;
+import org.unitsofmeasurement.unit.UnitConverter;
+
+/**
+ * = [mu_0] = 4.[pi].10*-7.N/A2 = (g.m/s2)/(C/s)2? = g.m/s2/(C2/s2) =
+ * g.m/s2/C2.s2 = g.m/C2.s2/s2 = g.m/C2 = m.g.C-2
+ *
+ * @author Grahame Grieve
+ * @author Werner Keil
+ */
+class UcumConverter extends AbstractConverter {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -895607408258138526L;
+ private final UcumModel model;
+ @SuppressWarnings("rawtypes")
+ private final Registry<SpecialUnitHandler> handlers;
+ private final UnitConverter compound;
+
+ private Factor one = new Factor(1);
+
+ /**
+ * @param model
+ */
+ public UcumConverter(UcumModel model, Registry handlers) {
+ super();
+ this.model = model;
+ this.handlers = handlers;
+ List<UnitConverter> compounds = getCompoundConverters();
+ compound = compounds.get(0);
+ }
+
+ public Canonical convert(Term term) throws UOMoRuntimeException {
+ return convertTerm(term);
+ }
+
+ private Canonical convertTerm(Term term) throws UOMoRuntimeException {
+ Canonical res = new Canonical(BigDecimal.ONE, new Term());
+ if (term.hasComp())
+ res.getUnit().setComp(convertComp(res, term.getComp()));
+ if (term.hasOp())
+ res.getUnit().setOp(term.getOp());
+ if (term.hasTerm()) {
+ Canonical t = convertTerm(term.getTerm());
+ res.setValue(res.getValue().multiply(t.getValue()));
+ if (t.hasUnit())
+ res.getUnit().setTermCheckOp(t.getUnit());
+ else
+ res.getUnit().setOp(null);
+ }
+
+ // normalise
+ debug("normalise", res.getUnit()); //$NON-NLS-1$
+ if (res.getUnit().hasOp() && res.getUnit().getOp() == DIVISION) {
+ res.getUnit().setOp(MULTIPLICATION);
+ flipExponents(res.getUnit().getTerm());
+ debug("flipped", res.getUnit()); //$NON-NLS-1$
+ }
+
+ if (!res.getUnit().hasComp() || res.getUnit().getComp() == one) {
+ res.setUnit(res.getUnit().getTerm());
+ debug("trimmed", res.getUnit()); //$NON-NLS-1$
+ }
+
+ // everything in scope is a multiplication operation. If comp is a term,
+ // then
+ // we are going to tack our term on the end of that term as a
+ // multiplication, and
+ // make comp our term
+
+ if (res.hasUnit() && res.getUnit().hasComp()
+ && res.getUnit().getComp() instanceof Term) {
+ Term end = getEndTerm((Term) res.getUnit().getComp());
+ assert end.getOp() == null;
+ end.setOp(MULTIPLICATION);
+ end.setTermCheckOp(res.getUnit().getTerm());
+ res.setUnit((Term) res.getUnit().getComp());
+ debug("reorged", res.getUnit()); //$NON-NLS-1$
+ }
+
+ if (res.hasUnit()
+ && (!res.getUnit().hasComp() || res.getUnit().getComp() == one)) {
+ res.setUnit(res.getUnit().getTerm());
+ debug("trimmed", res.getUnit()); //$NON-NLS-1$
+ }
+ // now we have a linear list of terms, each with one component.
+ // we scan through the list looking for common components to factor out
+ // we have to scan into the list because we may have deep duplicates
+ // from the previous flattening operation. we also remove anything
+ // that's
+ // ended up with an exponent of 0 during this operation
+ if (res.hasUnit())
+ res.setUnit(removeDuplicateComponents(res.getUnit()));
+
+ if (res.hasUnit() && !res.getUnit().hasTerm())
+ res.getUnit().setOp(null);
+ debug("norm finished", res.getUnit()); //$NON-NLS-1$
+ // System.out.println("value: "+res.getValue().toPlainString()+"; units: "+new
+ // ExpressionComposer().compose(res.getUnit()));
+ return res;
+ }
+
+ private void debug(String state, Term unit) {
+ if (isConsoleOutput()) { // avoiding any call if no debug output set
+ println(state + ": " + new ExpressionComposer().compose(unit)); //$NON-NLS-1$
+ }
+ }
+
+ private Term getEndTerm(Term term) {
+ if (term.hasTerm())
+ return getEndTerm(term.getTerm());
+ else
+ return term;
+ }
+
+ private Term removeDuplicateComponents(Term unit) {
+ if (unit == null)
+ return null;
+ assert unit.getComp() instanceof Symbol; // because that should be all
+ // that's left
+ Symbol symO = (Symbol) unit.getComp();
+ Term inner = findDuplicateCompOwner(unit.getTerm(), symO);
+ if (inner != null) {
+ Symbol symI = (Symbol) inner.getComp();
+ symI.setExponent(symI.getExponent() + symO.getExponent());
+ return removeDuplicateComponents(unit.getTerm());
+ }
+ if (symO.getExponent() == 0)
+ return removeDuplicateComponents(unit.getTerm());
+ unit.setTermCheckOp(removeDuplicateComponents(unit.getTerm()));
+ return unit;
+ }
+
+ private Term findDuplicateCompOwner(Term term, Symbol comp) {
+ if (term == null)
+ return null;
+ if (term.getComp() instanceof Symbol) {
+ Symbol sym = (Symbol) term.getComp();
+ if (sym.getPrefix() == comp.getPrefix() && // i.e. null
+ sym.getUnit() == comp.getUnit())
+ return term;
+ }
+ return findDuplicateCompOwner(term.getTerm(), comp);
+ }
+
+ private void flipExponents(Term term) {
+ if (term.getComp() instanceof Symbol) {
+ ((Symbol) term.getComp()).invertExponent();
+ }
+ if (term.hasTerm()) {
+ flipExponents(term.getTerm());
+ }
+ }
+
+ private Component convertComp(Canonical ctxt, Component comp)
+ throws UOMoRuntimeException {
+ if (comp instanceof Term) {
+ Canonical t = convertTerm((Term) comp);
+ ctxt.multiplyValue(t.getValue());
+ return t.getUnit();
+ } else if (comp instanceof Factor) {
+ ctxt.multiplyValue(((Factor) comp).getValue());
+ return one; // nothing to convert
+ } else if (comp instanceof Symbol)
+ return convertSymbol(ctxt, (Symbol) comp);
+ else
+ throw new UOMoRuntimeException("unknown component type " //$NON-NLS-1$
+ + comp.getClass().toString());
+ }
+
+ private Component convertSymbol(Canonical ctxt, Symbol comp)
+ throws UOMoRuntimeException {
+ if (comp.hasPrefix()) {
+// ctxt.multiplyValue(comp.getPrefix().getValue());
+ ctxt.multiplyValue(((BigDecimal)comp.getPrefix().getValue()).pow(
+ comp.getExponent(), MathContext.DECIMAL128));
+ }
+
+ if (comp.getUnit().getKind() == BASEUNIT) {
+ Symbol res = new Symbol();
+ res.setUnit(comp.getUnit());
+ res.setExponent(comp.getExponent());
+ return res;
+ } else {
+ DefinedUnit unit = (DefinedUnit) comp.getUnit();
+ String u = unit.getValue().getUnit();
+ if (unit.isSpecial()) {
+ if (!handlers.exists(unit.getCode()))
+ throw new UOMoRuntimeException("Not handled yet (special unit)"); //$NON-NLS-1$
+ else {
+ u = handlers.get(unit.getCode()).getUnits();
+ ctxt.multiplyValue(handlers.get(unit.getCode()).value());
+ }
+ } else
+ ctxt.multiplyValue(unit.getValue().value());
+ Term canonical = new ExpressionParser(model).parse(u);
+ if (canonical.hasComp() && !canonical.hasOp()
+ && !canonical.hasTerm()) {
+ Component ret = convertComp(ctxt, canonical.getComp());
+ if (comp.getExponent() == 1)
+ return ret;
+ else if (ret instanceof Factor) {
+ ((Factor) ret).setValue(comp.getExponent()
+ + ((Factor) ret).getValue());
+ return ret;
+ } else if (ret instanceof Symbol) {
+ ((Symbol) ret).setExponent(comp.getExponent()
+ * ((Symbol) ret).getExponent());
+ return ret;
+ } else if (ret instanceof Term) {
+ applyExponent((Term) ret, comp.getExponent());
+ return ret;
+ } else
+ throw new UOMoRuntimeException("unknown component type " //$NON-NLS-1$
+ + comp.getClass().toString());
+ } else {
+ Canonical t1 = convertTerm(canonical);
+ Term ret = t1.getUnit();
+ if (comp.getExponent() == -1 && ret.hasComp() && ret.hasOp()
+ && ret.hasTerm() && ret.getTerm().hasComp()
+ && !ret.getTerm().hasOp() && !ret.getTerm().hasTerm()) {
+ Component t = ret.getTerm().getComp();
+ ret.getTerm().setComp(ret.getComp());
+ ret.setComp(t);
+ ctxt.divideValue(t1.getValue());
+ return ret;
+ } else if (comp.getExponent() != 1) {
+ ctxt.multiplyValue(t1.getValue());
+ // what we have to do is push the exponent into the all the
+ // symbols contained herein
+ applyExponent(ret, comp.getExponent());
+ return ret;
+ } else {
+ ctxt.multiplyValue(t1.getValue());
+ return ret;
+ }
+ }
+ }
+ }
+
+ private void applyExponent(Term term, int exponent) {
+ if (term == null)
+ return;
+ if (term.hasComp()) {
+ if (term.getComp() instanceof Term) {
+ applyExponent((Term) term.getComp(), exponent);
+ } else if (term.getComp() instanceof Symbol) {
+ Symbol sym = (Symbol) term.getComp();
+ sym.setExponent(sym.getExponent() * exponent);
+ }
+
+ }
+ applyExponent(term.getTerm(), exponent);
+ }
+
+ public UnitConverter concatenate(UnitConverter converter) {
+ return compound.concatenate(converter);
+ }
+
+ public double convert(double value) {
+ return compound.convert(value);
+ }
+
+ public BigDecimal convert(BigDecimal value, MathContext ctx)
+ throws ArithmeticException {
+ return compound.convert(value, ctx);
+ }
+
+ public List<UnitConverter> getCompoundConverters() {
+ final List<UnitConverter> compound = new ArrayList<UnitConverter>();
+ compound.add(this);
+ return compound;
+ }
+
+ public UnitConverter inverse() {
+ return compound.inverse();
+ }
+
+ public boolean isIdentity() {
+ return false;
+ }
+
+ public boolean isLinear() {
+ return false;
+ }
+
+ public Number convert(Number value) {
+ return compound.convert(value);
+ }
+}
diff --git a/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/impl/UcumEssenceService.java b/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/impl/UcumEssenceService.java
index dbcec29..73d1c96 100644
--- a/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/impl/UcumEssenceService.java
+++ b/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/impl/UcumEssenceService.java
@@ -1,377 +1,377 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2014 Werner Keil, Creative Arts & Technologies.
- * Crown Copyright (c) 2006, 2008, Copyright (c) 2006, 2008 Kestral Computing P/L.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kestral Computing P/L - initial implementation
- * Werner Keil - fixes and improvements
- *******************************************************************************/
-
-package org.eclipse.uomo.ucum.impl;
-
-import static org.eclipse.uomo.core.impl.OutputHelper.println;
-
-import java.io.File;
-import java.io.InputStream;
-import java.math.BigDecimal;
-import java.math.MathContext;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.uomo.core.UOMoRuntimeException;
-import org.eclipse.uomo.core.impl.CodeValuePair;
-import org.eclipse.uomo.ucum.UcumService;
-import org.eclipse.uomo.ucum.expression.Symbol;
-import org.eclipse.uomo.ucum.expression.Term;
-import org.eclipse.uomo.ucum.model.BaseUnit;
-import org.eclipse.uomo.ucum.model.Concept;
-import org.eclipse.uomo.ucum.model.ConceptKind;
-import org.eclipse.uomo.ucum.model.DefinedUnit;
-import org.eclipse.uomo.ucum.model.UcumModel;
-import org.eclipse.uomo.ucum.parsers.DefinitionParser;
-import org.eclipse.uomo.ucum.parsers.ExpressionComposer;
-import org.eclipse.uomo.ucum.parsers.ExpressionParser;
-import org.eclipse.uomo.ucum.parsers.FormalStructureComposer;
-import org.eclipse.uomo.ucum.special.SpecialUnitHandler;
-import org.eclipse.uomo.ucum.special.SpecialUnitRegistry;
-import org.eclipse.uomo.util.Registry;
-
-/**
- * implements UCUM services. Applications must provide a copy of
- * ucum-essence.xml as either a stream or a file name to create the services.
- *
- * the provided ucum-essence.xml must be released on 25 Apr 2008 or more recent.
- * Note that if the ucum-essence.xml file does not contain a release date on an
- * attribute of the root element, it is not more recent than this date (Gunther
- * added it on this date for this usage, thanks)
- *
- * @author Grahame Grieve
- * @author Werner Keil
- */
-public class UcumEssenceService implements UcumService {
-
- /**
- * UCUM ID
- */
- public static final String UCUM_OID = "2.16.840.1.113883.6.8";
-
- private final UcumModel model;
- @SuppressWarnings("rawtypes")
- private final Registry<SpecialUnitHandler> handlers = new SpecialUnitRegistry();
-
- /**
- * Create an instance of Ucum services. Stream must point to a valid
- * ucum-essence file (see class documentation)
- */
- public UcumEssenceService(InputStream stream) throws UOMoRuntimeException {
- super();
- assert stream != null : paramError("factory", "stream",
- "must not be null");
- try {
- model = new DefinitionParser().parse(stream);
- } catch (Exception e) {
- throw new UOMoRuntimeException(e);
- }
- }
-
- /**
- * Create an instance of Ucum services. filename must point to a valid
- * ucum-essence file (see class documentation)
- */
- public UcumEssenceService(String filename) throws UOMoRuntimeException {
- super();
- assert new File(filename).exists() : paramError("factory", "file",
- "must exist");
- try {
- model = new DefinitionParser().parse(filename);
- } catch (Exception e) {
- throw new UOMoRuntimeException(e);
- }
- }
-
- private String paramError(String method, String param, String msg) {
- return getClass().getName() + "." + method + "." + param
- + " is not acceptable: " + msg;
- }
-
- public UcumVersionDetails ucumIdentification() {
- return new UcumVersionDetails(model.getRevisionDate(),
- model.getVersion());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.uomo.ucum.UcumServiceEx#getModel()
- */
- public UcumModel getModel() {
- return model;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.uomo.ucum.UcumServiceEx#search(org.eclipse.uomo.ucum.model.
- * ConceptKind, java.lang.String, boolean)
- */
- public List<Concept> search(ConceptKind kind, String text, boolean isRegex) {
- assert checkStringParam(text) : paramError("search", "text",
- "must not be null or empty");
- return new SearchImpl().doSearch(model, kind, text, isRegex);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.uomo.ucum.UcumService#validateUCUM()
- */
- public List<String> validateUCUM() {
- return new UcumValidator(model, handlers).validate();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.uomo.ucum.UcumService#getProperties()
- */
- public Set<String> getProperties() {
- Set<String> result = new HashSet<String>();
- for (DefinedUnit unit : model.getDefinedUnits()) {
- result.add(unit.getProperty());
- }
- for (BaseUnit unit : model.getBaseUnits()) {
- result.add(unit.getProperty());
- }
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ohf.ucum.UcumServiceEx#validate(java.lang.String)
- */
- public String validate(String unit) {
- assert unit != null : paramError("validate", "unit", "must not be null");
- try {
- new ExpressionParser(model).parse(unit);
- return null;
- } catch (UOMoRuntimeException e) {
- return e.getMessage();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.ohf.ucum.UcumServiceEx#validateInProperty(java.lang.String,
- * java.lang.String)
- */
- public String validateInProperty(String unit, String property) {
- assert checkStringParam(unit) : paramError("validate", "unit",
- "must not be null or empty");
- assert checkStringParam(property) : paramError("validateInProperty",
- "property", "must not be null or empty");
- try {
- Term term = new ExpressionParser(model).parse(unit);
- Canonical can = new UcumConverter(model, handlers).convert(term);
- term = can.getUnit();
- String cu = new ExpressionComposer().compose(term);
- if (term.hasComp() && !term.hasOp()
- && term.getComp() instanceof Symbol) {
- Symbol sym = (Symbol) term.getComp();
- if (sym.getExponent() == 1 && sym.getUnit() instanceof BaseUnit) {
- BaseUnit b = (BaseUnit) sym.getUnit();
- if (property.equals(b.getProperty()))
- return null;
- else
- return "unit " + unit + " is of the property type "
- + b.getProperty() + " (" + cu + "), not "
- + property + " as required.";
- }
- }
- // defined special case
- if ("concentration".equals(property)
- && ("g/L".equals(cu) || "mol/L".equals(cu)))
- return null;
-
- return "unit " + unit + " has the base units " + cu
- + ", and are not from the property " + property
- + " as required.";
- } catch (UOMoRuntimeException e) {
- return e.getMessage();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.ohf.ucum.UcumServiceEx#validateCanonicalUnits(java.lang.String
- * , java.lang.String)
- */
- public String validateCanonicalUnits(String unit, String canonical) {
- assert checkStringParam(unit) : paramError("validate", "unit",
- "must not be null or empty");
- assert checkStringParam(canonical) : paramError(
- "validateCanonicalUnits", "canonical",
- "must not be null or empty");
- try {
- Term term = new ExpressionParser(model).parse(unit);
- Canonical can = new UcumConverter(model, handlers).convert(term);
- term = can.getUnit();
- String cu = new ExpressionComposer().compose(term);
- if (!canonical.equals(cu))
- return "unit " + unit + " has the base units " + cu + ", not "
- + canonical + " as required.";
- return null;
- } catch (UOMoRuntimeException e) {
- return e.getMessage();
- }
- }
-
- /**
- * given a unit, return a formal description of what the units stand for
- * using full names
- *
- * @param units
- * the unit code
- * @return formal description
- * @throws UOMoRuntimeException
- */
- public String analyse(String unit) throws UOMoRuntimeException {
- assert checkStringParam(unit) : paramError("analyse", "unit",
- "must not be null or empty");
- Term term = new ExpressionParser(model).parse(unit);
- return new FormalStructureComposer().compose(term);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.ohf.ucum.UcumServiceEx#getCanonicalUnits(java.lang.String)
- */
- public String getCanonicalUnits(String unit) throws UOMoRuntimeException {
- assert checkStringParam(unit) : paramError("getCanonicalUnits", "unit",
- "must not be null or empty");
- try {
- Term term = new ExpressionParser(model).parse(unit);
- term = new UcumConverter(model, handlers).convert(term).getUnit();
- return new ExpressionComposer().compose(term);
- } catch (RuntimeException e) {
- throw new UOMoRuntimeException("Error processing " + unit + ": "
- + e.getMessage(), e);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.uomo.ucum.UcumServiceEx#getDefinedForms(java.lang.String)
- */
- public List<DefinedUnit> getDefinedForms(String code)
- throws UOMoRuntimeException {
- assert checkStringParam(code) : paramError("getDefinedForms", "code",
- "must not be null or empty");
- List<DefinedUnit> result = new ArrayList<DefinedUnit>();
- BaseUnit base = model.getBaseUnit(code);
- if (base != null) {
- for (DefinedUnit unit : model.getDefinedUnits()) {
- if (!unit.isSpecial()
- && code.equals(getCanonicalUnits(unit.getCode())))
- result.add(unit);
- }
- }
- return result;
- }
-
- private boolean checkStringParam(String s) {
- return s != null && !s.equals("");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.ohf.ucum.UcumServiceEx#getCanonicalForm(org.eclipse.ohf.ucum
- * .UcumEssenceService.Pair)
- */
- public CodeValuePair<Number, String> getCanonicalForm(CodeValuePair<Number, String> value)
- throws UOMoRuntimeException {
- assert value != null : paramError("getCanonicalForm", "value",
- "must not be null");
- assert checkStringParam(value.getCode()) : paramError(
- "getCanonicalForm", "value.code", "must not be null or empty");
-
- Term term = new ExpressionParser(model).parse(value.getCode());
- Canonical c = new UcumConverter(model, handlers).convert(term);
- if (value.getValue() == null)
- return new CodeValuePair<Number, String>(null,
- new ExpressionComposer().compose(c.getUnit()));
- else
- return new CodeValuePair<Number, String>(
- ((BigDecimal) value.getValue()).multiply(c.getValue()),
- new ExpressionComposer().compose(c.getUnit()));
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.uomo.ucum.UcumServiceEx#convert(java.lang.Number,
- * java.lang.String, java.lang.String)
- */
- public Number convert(final Number value, String sourceUnit, String destUnit)
- throws UOMoRuntimeException {
- assert value != null : paramError("convert", "value",
- "must not be null");
- assert checkStringParam(sourceUnit) : paramError("convert",
- "sourceUnit", "must not be null or empty");
- assert checkStringParam(destUnit) : paramError("convert", "destUnit",
- "must not be null or empty");
-
- if (sourceUnit.equals(destUnit))
- return value;
-
- Canonical src = new UcumConverter(model, handlers)
- .convert(new ExpressionParser(model).parse(sourceUnit));
- Canonical dst = new UcumConverter(model, handlers)
- .convert(new ExpressionParser(model).parse(destUnit));
- String s = new ExpressionComposer().compose(src.getUnit());
- String d = new ExpressionComposer().compose(dst.getUnit());
- if (!s.equals(d))
- throw new UOMoRuntimeException("Unable to convert between units "
- + sourceUnit + " and " + destUnit
- + " as they do not have matching canonical forms (" + s
- + " and " + d + " respectively)");
- final BigDecimal decValue = (BigDecimal) value;
- final BigDecimal canValue = decValue.multiply(src.getValue());
- final BigDecimal result = canValue.divide(dst.getValue(), new MathContext(25));
- println(decValue.toPlainString() + sourceUnit + " =("
- + src.getValue().toPlainString() + ")= "
- + canValue.toPlainString() + s + " =("
- + dst.getValue().toPlainString() + ")= "
- + result);
- return result;
- }
-
- public CodeValuePair<Number, String> multiply(CodeValuePair<Number, String> o1,