ASSIGNED - bug 366909: Code Examples 
https://bugs.eclipse.org/bugs/show_bug.cgi?id=366909
diff --git a/bundles/org.eclipse.uomo.core/src/main/java/org/eclipse/uomo/core/impl/OutputHelper.java b/bundles/org.eclipse.uomo.core/src/main/java/org/eclipse/uomo/core/impl/OutputHelper.java
index d55b8ce..d44d195 100644
--- a/bundles/org.eclipse.uomo.core/src/main/java/org/eclipse/uomo/core/impl/OutputHelper.java
+++ b/bundles/org.eclipse.uomo.core/src/main/java/org/eclipse/uomo/core/impl/OutputHelper.java
@@ -1,5 +1,5 @@
 /**

- * Copyright (c) 2005, 2010, Werner Keil and others.

+ * 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

@@ -14,14 +14,14 @@
  * A static helper class, checking e.g. if some tests require optional console

  * output XXX this could have options for using a logging framework eventually

  * TODO change to Service (either OSGi LogService or separate service)

- * @version $Revision: 97 $, $Date: 2010-07-30 20:13:27 +0100 (Fr, 30 Jul 2010) $

+ * @version 0.98, 2013-12-08

  * @author Werner Keil

  */

 public abstract class OutputHelper {

-	public static final String CONSOLE_OUTPUT = "consoleOutput";

+	static final String CONSOLE_OUTPUT = "consoleOutput"; //$NON-NLS-1$

 

 	public static final boolean isConsoleOutput() {

-		return ("true".equals(System.getProperty(CONSOLE_OUTPUT)));

+		return ("true".equals(System.getProperty(CONSOLE_OUTPUT))); //$NON-NLS-1$

 	}

 

 	public static final void print(String message) {

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 7d8610d..8c0a804 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
@@ -69,7 +69,7 @@
 	public void testParse() {

 		Parser<String, Term> p = new ExpressionParser(ucumService.getModel());

 		try {

-			Term t =  p.parse("m/s2");

+			Term t =  p.parse("ms");

 			assertNotNull(t);

 			assertEquals("DIVISION", t.getOp().toString());

 			Symbol s = (Symbol)t.getComp();

diff --git a/bundles/org.eclipse.uomo.units/src/main/resources/org/eclipse/uomo/units/impl/format/messages.properties b/bundles/org.eclipse.uomo.units/src/main/resources/org/eclipse/uomo/units/impl/format/messages.properties
index df5e916..18e7765 100644
--- a/bundles/org.eclipse.uomo.units/src/main/resources/org/eclipse/uomo/units/impl/format/messages.properties
+++ b/bundles/org.eclipse.uomo.units/src/main/resources/org/eclipse/uomo/units/impl/format/messages.properties
@@ -85,4 +85,6 @@
 org.eclipse.uomo.units.impl.format.ParsePrefix.ZEPTO = z

 org.eclipse.uomo.units.impl.format.ParsePrefix.ZETTA = Z

 

+org.eclipse.uomo.units.impl.system.Imperial.PINT=pt

+

 org.eclipse.uomo.units.impl.system.CommonUnits.KILOMETRES_PER_HOUR=kph
\ No newline at end of file
diff --git a/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/Messages.java b/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/Messages.java
index 9761e13..f12aaa0 100644
--- a/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/Messages.java
+++ b/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/Messages.java
@@ -20,9 +20,6 @@
 	public static String Planet_SurfaceGravity;

 	public static String Planet_Usage;

 	public static String Planet_SurfaceWeight;

-	public static String REP_100mR;

-	public static String REP_1R;

-	public static String REP_2dot5R;

 	

 	public static String BEAT;

 	

diff --git a/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/console/sandbox/Beerfest.java b/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/console/sandbox/Beerfest.java
new file mode 100644
index 0000000..59929d9
--- /dev/null
+++ b/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/console/sandbox/Beerfest.java
@@ -0,0 +1,20 @@
+package org.eclipse.uomo.examples.units.console.sandbox;

+

+import org.eclipse.uomo.units.IMeasure;

+import org.eclipse.uomo.units.impl.system.Imperial;

+import org.eclipse.uomo.units.impl.system.USCustomary;

+import org.eclipse.uomo.units.impl.quantity.VolumeAmount;

+import org.unitsofmeasurement.quantity.Volume;

+

+public class Beerfest {

+

+	public static void main(String[] args) {

+		IMeasure<Volume> v= new VolumeAmount(.5d, USCustomary.LITER);

+		System.out.println(v);

+		IMeasure<Volume> v2 = v.to(Imperial.PINT);

+		System.out.println(v2);

+		IMeasure<Volume> v3 = v.to(USCustomary.OUNCE_LIQUID);

+		System.out.println(v3);

+	}

+

+}

diff --git a/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/types/DwarfPlanet.java b/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/types/DwarfPlanet.java
new file mode 100644
index 0000000..9f8be84
--- /dev/null
+++ b/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/types/DwarfPlanet.java
@@ -0,0 +1,93 @@
+/**

+ * Copyright (c) 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.examples.units.types;

+

+import static org.eclipse.uomo.units.SI.*;

+import static org.eclipse.uomo.units.SI.Prefix.KILO;

+import static org.eclipse.uomo.examples.units.types.SolarSystem.G;

+

+import org.eclipse.uomo.units.IMeasure;

+import org.eclipse.uomo.units.impl.quantity.AccelerationAmount;

+import org.eclipse.uomo.units.impl.quantity.LengthAmount;

+import org.eclipse.uomo.units.impl.quantity.MassAmount;

+import org.unitsofmeasurement.quantity.Acceleration;

+import org.unitsofmeasurement.quantity.Length;

+import org.unitsofmeasurement.quantity.Mass;

+import org.unitsofmeasurement.unit.Unit;

+

+/**

+ * @author  <a href="mailto:uomo@catmedia.us">Werner Keil</a>

+ * @version 1.0

+ * 

+ * This <type>enum</type> is inspired by Josh Bloch's example in <a href="http://www.oracle.com/technetwork/java/effectivejava-136174.html">Effective Java Second Edition</a>

+ * 

+ * <p>

+ * Suppose you want to add data and behavior to an enum. 

+ * For example consider <a href="http://en.wikipedia.org/wiki/Dwarf_planet">dwarf planets</a> of the <a href="http://en.wikipedia.org/wiki/Solar_System">solar system</a>. 

+ * Each planet knows its mass and radius, and can calculate its surface gravity and the weight of an object on the planet. 

+ * Here is how it looks:

+ * </p>

+ */

+public enum DwarfPlanet {

+	CERES(newMass(9.43e+20, KILOGRAM), newLength(0.4873e6, METRE)),

+    PLUTO(newMass(1.305e+22, KILOGRAM), newLength(1.153e6, METRE)),

+    HAUMEA(newMass(4.006e+21, KILOGRAM), newLength(620, KILO(METRE))),

+    MAKEMAKE(newMass(3e+21, KILOGRAM), newLength(715, KILO(METRE))),

+    ERIS(newMass(1.67e+22, KILOGRAM), newLength(1163, KILO(METRE)));

+

+    private final IMeasure<Mass> mass;   // in kilograms

+

+    private final IMeasure<Length> radius; // in meters

+

+    DwarfPlanet(IMeasure<Mass> mass, IMeasure<Length> radius) {

+        this.mass = mass;

+        this.radius = radius;

+    }

+

+    public IMeasure<Mass> getMass() {

+        return mass;

+    }

+

+    public IMeasure<Length> getRadius() {

+        return radius;

+    }

+

+    public Acceleration surfaceGravity() {

+        double m = mass.doubleValue(KILOGRAM);

+        double r = radius.doubleValue(METRE);

+        return new AccelerationAmount(

+                G * m / (r * r), METRES_PER_SQUARE_SECOND);

+    }

+

+    private static IMeasure<Mass> newMass(double value, Unit<Mass> unit) {

+        return new MassAmount(value, unit);

+    }

+

+    private static IMeasure<Length> newLength(double value, Unit<Length> unit) {

+        return new LengthAmount(value, unit);

+    }

+

+	@Override

+	public String toString() {

+		StringBuilder sb = new StringBuilder(super.toString());

+		sb.append("; ");

+		sb.append(Mass.class.getSimpleName());

+		sb.append(": ");

+		sb.append(getMass());

+		sb.append("; ");

+		sb.append("Radius: ");

+		sb.append(getRadius());

+		sb.append("; ");

+		sb.append("Surface Gravity: ");

+		sb.append(surfaceGravity());

+		return sb.toString();

+	}

+}
\ No newline at end of file
diff --git a/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/types/Planet.java b/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/types/Planet.java
new file mode 100644
index 0000000..acc4bb6
--- /dev/null
+++ b/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/types/Planet.java
@@ -0,0 +1,97 @@
+/**

+ * 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 - initial API and implementation

+ */

+package org.eclipse.uomo.examples.units.types;

+

+import static org.eclipse.uomo.units.SI.*;

+import static org.eclipse.uomo.examples.units.types.SolarSystem.G;

+

+import org.eclipse.uomo.examples.units.Messages;

+import org.eclipse.uomo.units.IMeasure;

+import org.eclipse.uomo.units.impl.quantity.AccelerationAmount;

+import org.eclipse.uomo.units.impl.quantity.LengthAmount;

+import org.eclipse.uomo.units.impl.quantity.MassAmount;

+import org.unitsofmeasurement.quantity.Acceleration;

+import org.unitsofmeasurement.quantity.Length;

+import org.unitsofmeasurement.quantity.Mass;

+import org.unitsofmeasurement.unit.Unit;

+

+/**

+ * @author  <a href="mailto:uomo@catmedia.us">Werner Keil</a>

+ * @version 1.0.2

+ * 

+ * This <type>enum</type> is inspired by Josh Bloch's example in <a href="http://www.oracle.com/technetwork/java/effectivejava-136174.html">Effective Java Second Edition</a>

+ * 

+ * <p>

+ * Suppose you want to add data and behavior to an enum. 

+ * For example consider <a href="http://en.wikipedia.org/wiki/Planet">planets</a> of the <a href="http://en.wikipedia.org/wiki/Solar_System">solar system</a>.  

+ * Each planet knows its mass and radius, and can calculate its surface gravity and the weight of an object on the planet. 

+ * Here is how it looks:

+ * </p>

+ */

+public enum Planet {

+

+    MERCURY(newMass(3.303e+23, KILOGRAM), newLength(2.4397e6, METRE)),

+    VENUS(newMass(4.869e+24, KILOGRAM), newLength(6.0518e6, METRE)),

+    EARTH(newMass(5.976e+24, KILOGRAM), newLength(6.37814e6, METRE)),

+    MARS(newMass(6.421e+23, KILOGRAM), newLength(3.3972e6, METRE)),

+    JUPITER(newMass(1.9e+27, KILOGRAM), newLength(7.1492e7, METRE)),

+    SATURN(newMass(5.688e+26, KILOGRAM), newLength(6.0268e7, METRE)),

+    URANUS(newMass(8.686e+25, KILOGRAM), newLength(2.5559e7, METRE)),

+    NEPTUNE(newMass(1.024e+26, KILOGRAM), newLength(2.4746e7, METRE));

+

+    private final IMeasure<Mass> mass;   // in kilograms

+

+    private final IMeasure<Length> radius; // in meters

+

+    Planet(IMeasure<Mass> mass, IMeasure<Length> radius) {

+        this.mass = mass;

+        this.radius = radius;

+    }

+

+    public IMeasure<Mass> getMass() {

+        return mass;

+    }

+

+    public IMeasure<Length> getRadius() {

+        return radius;

+    }

+

+    public Acceleration surfaceGravity() {

+        double m = mass.doubleValue(KILOGRAM);

+        double r = radius.doubleValue(METRE);

+        return new AccelerationAmount(

+                G * m / (r * r), METRES_PER_SQUARE_SECOND);

+    }

+

+    private static IMeasure<Mass> newMass(double value, Unit<Mass> unit) {

+        return new MassAmount(value, unit);

+    }

+

+    private static IMeasure<Length> newLength(double value, Unit<Length> unit) {

+        return new LengthAmount(value, unit);

+    }

+

+	@Override

+	public String toString() {

+		StringBuilder sb = new StringBuilder(super.toString());

+		sb.append("; ");

+		sb.append(Mass.class.getSimpleName());

+		sb.append(": ");

+		sb.append(getMass());

+		sb.append("; ");

+		sb.append(Messages.Planet_Radius);

+		sb.append(getRadius());

+		sb.append("; ");

+		sb.append("Surface Gravity: ");

+		sb.append(surfaceGravity());

+		return sb.toString();

+	}

+}
\ No newline at end of file
diff --git a/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/types/SolarSystem.java b/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/types/SolarSystem.java
new file mode 100644
index 0000000..621a10d
--- /dev/null
+++ b/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/types/SolarSystem.java
@@ -0,0 +1,6 @@
+package org.eclipse.uomo.examples.units.types;

+

+class SolarSystem {

+    // universal gravitational constant  (m3 kg-1 s-2)

+    static double G = 6.67300E-11;

+}

diff --git a/examples/units/org.eclipse.uomo.examples.units.console/src/main/resources/org/eclipse/uomo/examples/units/console/messages.properties b/examples/units/org.eclipse.uomo.examples.units.console/src/main/resources/org/eclipse/uomo/examples/units/console/messages.properties
new file mode 100644
index 0000000..6e270ea
--- /dev/null
+++ b/examples/units/org.eclipse.uomo.examples.units.console/src/main/resources/org/eclipse/uomo/examples/units/console/messages.properties
@@ -0,0 +1,27 @@
+#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)

+#

+# Copyright (c) 2005, 2011, 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

+#

+

+Planet_Radius = Planet Radius

+

+Planet_SurfaceWeight = Planet Surface Weight

+

+Planet_SurfaceGravity = Planet Surface Gravity

+

+Planet_Usage = Usage

+

+REP_100mR = Turn back value. Dosimeter reading allowed for performing Emergency Worker assignments. Report to the Radiological Officer or assigned State Health Physicist for further instructions.

+

+REP_1R = Dose allowed for assignments involving protection of valuable property.

+

+REP_2dot5R = Dose allowed for assignments involving lifesaving protection of large populations.

+

+BEAT = b
\ No newline at end of file
diff --git a/examples/units/org.eclipse.uomo.examples.units.console/src/main/resources/org/eclipse/uomo/examples/units/console/sandbox/messages.properties b/examples/units/org.eclipse.uomo.examples.units.console/src/main/resources/org/eclipse/uomo/examples/units/console/sandbox/messages.properties
new file mode 100644
index 0000000..3b22cbc
--- /dev/null
+++ b/examples/units/org.eclipse.uomo.examples.units.console/src/main/resources/org/eclipse/uomo/examples/units/console/sandbox/messages.properties
@@ -0,0 +1,17 @@
+#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)

+#

+# 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 - initial API and implementation

+#

+

+REP_100mR = Turn back value. Dosimeter reading allowed for performing Emergency Worker assignments. Report to the Radiological Officer or assigned State Health Physicist for further instructions.

+

+REP_1R = Dose allowed for assignments involving protection of valuable property.

+

+REP_2dot5R = Dose allowed for assignments involving lifesaving protection of large populations.
\ No newline at end of file
diff --git a/examples/units/org.eclipse.uomo.examples.units.console/src/main/resources/org/eclipse/uomo/examples/units/messages.properties b/examples/units/org.eclipse.uomo.examples.units.console/src/main/resources/org/eclipse/uomo/examples/units/messages.properties
index 6e270ea..a5a1ce1 100644
--- a/examples/units/org.eclipse.uomo.examples.units.console/src/main/resources/org/eclipse/uomo/examples/units/messages.properties
+++ b/examples/units/org.eclipse.uomo.examples.units.console/src/main/resources/org/eclipse/uomo/examples/units/messages.properties
@@ -1,6 +1,6 @@
 #Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)

 #

-# Copyright (c) 2005, 2011, Werner Keil and others.

+# 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

@@ -10,18 +10,12 @@
 #    Werner Keil - initial API and implementation

 #

 

-Planet_Radius = Planet Radius

+Planet_Radius = Radius:

 

-Planet_SurfaceWeight = Planet Surface Weight

+Planet_SurfaceWeight = Surface Weight:

 

-Planet_SurfaceGravity = Planet Surface Gravity

+Planet_SurfaceGravity = Surface Gravity:

 

 Planet_Usage = Usage

 

-REP_100mR = Turn back value. Dosimeter reading allowed for performing Emergency Worker assignments. Report to the Radiological Officer or assigned State Health Physicist for further instructions.

-

-REP_1R = Dose allowed for assignments involving protection of valuable property.

-

-REP_2dot5R = Dose allowed for assignments involving lifesaving protection of large populations.

-

 BEAT = b
\ No newline at end of file
diff --git a/examples/units/org.eclipse.uomo.examples.units.console/src/test/java/org/eclipse/uomo/examples/units/types/PlanetsTest.java b/examples/units/org.eclipse.uomo.examples.units.console/src/test/java/org/eclipse/uomo/examples/units/types/PlanetsTest.java
new file mode 100644
index 0000000..cc463b8
--- /dev/null
+++ b/examples/units/org.eclipse.uomo.examples.units.console/src/test/java/org/eclipse/uomo/examples/units/types/PlanetsTest.java
@@ -0,0 +1,57 @@
+/**

+ * 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 - initial API and implementation

+ */

+/**

+ * 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 - initial API and implementation

+ */

+package org.eclipse.uomo.examples.units.types;

+

+import static org.eclipse.uomo.core.impl.OutputHelper.println;

+import static org.junit.Assert.assertEquals;

+

+import org.eclipse.uomo.examples.units.types.Planet;

+import org.junit.Test;

+

+

+/**

+ * @author Werner Keil

+ * @version 1.0.1

+ */

+public class PlanetsTest {

+

+	@Test

+	public void testPlanets() {

+		Planet[] planets = Planet.values();

+		

+		for (Planet planet : planets) {

+			println(planet);

+		}

+		

+		assertEquals(8, planets.length);

+	}

+	

+	@Test

+	public void testDwarfPlanets() {

+		DwarfPlanet[] dwarfPlanets = DwarfPlanet.values();

+		

+		for (DwarfPlanet planet : dwarfPlanets) {

+			println(planet);

+		}

+		

+		assertEquals(5, dwarfPlanets.length);

+	}

+}

diff --git a/examples/units/org.eclipse.uomo.examples.units.console/src/test/java/org/eclipse/uomo/examples/units/types/package-info.java b/examples/units/org.eclipse.uomo.examples.units.console/src/test/java/org/eclipse/uomo/examples/units/types/package-info.java
new file mode 100644
index 0000000..c6a2b75
--- /dev/null
+++ b/examples/units/org.eclipse.uomo.examples.units.console/src/test/java/org/eclipse/uomo/examples/units/types/package-info.java
@@ -0,0 +1,8 @@
+/**

+ * 

+ */

+/**

+ * @author Werner

+ *

+ */

+package org.eclipse.uomo.examples.units.types;
\ No newline at end of file