366909: Code Examples
From EDC Trondheim
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=366909
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
index 332e920..0a36570 100644
--- 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
@@ -11,10 +11,10 @@
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);
+ System.out.print(v.doubleValue(Imperial.PINT));
+ System.out.println(" " + Imperial.PINT);
+ System.out.print(v.doubleValue(USCustomary.OUNCE_LIQUID));
+ System.out.println(" " + USCustomary.OUNCE_LIQUID);
}
}
diff --git a/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/console/sandbox/RadiologicalEmergencyPreparedness.java b/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/console/sandbox/RadiologicalEmergencyPreparedness.java
index 6ad6d4c..90fefe5 100644
--- a/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/console/sandbox/RadiologicalEmergencyPreparedness.java
+++ b/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/console/sandbox/RadiologicalEmergencyPreparedness.java
@@ -1,52 +1,51 @@
-/**
- * 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.examples.units.console.sandbox;
-
-import static org.eclipse.uomo.units.SI.Prefix.MILLI;
-import static org.eclipse.uomo.units.SI.*;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.uomo.units.IMeasure;
-import org.eclipse.uomo.units.impl.quantity.IonizingRadiationAmount;
-import org.unitsofmeasurement.quantity.IonizingRadiation;
-
-/**
- * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
- *
- * @see <a
- * href="http://www.nema.ne.gov/technological/dose-limits.html">NEMA:
- * Radiological Emergency Preparedness</a>
- */
-public class RadiologicalEmergencyPreparedness {
-
- /**
- * @param args
- */
- public static void main(String[] args) {
- Map <IMeasure<IonizingRadiation>, String> repMap = new HashMap<IMeasure<IonizingRadiation>, String>();
- IonizingRadiationAmount ira = new IonizingRadiationAmount(100, MILLI(ROENTGEN));
- // TODO fix formatting for mR
-
- repMap.put(ira, SandboxMessages.REP_100mR);
- ira = new IonizingRadiationAmount(1, ROENTGEN);
- repMap.put(ira, SandboxMessages.REP_1R);
- ira = new IonizingRadiationAmount(2.5, ROENTGEN);
- repMap.put(ira, SandboxMessages.REP_2dot5R);
-
- for (IMeasure<IonizingRadiation> dosimeterLimit : repMap.keySet()) {
- System.out.println(dosimeterLimit + " :: " + repMap.get(dosimeterLimit));
- }
-
- }
-
-}
+/**
+ * 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.examples.units.console.sandbox;
+
+import static org.eclipse.uomo.units.SI.Prefix.MILLI;
+import static org.eclipse.uomo.units.SI.*;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.uomo.units.IMeasure;
+import org.eclipse.uomo.units.impl.quantity.IonizingRadiationAmount;
+import org.unitsofmeasurement.quantity.IonizingRadiation;
+
+/**
+ * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
+ *
+ * @see <a
+ * href="http://www.nema.ne.gov/technological/dose-limits.html">NEMA:
+ * Radiological Emergency Preparedness</a>
+ */
+public class RadiologicalEmergencyPreparedness {
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+ Map <IMeasure<IonizingRadiation>, String> repMap = new HashMap<IMeasure<IonizingRadiation>, String>();
+ IonizingRadiationAmount ira = new IonizingRadiationAmount(100, MILLI(ROENTGEN));
+
+ repMap.put(ira, SandboxMessages.REP_100mR);
+ ira = new IonizingRadiationAmount(1, ROENTGEN);
+ repMap.put(ira, SandboxMessages.REP_1R);
+ ira = new IonizingRadiationAmount(2.5, ROENTGEN);
+ repMap.put(ira, SandboxMessages.REP_2dot5R);
+
+ for (IMeasure<IonizingRadiation> dosimeterLimit : repMap.keySet()) {
+ System.out.println(dosimeterLimit + " :: " + repMap.get(dosimeterLimit));
+ }
+
+ }
+
+}