--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2010 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.databoard.example.old;
+
+import org.simantics.databoard.Units;\r
+import org.simantics.databoard.units.IUnitConverter;\r
+import org.simantics.databoard.units.internal.UnitParseException;\r
+
+public class UnitsExample {
+
+ public static void main(String[] args) {
+ try {
+ IUnitConverter c;
+
+ String sourceUnit = "cl";
+ String targetUnit = "l";
+ c = Units.createConverter(sourceUnit, targetUnit);
+
+ double sourceValue = 100;
+
+ System.out.println(c);
+ System.out.println(sourceValue+" "+sourceUnit+" = "+c.convert(sourceValue)+" "+targetUnit);
+
+// System.out.println( Magnitude.getSuitable(50000) );
+
+
+ System.out.println( "150 mph = "+Units.convert(150, "mph", "km/h") +" km/h");
+ System.out.println( "100 hp = "+Units.convert(100, "hp(M)", "kW") +" kW");
+ System.out.println( "100 lbs = "+Units.convert(100, "lbs", "kg") +" kg");
+
+
+// c = Units.createConverter("in2", "cm2");
+// System.out.println();
+ } catch (UnitParseException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+}