348089: Deploy Maven artifacts
Updated ICU4J
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=348089
diff --git a/bundles/org.eclipse.uomo.business.tests/.classpath b/bundles/org.eclipse.uomo.business.tests/.classpath
index 9bc33d3..0b1bcf9 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/.classpath b/bundles/org.eclipse.uomo.business/.classpath
index 23d1b61..a625c7f 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/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 e26e439..dafd4d2 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 02d019b..97a1fe6 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 365feae..0c8cd78 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/impl/BDate.java b/bundles/org.eclipse.uomo.business/src/main/java/org/eclipse/uomo/business/types/impl/BDate.java
index b7ec213..50a0add 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 969843e..709cabc 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 1623160..7d0f887 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 9bc33d3..0b1bcf9 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/.classpath b/bundles/org.eclipse.uomo.core/.classpath
index 7e0a6d5..710ceaa 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/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 b66641c..72df53e 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/IValidator.java b/bundles/org.eclipse.uomo.core/src/main/java/org/eclipse/uomo/core/IValidator.java
index bf9c3d3..90d5729 100644
--- a/bundles/org.eclipse.uomo.core/src/main/java/org/eclipse/uomo/core/IValidator.java
+++ b/bundles/org.eclipse.uomo.core/src/main/java/org/eclipse/uomo/core/IValidator.java
@@ -1,22 +1,22 @@
-/**
- * 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
- */
-package org.eclipse.uomo.core;
-
-/**
- * @author <a href="mailto:oumo@catmedia.us">Werner Keil</a>
- *
- * @param <V>
- * the type to validate
- *
- */
-public interface IValidator<V> {
- public void validate(V v) throws UOMoException;
-}
+/**
+ * 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
+ */
+package org.eclipse.uomo.core;
+
+/**
+ * @author <a href="mailto:oumo@catmedia.us">Werner Keil</a>
+ *
+ * @param <V>
+ * the type to validate
+ *
+ */
+public interface IValidator<V> {
+ public void validate(V v) throws UOMoException;
+}
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 98de649..9671de2 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/resources/META-INF/spring/bundle-context.xml b/bundles/org.eclipse.uomo.core/src/main/resources/META-INF/spring/bundle-context.xml
index 8c4ef28..2459eb0 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.ucum.tests/.classpath b/bundles/org.eclipse.uomo.ucum.tests/.classpath
index 9bc33d3..0b1bcf9 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/.project b/bundles/org.eclipse.uomo.ucum.tests/.project
index c239d3f..65a1971 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/etc/org.eclipse.uomo.ucum.tests.launch b/bundles/org.eclipse.uomo.ucum.tests/etc/org.eclipse.uomo.ucum.tests.launch
index da2a12b..2e7ef92 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 b318597..4a28125 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 0e8a84d..6836d28 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/.classpath b/bundles/org.eclipse.uomo.ucum/.classpath
index 23d1b61..a625c7f 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/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 6f124dc..91d3e61 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 0728179..3f7aaa3 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/internal/Messages.java b/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/internal/Messages.java
index e11aaf7..43520d1 100644
--- a/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/internal/Messages.java
+++ b/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/internal/Messages.java
@@ -1,29 +1,29 @@
-package org.eclipse.uomo.ucum.internal;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = Messages.class.getPackage().getName() + ".messages"; //$NON-NLS-1$
- public static String DefinitionParser_0;
- public static String DefinitionParser_2;
- public static String DefinitionParser_29;
- public static String DefinitionParser_3;
- public static String DefinitionParser_30;
- public static String DefinitionParser_DateFormat;
- public static String DefinitionParser_54;
- public static String DefinitionParser_55;
- public static String DefinitionParser_56;
- public static String DefinitionParser_57;
- public static String DefinitionParser_58;
- public static String DefinitionParser_59;
- public static String DefinitionParser_60;
- public static String DefinitionParser_8;
- public static String DefinitionParser_9;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
+package org.eclipse.uomo.ucum.internal;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = Messages.class.getPackage().getName() + ".messages"; //$NON-NLS-1$
+ public static String DefinitionParser_0;
+ public static String DefinitionParser_2;
+ public static String DefinitionParser_29;
+ public static String DefinitionParser_3;
+ public static String DefinitionParser_30;
+ public static String DefinitionParser_DateFormat;
+ public static String DefinitionParser_54;
+ public static String DefinitionParser_55;
+ public static String DefinitionParser_56;
+ public static String DefinitionParser_57;
+ public static String DefinitionParser_58;
+ public static String DefinitionParser_59;
+ public static String DefinitionParser_60;
+ public static String DefinitionParser_8;
+ public static String DefinitionParser_9;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/model/Concept.java b/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/model/Concept.java
index 6db24b0..d41a9ed 100644
--- a/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/model/Concept.java
+++ b/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/model/Concept.java
@@ -1,127 +1,127 @@
-/*******************************************************************************
- * Crown Copyright (c) 2006, 2012, 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 - updates and consolidation with core
- *******************************************************************************/
-
-package org.eclipse.uomo.ucum.model;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.uomo.core.ICode;
-import org.eclipse.uomo.core.IDescription;
-import org.eclipse.uomo.core.INames;
-import org.eclipse.uomo.core.ISymbol;
-
-public class Concept implements ICode<String>, IDescription, ISymbol, INames {
-
- private final ConceptKind kind;
- /**
- * case sensitive code for this concept
- */
- private String code;
-
- /**
- * case insensitive (UPPERCASE) code for this concept
- */
- private String codeUC;
-
- /**
- * print symbol for this code
- */
- private String printSymbol;
-
- /**
- * names for the concept
- */
- private List<String> names = new ArrayList<String>();
-
-
- /**
- * @param code
- * @param codeUC
- */
- public Concept(ConceptKind kind, String code, String codeUC) {
- super();
- this.kind = kind;
- this.code = code;
- this.codeUC = codeUC;
- }
-
- /**
- * @return the code
- */
- public String getCode() {
- return code;
- }
-
- /**
- * @param code the code to set
- */
- public void setCode(String code) {
- this.code = code;
- }
-
- /**
- * @return the codeUC
- */
- public String getCodeUC() {
- return codeUC;
- }
-
- /**
- * @param codeUC the codeUC to set
- */
- public void setCodeUC(String codeUC) {
- this.codeUC = codeUC;
- }
-
- /**
- * @return the printSymbol
- */
- public String getPrintSymbol() {
- return printSymbol;
- }
-
- /**
- * @param printSymbol the printSymbol to set
- */
- public void setPrintSymbol(String printSymbol) {
- this.printSymbol = printSymbol;
- }
-
- @Override
- public String getSymbol() {
- return getPrintSymbol();
- }
-
- /**
- * @return the names
- */
- public List<String> getNames() {
- return names;
- }
-
- /**
- * @return the kind
- */
- public ConceptKind getKind() {
- return kind;
- }
-
- public String getDescription() {
- return kind.toString().toLowerCase()+" "+code+" ('"+names.get(0)+"')"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- @Override
- public String toString() {
- return this.getCode() + " = " + getDescription(); //$NON-NLS-1$
- }
-}
+/*******************************************************************************
+ * Crown Copyright (c) 2006, 2012, 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 - updates and consolidation with core
+ *******************************************************************************/
+
+package org.eclipse.uomo.ucum.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.uomo.core.ICode;
+import org.eclipse.uomo.core.IDescription;
+import org.eclipse.uomo.core.INames;
+import org.eclipse.uomo.core.ISymbol;
+
+public class Concept implements ICode<String>, IDescription, ISymbol, INames {
+
+ private final ConceptKind kind;
+ /**
+ * case sensitive code for this concept
+ */
+ private String code;
+
+ /**
+ * case insensitive (UPPERCASE) code for this concept
+ */
+ private String codeUC;
+
+ /**
+ * print symbol for this code
+ */
+ private String printSymbol;
+
+ /**
+ * names for the concept
+ */
+ private List<String> names = new ArrayList<String>();
+
+
+ /**
+ * @param code
+ * @param codeUC
+ */
+ public Concept(ConceptKind kind, String code, String codeUC) {
+ super();
+ this.kind = kind;
+ this.code = code;
+ this.codeUC = codeUC;
+ }
+
+ /**
+ * @return the code
+ */
+ public String getCode() {
+ return code;
+ }
+
+ /**
+ * @param code the code to set
+ */
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+ /**
+ * @return the codeUC
+ */
+ public String getCodeUC() {
+ return codeUC;
+ }
+
+ /**
+ * @param codeUC the codeUC to set
+ */
+ public void setCodeUC(String codeUC) {
+ this.codeUC = codeUC;
+ }
+
+ /**
+ * @return the printSymbol
+ */
+ public String getPrintSymbol() {
+ return printSymbol;
+ }
+
+ /**
+ * @param printSymbol the printSymbol to set
+ */
+ public void setPrintSymbol(String printSymbol) {
+ this.printSymbol = printSymbol;
+ }
+
+ @Override
+ public String getSymbol() {
+ return getPrintSymbol();
+ }
+
+ /**
+ * @return the names
+ */
+ public List<String> getNames() {
+ return names;
+ }
+
+ /**
+ * @return the kind
+ */
+ public ConceptKind getKind() {
+ return kind;
+ }
+
+ public String getDescription() {
+ return kind.toString().toLowerCase()+" "+code+" ('"+names.get(0)+"')"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ @Override
+ public String toString() {
+ return this.getCode() + " = " + getDescription(); //$NON-NLS-1$
+ }
+}
diff --git a/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/model/Prefix.java b/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/model/Prefix.java
index 709ebbb..e6619ff 100644
--- a/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/model/Prefix.java
+++ b/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/model/Prefix.java
@@ -1,56 +1,56 @@
-/*******************************************************************************
- * 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.model;
-
-import java.math.BigDecimal;
-
-public class Prefix extends Concept {
-
- /**
- * value for the prefix.
- */
- private BigDecimal value; // 1^-24 through to 1^24
-
- /**
- * @param code
- * @param codeUC
- */
- public Prefix(String code, String codeUC) {
- super(ConceptKind.PREFIX, code, codeUC);
- }
-
- /**
- * @return the index
- */
- public Number getValue() {
- return value;
- }
-
- /**
- * @param index the index to set
- */
- public void setValue(BigDecimal index) {
- this.value = index;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.ucum.model.Concept#getDescription()
- */
- @Override
- public String getDescription() {
- return super.getDescription()+" = "+value.toEngineeringString();
- }
-
-
-
-
-}
+/*******************************************************************************
+ * 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.model;
+
+import java.math.BigDecimal;
+
+public class Prefix extends Concept {
+
+ /**
+ * value for the prefix.
+ */
+ private BigDecimal value; // 1^-24 through to 1^24
+
+ /**
+ * @param code
+ * @param codeUC
+ */
+ public Prefix(String code, String codeUC) {
+ super(ConceptKind.PREFIX, code, codeUC);
+ }
+
+ /**
+ * @return the index
+ */
+ public Number getValue() {
+ return value;
+ }
+
+ /**
+ * @param index the index to set
+ */
+ public void setValue(BigDecimal index) {
+ this.value = index;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.ucum.model.Concept#getDescription()
+ */
+ @Override
+ public String getDescription() {
+ return super.getDescription()+" = "+value.toEngineeringString();
+ }
+
+
+
+
+}
diff --git a/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/model/Value.java b/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/model/Value.java
index e79bd42..c7f492d 100644
--- a/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/model/Value.java
+++ b/bundles/org.eclipse.uomo.ucum/src/main/java/org/eclipse/uomo/ucum/model/Value.java
@@ -1,110 +1,110 @@
-/*******************************************************************************
- * 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
- * Werner Keil - Cleaning, unification with other UOMo parts and Unit-API
- *******************************************************************************/
-
-package org.eclipse.uomo.ucum.model;
-
-import java.math.BigDecimal;
-
-import org.eclipse.uomo.core.IDescription;
-import org.eclipse.uomo.core.IText;
-import org.unitsofmeasurement.quantity.Quantity;
-import org.unitsofmeasurement.unit.Unit;
-
-public class Value<Q extends Quantity<Q>> implements Quantity<Q>, IDescription, IText {
- // TODO should use Quantity
- // TODO make this a "real" unit, should be at least UcumUnit
- private String unit;
- private Unit<Q> realUnit;
- private String unitUC;
-
- private BigDecimal value;
-
- private String text;
-
- /**
- * @param unit
- * @param unitUC
- * @param value
- */
- public Value(String unit, String unitUC, BigDecimal value) {
- super();
- this.unit = unit;
- this.unitUC = unitUC;
- this.value = value;
- }
-
- /**
- * @return the unit
- */
- public String getUnit() {
- return unit;
- }
-
- /**
- * @param unit the unit to set
- */
- public void setUnit(String unit) {
- this.unit = unit;
- }
-
- /**
- * @return the unitUC
- * @deprecated currently not used
- */
- public String getUnitUC() {
- return unitUC;
- }
-
- /**
- * @param unitUC the unitUC to set
- * @deprecated currently not used
- */
- public void setUnitUC(String unitUC) {
- this.unitUC = unitUC;
- }
-
- /**
- * @param value the value to set
- * @deprecated
- */
- void setValue(BigDecimal value) {
- this.value = value;
- }
-
- /**
- * @return the text
- */
- public String getText() {
- return text;
- }
-
- /**
- * @param text the text to set
- */
- public void setText(String text) {
- this.text = text;
- }
-
- public String getDescription() {
- if (value == null)
- return unit;
- return value.toEngineeringString()+unit;
- }
-
- public Number value() {
- return value;
- }
-
- public Unit<Q> unit() {
- return realUnit;
- }
-}
+/*******************************************************************************
+ * 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
+ * Werner Keil - Cleaning, unification with other UOMo parts and Unit-API
+ *******************************************************************************/
+
+package org.eclipse.uomo.ucum.model;
+
+import java.math.BigDecimal;
+
+import org.eclipse.uomo.core.IDescription;
+import org.eclipse.uomo.core.IText;
+import org.unitsofmeasurement.quantity.Quantity;
+import org.unitsofmeasurement.unit.Unit;
+
+public class Value<Q extends Quantity<Q>> implements Quantity<Q>, IDescription, IText {
+ // TODO should use Quantity
+ // TODO make this a "real" unit, should be at least UcumUnit
+ private String unit;
+ private Unit<Q> realUnit;
+ private String unitUC;
+
+ private BigDecimal value;
+
+ private String text;
+
+ /**
+ * @param unit
+ * @param unitUC
+ * @param value
+ */
+ public Value(String unit, String unitUC, BigDecimal value) {
+ super();
+ this.unit = unit;
+ this.unitUC = unitUC;
+ this.value = value;
+ }
+
+ /**
+ * @return the unit
+ */
+ public String getUnit() {
+ return unit;
+ }
+
+ /**
+ * @param unit the unit to set
+ */
+ public void setUnit(String unit) {
+ this.unit = unit;
+ }
+
+ /**
+ * @return the unitUC
+ * @deprecated currently not used
+ */
+ public String getUnitUC() {
+ return unitUC;
+ }
+
+ /**
+ * @param unitUC the unitUC to set
+ * @deprecated currently not used
+ */
+ public void setUnitUC(String unitUC) {
+ this.unitUC = unitUC;
+ }
+
+ /**
+ * @param value the value to set
+ * @deprecated
+ */
+ void setValue(BigDecimal value) {
+ this.value = value;
+ }
+
+ /**
+ * @return the text
+ */
+ public String getText() {
+ return text;
+ }
+
+ /**
+ * @param text the text to set
+ */
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ public String getDescription() {
+ if (value == null)
+ return unit;
+ return value.toEngineeringString()+unit;
+ }
+
+ public Number value() {
+ return value;
+ }
+
+ public Unit<Q> unit() {
+ return realUnit;
+ }
+}
diff --git a/bundles/org.eclipse.uomo.ucum/src/main/resources/org/eclipse/uomo/ucum/internal/messages.properties b/bundles/org.eclipse.uomo.ucum/src/main/resources/org/eclipse/uomo/ucum/internal/messages.properties
index a319bea..2886089 100644
--- a/bundles/org.eclipse.uomo.ucum/src/main/resources/org/eclipse/uomo/ucum/internal/messages.properties
+++ b/bundles/org.eclipse.uomo.ucum/src/main/resources/org/eclipse/uomo/ucum/internal/messages.properties
@@ -1,15 +1,15 @@
-DefinitionParser_0=Unable to process XML document
-DefinitionParser_2=Unable to process XML document: expected 'root' but found '
-DefinitionParser_29=Error reading
-DefinitionParser_3='
-DefinitionParser_30=:
-DefinitionParser_DateFormat=yyyy-MM-dd' 'HH:mm:ss' 'Z
-DefinitionParser_54=Unexpected content reading
-DefinitionParser_55=Unexpected state looking for
-DefinitionParser_56=: at
-DefinitionParser_57=\ reading
-DefinitionParser_58=Unexpected element looking for
-DefinitionParser_59=: found
-DefinitionParser_60=\ reading
-DefinitionParser_8=Unexpected text
-DefinitionParser_9=unknown element name
+DefinitionParser_0=Unable to process XML document
+DefinitionParser_2=Unable to process XML document: expected 'root' but found '
+DefinitionParser_29=Error reading
+DefinitionParser_3='
+DefinitionParser_30=:
+DefinitionParser_DateFormat=yyyy-MM-dd' 'HH:mm:ss' 'Z
+DefinitionParser_54=Unexpected content reading
+DefinitionParser_55=Unexpected state looking for
+DefinitionParser_56=: at
+DefinitionParser_57=\ reading
+DefinitionParser_58=Unexpected element looking for
+DefinitionParser_59=: found
+DefinitionParser_60=\ reading
+DefinitionParser_8=Unexpected text
+DefinitionParser_9=unknown element name
diff --git a/bundles/org.eclipse.uomo.ui/.classpath b/bundles/org.eclipse.uomo.ui/.classpath
index 92b64c7..5925878 100644
--- a/bundles/org.eclipse.uomo.ui/.classpath
+++ b/bundles/org.eclipse.uomo.ui/.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/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 kind="src" path="src/main/resources/"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/bundles/org.eclipse.uomo.ui/about.ini b/bundles/org.eclipse.uomo.ui/about.ini
index f7812cb..660e6a5 100644
--- a/bundles/org.eclipse.uomo.ui/about.ini
+++ b/bundles/org.eclipse.uomo.ui/about.ini
@@ -1,17 +1,17 @@
-# about.ini
-# contains information about a feature
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# "%key" are externalized strings defined in about.properties
-# This file does not need to be translated.
-
-# Property "aboutText" contains blurb for "About" dialog (translated)
-aboutText=%featureText
-
-# Property "featureImage" contains path to feature image (32x32)
-featureImage=src/main/resources/uomo32.png
-
-# Property "appName" contains name of the application (translated)
-appName=%featureName
-
-# Property "welcomePage" contains path to welcome page (special XML-based format)
-welcomePage=$nl$/welcome.xml
+# about.ini
+# contains information about a feature
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# "%key" are externalized strings defined in about.properties
+# This file does not need to be translated.
+
+# Property "aboutText" contains blurb for "About" dialog (translated)
+aboutText=%featureText
+
+# Property "featureImage" contains path to feature image (32x32)
+featureImage=src/main/resources/uomo32.png
+
+# Property "appName" contains name of the application (translated)
+appName=%featureName
+
+# Property "welcomePage" contains path to welcome page (special XML-based format)
+welcomePage=$nl$/welcome.xml
diff --git a/bundles/org.eclipse.uomo.units.tests/.classpath b/bundles/org.eclipse.uomo.units.tests/.classpath
index 9bc33d3..0b1bcf9 100644
--- a/bundles/org.eclipse.uomo.units.tests/.classpath
+++ b/bundles/org.eclipse.uomo.units.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.units.tests/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.uomo.units.tests/.settings/org.eclipse.jdt.core.prefs
index f287d53..c537b63 100644
--- a/bundles/org.eclipse.uomo.units.tests/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.uomo.units.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.units.tests/src/org/eclipse/uomo/units/impl/quantity/QuantityTest.java b/bundles/org.eclipse.uomo.units.tests/src/org/eclipse/uomo/units/impl/quantity/QuantityTest.java
index 5f7275e..a9d50aa 100644
--- a/bundles/org.eclipse.uomo.units.tests/src/org/eclipse/uomo/units/impl/quantity/QuantityTest.java
+++ b/bundles/org.eclipse.uomo.units.tests/src/org/eclipse/uomo/units/impl/quantity/QuantityTest.java
@@ -1,79 +1,79 @@
-/**
- * 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, Ikayzo and others - initial API and implementation
- */
-package org.eclipse.uomo.units.impl.quantity;
-
-import static org.eclipse.uomo.core.impl.OutputHelper.*;
-import static org.eclipse.uomo.units.SI.AMPERE_TURN;
-import static org.eclipse.uomo.units.SI.KILOGRAM;
-import static org.eclipse.uomo.units.SI.METRE;
-import static org.eclipse.uomo.units.SI.METRES_PER_SQUARE_SECOND;
-import static org.eclipse.uomo.units.SI.Prefix.KILO;
-import static org.junit.Assert.assertEquals;
-
-import org.eclipse.uomo.units.impl.quantity.AccelerationAmount;
-import org.eclipse.uomo.units.impl.quantity.LengthAmount;
-import org.eclipse.uomo.units.impl.quantity.MagnetomotiveForceAmount;
-import org.eclipse.uomo.units.impl.quantity.MassAmount;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
- * @version $Revision$, $Date$
- */
-public class QuantityTest {
- LengthAmount length;
- AccelerationAmount accel;
- MagnetomotiveForceAmount magneto;
-
- // universal gravitational constant (m3 kg-1 s-2)
- private static final double G = 6.67300E-11;
-
- private MassAmount mass; // in kilograms
- private LengthAmount radius; // in meters
-
-
- @Before
- public void setUp() throws Exception {
- length = new LengthAmount(4.0, METRE);
- accel = new AccelerationAmount(30, METRES_PER_SQUARE_SECOND);
- magneto = new MagnetomotiveForceAmount(50, AMPERE_TURN);
-
- mass = new MassAmount(30, KILOGRAM);
- radius = new LengthAmount(400, KILO(METRE));
- }
-
- @After
- public void tearDown() throws Exception {
- length = null;
- }
-
- @Test
- public void testLength() {
- LengthAmount len2 = new LengthAmount(4.0, METRE);
- assertEquals(length, len2);
- }
-
- private AccelerationAmount surfaceGravity() {
- double m = mass.doubleValue(KILOGRAM);
- double r = radius.doubleValue(METRE);
- return new AccelerationAmount(
- G * m / (r * r), METRES_PER_SQUARE_SECOND);
- }
-
- @Test
- public void testAccelo1() {
- AccelerationAmount ac1 = surfaceGravity();
- print("Gravity: ");
- println(ac1);
- }
-}
+/**
+ * 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, Ikayzo and others - initial API and implementation
+ */
+package org.eclipse.uomo.units.impl.quantity;
+
+import static org.eclipse.uomo.core.impl.OutputHelper.*;
+import static org.eclipse.uomo.units.SI.AMPERE_TURN;
+import static org.eclipse.uomo.units.SI.KILOGRAM;
+import static org.eclipse.uomo.units.SI.METRE;
+import static org.eclipse.uomo.units.SI.METRES_PER_SQUARE_SECOND;
+import static org.eclipse.uomo.units.SI.Prefix.KILO;
+import static org.junit.Assert.assertEquals;
+
+import org.eclipse.uomo.units.impl.quantity.AccelerationAmount;
+import org.eclipse.uomo.units.impl.quantity.LengthAmount;
+import org.eclipse.uomo.units.impl.quantity.MagnetomotiveForceAmount;
+import org.eclipse.uomo.units.impl.quantity.MassAmount;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
+ * @version $Revision$, $Date$
+ */
+public class QuantityTest {
+ LengthAmount length;
+ AccelerationAmount accel;
+ MagnetomotiveForceAmount magneto;
+
+ // universal gravitational constant (m3 kg-1 s-2)
+ private static final double G = 6.67300E-11;
+
+ private MassAmount mass; // in kilograms
+ private LengthAmount radius; // in meters
+
+
+ @Before
+ public void setUp() throws Exception {
+ length = new LengthAmount(4.0, METRE);
+ accel = new AccelerationAmount(30, METRES_PER_SQUARE_SECOND);
+ magneto = new MagnetomotiveForceAmount(50, AMPERE_TURN);
+
+ mass = new MassAmount(30, KILOGRAM);
+ radius = new LengthAmount(400, KILO(METRE));
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ length = null;
+ }
+
+ @Test
+ public void testLength() {
+ LengthAmount len2 = new LengthAmount(4.0, METRE);
+ assertEquals(length, len2);
+ }
+
+ private AccelerationAmount surfaceGravity() {
+ double m = mass.doubleValue(KILOGRAM);
+ double r = radius.doubleValue(METRE);
+ return new AccelerationAmount(
+ G * m / (r * r), METRES_PER_SQUARE_SECOND);
+ }
+
+ @Test
+ public void testAccelo1() {
+ AccelerationAmount ac1 = surfaceGravity();
+ print("Gravity: ");
+ println(ac1);
+ }
+}
diff --git a/bundles/org.eclipse.uomo.units/.classpath b/bundles/org.eclipse.uomo.units/.classpath
index 7e0a6d5..710ceaa 100644
--- a/bundles/org.eclipse.uomo.units/.classpath
+++ b/bundles/org.eclipse.uomo.units/.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.units/src/main/java/org/eclipse/uomo/units/AbstractFormat.java b/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/AbstractFormat.java
index 61c9eb9..f4613b2 100644
--- a/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/AbstractFormat.java
+++ b/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/AbstractFormat.java
@@ -1,117 +1,117 @@
-/**
- * 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, Ikayzo and others - initial API and implementation
- */
-package org.eclipse.uomo.units;
-
-import java.io.IOException;
-import java.text.ParsePosition;
-
-import org.eclipse.uomo.units.impl.format.LocalUnitFormatImpl;
-import org.eclipse.uomo.units.impl.system.USCustomary;
-import org.unitsofmeasurement.unit.Unit;
-import org.unitsofmeasurement.unit.UnitFormat;
-
-import com.ibm.icu.text.UFormat;
-import com.ibm.icu.util.ULocale;
-
-
-/**
- * <p> This class provides the interface for formatting and parsing {@link
- * AbstractUnit units}.</p>
- *
- * <p> For all metric units, the 20 SI prefixes used to form decimal
- * multiples and sub-multiples of SI units are recognized.
- * {@link USCustomary US Customary} units are directly recognized. For example:[code]
- * Unit.valueOf("m°C").equals(SI.MILLI(SI.CELSIUS))
- * Unit.valueOf("kW").equals(SI.KILO(SI.WATT))
- * Unit.valueOf("ft").equals(SI.METRE.multiply(3048).divide(10000))[/code]</p>
- *
- * @author <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
- * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
- * @version 1.5.1 ($Revision: 215 $), $Date: 2010-09-19 22:12:08 +0200 (So, 19 Sep 2010) $
- *
- */
-public abstract class AbstractFormat extends UFormat implements UnitFormat {
-
- /**
- * Returns the {@link SymbolMap} for this unit format.
- *
- * @return the symbol map used by this format.
- */
- protected abstract SymbolMap getSymbolMap();
-
- /**
- * Formats the specified unit.
- *
- * @param unit the unit to format.
- * @param appendable the appendable destination.
- * @return The appendable destination passed in as {@code appendable},
- * with formatted text appended.
- * @throws IOException if an error occurs.
- */
- public abstract Appendable format(Unit<?> unit, Appendable appendable)
- throws IOException;
-
- /**
- * Parses a portion of the specified <code>CharSequence</code> from the
- * specified position to produce a unit. If there is no unit to parse
- * {@link AbstractUnit#ONE} is returned.
- *
- * @param csq the <code>CharSequence</code> to parse.
- * @param cursor the cursor holding the current parsing index.
- * @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).
- */
- public abstract Unit<?> parse(CharSequence csq, ParsePosition cursor)
- throws IllegalArgumentException;
-
- /**
- * Return a formatter for CurrencyAmount objects in the given
- * locale.
- * @param locale desired locale
- * @return a formatter object
- * @stable ICU 3.0
- */
- public static AbstractFormat getUnitFormat(ULocale locale) {
- return LocalUnitFormatImpl.getInstance(locale.toLocale());
- }
-
- /**
- * Return a formatter for CurrencyAmount objects in the default
- * locale.
- * @return a formatter object
- * @stable ICU 3.0
- */
- public static AbstractFormat getUnitFormat() {
- return getUnitFormat(ULocale.getDefault());
- }
-
- /**
- * Convenience method equivalent to {@link #format(AbstractUnit, Appendable)}
- * except it does not raise an IOException.
- *
- * @param unit the unit to format.
- * @param dest the appendable destination.
- * @return the specified <code>StringBuilder</code>.
- */
- final StringBuilder format(AbstractUnit<?> unit, StringBuilder dest) {
- try {
- return (StringBuilder) this.format(unit, (Appendable) dest);
- } catch (IOException ex) {
- throw new Error(ex); // Can never happen.
- }
- }
-
- /**
- * serialVersionUID
- */
- private static final long serialVersionUID = -2046025267890654321L;
-}
+/**
+ * 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, Ikayzo and others - initial API and implementation
+ */
+package org.eclipse.uomo.units;
+
+import java.io.IOException;
+import java.text.ParsePosition;
+
+import org.eclipse.uomo.units.impl.format.LocalUnitFormatImpl;
+import org.eclipse.uomo.units.impl.system.USCustomary;
+import org.unitsofmeasurement.unit.Unit;
+import org.unitsofmeasurement.unit.UnitFormat;
+
+import com.ibm.icu.text.UFormat;
+import com.ibm.icu.util.ULocale;
+
+
+/**
+ * <p> This class provides the interface for formatting and parsing {@link
+ * AbstractUnit units}.</p>
+ *
+ * <p> For all metric units, the 20 SI prefixes used to form decimal
+ * multiples and sub-multiples of SI units are recognized.
+ * {@link USCustomary US Customary} units are directly recognized. For example:[code]
+ * Unit.valueOf("m°C").equals(SI.MILLI(SI.CELSIUS))
+ * Unit.valueOf("kW").equals(SI.KILO(SI.WATT))
+ * Unit.valueOf("ft").equals(SI.METRE.multiply(3048).divide(10000))[/code]</p>
+ *
+ * @author <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
+ * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
+ * @version 1.5.1 ($Revision: 215 $), $Date: 2010-09-19 22:12:08 +0200 (So, 19 Sep 2010) $
+ *
+ */
+public abstract class AbstractFormat extends UFormat implements UnitFormat {
+
+ /**
+ * Returns the {@link SymbolMap} for this unit format.
+ *
+ * @return the symbol map used by this format.
+ */
+ protected abstract SymbolMap getSymbolMap();
+
+ /**
+ * Formats the specified unit.
+ *
+ * @param unit the unit to format.
+ * @param appendable the appendable destination.
+ * @return The appendable destination passed in as {@code appendable},
+ * with formatted text appended.
+ * @throws IOException if an error occurs.
+ */
+ public abstract Appendable format(Unit<?> unit, Appendable appendable)
+ throws IOException;
+
+ /**
+ * Parses a portion of the specified <code>CharSequence</code> from the
+ * specified position to produce a unit. If there is no unit to parse
+ * {@link AbstractUnit#ONE} is returned.
+ *
+ * @param csq the <code>CharSequence</code> to parse.
+ * @param cursor the cursor holding the current parsing index.
+ * @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).
+ */
+ public abstract Unit<?> parse(CharSequence csq, ParsePosition cursor)
+ throws IllegalArgumentException;
+
+ /**
+ * Return a formatter for CurrencyAmount objects in the given
+ * locale.
+ * @param locale desired locale
+ * @return a formatter object
+ * @stable ICU 3.0
+ */
+ public static AbstractFormat getUnitFormat(ULocale locale) {
+ return LocalUnitFormatImpl.getInstance(locale.toLocale());
+ }
+
+ /**
+ * Return a formatter for CurrencyAmount objects in the default
+ * locale.
+ * @return a formatter object
+ * @stable ICU 3.0
+ */
+ public static AbstractFormat getUnitFormat() {
+ return getUnitFormat(ULocale.getDefault());
+ }
+
+ /**
+ * Convenience method equivalent to {@link #format(AbstractUnit, Appendable)}
+ * except it does not raise an IOException.
+ *
+ * @param unit the unit to format.
+ * @param dest the appendable destination.
+ * @return the specified <code>StringBuilder</code>.
+ */
+ final StringBuilder format(AbstractUnit<?> unit, StringBuilder dest) {
+ try {
+ return (StringBuilder) this.format(unit, (Appendable) dest);
+ } catch (IOException ex) {
+ throw new Error(ex); // Can never happen.
+ }
+ }
+
+ /**
+ * serialVersionUID
+ */
+ private static final long serialVersionUID = -2046025267890654321L;
+}
diff --git a/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/IState.java b/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/IState.java
index d04aa38..e2ac49f 100644
--- a/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/IState.java
+++ b/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/IState.java
@@ -1,28 +1,28 @@
-/**
- * Copyright (c) 2005, 2011, 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.units;
-
-import org.eclipse.uomo.core.IName;
-import org.unitsofmeasurement.quantity.Quantity;
-import org.unitsofmeasurement.quantity.Time;
-
-/**
- * Groups a state name, value and timestamp.
- * The state itself is represented as a <type>Number</type> and the time is measured in IMeasure<Time>
- * A State object is immutable so that it may be easily shared.
- *
- * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
- * @version 1.1, $Date: 2011-04-07 02:02:02 +0430 $
- */
-public interface IState<Q extends Quantity<Q>> extends IName {
- IMeasure<Time> time();
- IMeasure<Q> value(); // TODO get* vs. getter-less, also avoid value().value()
-}
+/**
+ * Copyright (c) 2005, 2011, 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.units;
+
+import org.eclipse.uomo.core.IName;
+import org.unitsofmeasurement.quantity.Quantity;
+import org.unitsofmeasurement.quantity.Time;
+
+/**
+ * Groups a state name, value and timestamp.
+ * The state itself is represented as a <type>Number</type> and the time is measured in IMeasure<Time>
+ * A State object is immutable so that it may be easily shared.
+ *
+ * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
+ * @version 1.1, $Date: 2011-04-07 02:02:02 +0430 $
+ */
+public interface IState<Q extends Quantity<Q>> extends IName {
+ IMeasure<Time> time();
+ IMeasure<Q> value(); // TODO get* vs. getter-less, also avoid value().value()
+}
diff --git a/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/AnnotatedUnit.java b/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/AnnotatedUnit.java
index 76e0037..a281377 100644
--- a/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/AnnotatedUnit.java
+++ b/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/AnnotatedUnit.java
@@ -1,150 +1,150 @@
-/**
- * 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, Ikayzo and others - initial API and implementation
- */
-package org.eclipse.uomo.units.impl;
-
-import java.util.Map;
-
-import org.eclipse.uomo.units.AbstractUnit;
-import org.unitsofmeasurement.quantity.Quantity;
-import org.unitsofmeasurement.unit.Unit;
-import org.unitsofmeasurement.unit.UnitConverter;
-
-/**
- * <p> This class represents an annotated unit. It allows for unit specialization
- * and annotation without changing the unit semantic. For example:[code]
- * public class Size implements Length {
- * private double meters;
- * ...
- * public static class Unit extends AnnotatedUnit<Length> {
- * private Unit(org.unitsofmeasure.Unit<Length> realUnit, String annotation) {
- * super(actualUnit, annotation);
- * }
- * public static Size.Unit METER = new Size.Unit(SI.METRE, "size"); // Equivalent to SI.METRE
- * public static Size.Unit INCH = new Size.Unit(NonSI.INCH, "size"); // Equivalent to NonSI.INCH
- * }
- * }[/code]</p>
- * <p> Annotation are often written between curly braces behind units
- * but they do not change, for example "%{vol}", "kg{total}", or
- * "{RBC}" (for "red blood cells") are equivalent to "%", "kg", and "1"
- * respectively.</p>
- *
- * <p><b>Note:</b> This class supports the {@code UnitFormat} implementation {@code LocalFormat},
- * hence it is currently part of the internal format API. If required and made public, it's possible
- * to locate in the "unit" package.</p>
- *
- * @param <Q> The type of the quantity measured by this unit.
- *
- * @author <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
- * @author <a href="mailto:units@catmedia.us">Werner Keil</a>
- * @version 1.1 ($Revision: 212 $), $Date: 2010-09-13 23:50:44 +0200 (Mo, 13 Sep 2010) $
- */
-public class AnnotatedUnit<Q extends Quantity<Q>> extends AbstractUnit<Q> {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Holds the annotation.
- */
- private final String annotation;
-
- /**
- * Holds the actual unit, never an annotated unit.
- */
- private final AbstractUnit<Q> actualUnit;
-
- public AbstractUnit<Q> getActualUnit() {
- return actualUnit;
- }
-
- /**
- * Creates an annotated unit for the specified unit.
- *
- * @param actualUnit the real unit.
- * @param annotation the annotation.
- */
- public AnnotatedUnit(AbstractUnit<Q> actualUnit, String annotation) {
- this.actualUnit = (actualUnit instanceof AnnotatedUnit<?>)
- ? ((AnnotatedUnit<Q>) actualUnit).actualUnit : actualUnit;
- this.annotation = annotation;
- }
-
- /**
- * Returns an annotated unit equivalent to this unit. The annotation
- * does not change the unit semantic.
- * Annotation are often written between curly braces behind units.
- * For example, annotated units "%{vol}", "kg{total}", or "{RBC}"
- * (for "red blood cells") are equivalent to "%", "kg", and "1" respectively.
- *
- * @param annotation the new symbol for the alternate unit.
- * @return the alternate unit.
- * @throws UnsupportedOperationException if this unit is not a metric unit.
- * @throws IllegalArgumentException if the specified symbol is already
- * associated to a different unit.
- */
- public final AbstractUnit<Q> annotate(String annotation) {
- return new AnnotatedUnit<Q>(this, annotation);
- }
-
- /**
- * Returns the annotation (if any) of this unit.
- * The default implementation returns <code>null</code> (no annotation).
- *
- * @return this unit annotation or <code>null</code> if this unit has not
- * specific symbol associated with (e.g. product of units).
- */
- public String getAnnotation() {
- return annotation;
- }
-
- @Override
- public String getSymbol() {
- return actualUnit.getSymbol();
- }
-
- @Override
- public Unit<Q> getSystemUnit() {
- return toMetric();
- }
-
- @Override
- public Map<Unit<?>, Integer> getProductUnits() {
- return actualUnit.getProductUnits();
- }
-
- @Override
- protected Unit<Q> toMetric() {
- return actualUnit.getSystemUnit();
- }
-
- @Override
- public UnitConverter getConverterToMetric() {
- return actualUnit.getConverterToMetric();
- }
-
- @Override
- public boolean equals(Object that) {
- if (this == that)
- return true;
- if (!(that instanceof AnnotatedUnit<?>))
- return false;
- AnnotatedUnit<?> thatUnit = (AnnotatedUnit<?>) that;
- return this.actualUnit.equals(thatUnit.actualUnit) &&
- this.annotation.equals(thatUnit.annotation);
- }
-
- @Override
- public int hashCode() {
- return actualUnit.hashCode() + annotation.hashCode();
- }
-}
+/**
+ * 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, Ikayzo and others - initial API and implementation
+ */
+package org.eclipse.uomo.units.impl;
+
+import java.util.Map;
+
+import org.eclipse.uomo.units.AbstractUnit;
+import org.unitsofmeasurement.quantity.Quantity;
+import org.unitsofmeasurement.unit.Unit;
+import org.unitsofmeasurement.unit.UnitConverter;
+
+/**
+ * <p> This class represents an annotated unit. It allows for unit specialization
+ * and annotation without changing the unit semantic. For example:[code]
+ * public class Size implements Length {
+ * private double meters;
+ * ...
+ * public static class Unit extends AnnotatedUnit<Length> {
+ * private Unit(org.unitsofmeasure.Unit<Length> realUnit, String annotation) {
+ * super(actualUnit, annotation);
+ * }
+ * public static Size.Unit METER = new Size.Unit(SI.METRE, "size"); // Equivalent to SI.METRE
+ * public static Size.Unit INCH = new Size.Unit(NonSI.INCH, "size"); // Equivalent to NonSI.INCH
+ * }
+ * }[/code]</p>
+ * <p> Annotation are often written between curly braces behind units
+ * but they do not change, for example "%{vol}", "kg{total}", or
+ * "{RBC}" (for "red blood cells") are equivalent to "%", "kg", and "1"
+ * respectively.</p>
+ *
+ * <p><b>Note:</b> This class supports the {@code UnitFormat} implementation {@code LocalFormat},
+ * hence it is currently part of the internal format API. If required and made public, it's possible
+ * to locate in the "unit" package.</p>
+ *
+ * @param <Q> The type of the quantity measured by this unit.
+ *
+ * @author <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
+ * @author <a href="mailto:units@catmedia.us">Werner Keil</a>
+ * @version 1.1 ($Revision: 212 $), $Date: 2010-09-13 23:50:44 +0200 (Mo, 13 Sep 2010) $
+ */
+public class AnnotatedUnit<Q extends Quantity<Q>> extends AbstractUnit<Q> {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Holds the annotation.
+ */
+ private final String annotation;
+
+ /**
+ * Holds the actual unit, never an annotated unit.
+ */
+ private final AbstractUnit<Q> actualUnit;
+
+ public AbstractUnit<Q> getActualUnit() {
+ return actualUnit;
+ }
+
+ /**
+ * Creates an annotated unit for the specified unit.
+ *
+ * @param actualUnit the real unit.
+ * @param annotation the annotation.
+ */
+ public AnnotatedUnit(AbstractUnit<Q> actualUnit, String annotation) {
+ this.actualUnit = (actualUnit instanceof AnnotatedUnit<?>)
+ ? ((AnnotatedUnit<Q>) actualUnit).actualUnit : actualUnit;
+ this.annotation = annotation;
+ }
+
+ /**
+ * Returns an annotated unit equivalent to this unit. The annotation
+ * does not change the unit semantic.
+ * Annotation are often written between curly braces behind units.
+ * For example, annotated units "%{vol}", "kg{total}", or "{RBC}"
+ * (for "red blood cells") are equivalent to "%", "kg", and "1" respectively.
+ *
+ * @param annotation the new symbol for the alternate unit.
+ * @return the alternate unit.
+ * @throws UnsupportedOperationException if this unit is not a metric unit.
+ * @throws IllegalArgumentException if the specified symbol is already
+ * associated to a different unit.
+ */
+ public final AbstractUnit<Q> annotate(String annotation) {
+ return new AnnotatedUnit<Q>(this, annotation);
+ }
+
+ /**
+ * Returns the annotation (if any) of this unit.
+ * The default implementation returns <code>null</code> (no annotation).
+ *
+ * @return this unit annotation or <code>null</code> if this unit has not
+ * specific symbol associated with (e.g. product of units).
+ */
+ public String getAnnotation() {
+ return annotation;
+ }
+
+ @Override
+ public String getSymbol() {
+ return actualUnit.getSymbol();
+ }
+
+ @Override
+ public Unit<Q> getSystemUnit() {
+ return toMetric();
+ }
+
+ @Override
+ public Map<Unit<?>, Integer> getProductUnits() {
+ return actualUnit.getProductUnits();
+ }
+
+ @Override
+ protected Unit<Q> toMetric() {
+ return actualUnit.getSystemUnit();
+ }
+
+ @Override
+ public UnitConverter getConverterToMetric() {
+ return actualUnit.getConverterToMetric();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (this == that)
+ return true;
+ if (!(that instanceof AnnotatedUnit<?>))
+ return false;
+ AnnotatedUnit<?> thatUnit = (AnnotatedUnit<?>) that;
+ return this.actualUnit.equals(thatUnit.actualUnit) &&
+ this.annotation.equals(thatUnit.annotation);
+ }
+
+ @Override
+ public int hashCode() {
+ return actualUnit.hashCode() + annotation.hashCode();
+ }
+}
diff --git a/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/converter/LogConverter.java b/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/converter/LogConverter.java
index 02d5693..8f98e62 100644
--- a/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/converter/LogConverter.java
+++ b/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/converter/LogConverter.java
@@ -1,113 +1,113 @@
-/**
- * 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, Ikayzo and others - initial API and implementation
- */
-package org.eclipse.uomo.units.impl.converter;
-
-import java.math.BigDecimal;
-import java.math.MathContext;
-
-import org.eclipse.uomo.units.AbstractConverter;
-
-/**
- * <p> This class represents a logarithmic converter of limited precision.
- * Such converter is typically used to create logarithmic unit.
- * For example:[code]
- * Unit<Dimensionless> BEL = Unit.ONE.transform(new LogConverter(10).inverse());
- * [/code]</p>
- *
- * <p> Instances of this class are immutable.</p>
- *
- * @author <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
- * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
- * @version 1.4 ($Revision: 132 $), $Date: 2010-08-10 07:04:41 +0100 (Di, 10 Aug 2010) $
- */
-public final class LogConverter extends AbstractConverter {
-
- /** The serialVersionUID */
- private static final long serialVersionUID = -5581266460675123322L;
-
- /**
- * Holds the logarithmic base.
- */
- private final double base;
- /**
- * Holds the natural logarithm of the base.
- */
- private final double logOfBase;
-
- /**
- * Creates a logarithmic converter having the specified base.
- *
- * @param base the logarithmic base (e.g. <code>Math.E</code> for
- * the Natural Logarithm).
- */
- public LogConverter(double base) {
- this.base = base;
- logOfBase = Math.log(base);
- }
-
- /**
- * Returns the logarithmic base of this converter.
- *
- * @return the logarithmic base (e.g. <code>Math.E</code> for
- * the Natural Logarithm).
- */
- public double getBase() {
- return base;
- }
-
- @Override
- public AbstractConverter inverse() {
- return new ExpConverter(base);
- }
-
- @Override
- public final String toString() {
- return "LogConverter("+ base + ")";
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof LogConverter))
- return false;
- LogConverter that = (LogConverter) obj;
- return this.base == that.base;
- }
-
- @Override
- public int hashCode() {
- long bits = Double.doubleToLongBits(base);
- return (int) (bits ^ (bits >>> 32));
- }
-
- @Override
- public double convert(double amount) {
- return Math.log(amount) / logOfBase;
- }
-
- @Override
- public BigDecimal convert(BigDecimal value, MathContext ctx) throws ArithmeticException {
- return BigDecimal.valueOf(convert(value.doubleValue())); // Reverts to double conversion.
- }
-
- @Override
- public Number convert(Number value) {
- if (value instanceof BigDecimal) {
- return convert((BigDecimal) value, MathContext.DECIMAL128);
- } else {
- return convert(value.doubleValue());
- }
- }
-
- @Override
- public boolean isLinear() {
- return false;
- }
-}
+/**
+ * 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, Ikayzo and others - initial API and implementation
+ */
+package org.eclipse.uomo.units.impl.converter;
+
+import java.math.BigDecimal;
+import java.math.MathContext;
+
+import org.eclipse.uomo.units.AbstractConverter;
+
+/**
+ * <p> This class represents a logarithmic converter of limited precision.
+ * Such converter is typically used to create logarithmic unit.
+ * For example:[code]
+ * Unit<Dimensionless> BEL = Unit.ONE.transform(new LogConverter(10).inverse());
+ * [/code]</p>
+ *
+ * <p> Instances of this class are immutable.</p>
+ *
+ * @author <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
+ * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
+ * @version 1.4 ($Revision: 132 $), $Date: 2010-08-10 07:04:41 +0100 (Di, 10 Aug 2010) $
+ */
+public final class LogConverter extends AbstractConverter {
+
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -5581266460675123322L;
+
+ /**
+ * Holds the logarithmic base.
+ */
+ private final double base;
+ /**
+ * Holds the natural logarithm of the base.
+ */
+ private final double logOfBase;
+
+ /**
+ * Creates a logarithmic converter having the specified base.
+ *
+ * @param base the logarithmic base (e.g. <code>Math.E</code> for
+ * the Natural Logarithm).
+ */
+ public LogConverter(double base) {
+ this.base = base;
+ logOfBase = Math.log(base);
+ }
+
+ /**
+ * Returns the logarithmic base of this converter.
+ *
+ * @return the logarithmic base (e.g. <code>Math.E</code> for
+ * the Natural Logarithm).
+ */
+ public double getBase() {
+ return base;
+ }
+
+ @Override
+ public AbstractConverter inverse() {
+ return new ExpConverter(base);
+ }
+
+ @Override
+ public final String toString() {
+ return "LogConverter("+ base + ")";
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof LogConverter))
+ return false;
+ LogConverter that = (LogConverter) obj;
+ return this.base == that.base;
+ }
+
+ @Override
+ public int hashCode() {
+ long bits = Double.doubleToLongBits(base);
+ return (int) (bits ^ (bits >>> 32));
+ }
+
+ @Override
+ public double convert(double amount) {
+ return Math.log(amount) / logOfBase;
+ }
+
+ @Override
+ public BigDecimal convert(BigDecimal value, MathContext ctx) throws ArithmeticException {
+ return BigDecimal.valueOf(convert(value.doubleValue())); // Reverts to double conversion.
+ }
+
+ @Override
+ public Number convert(Number value) {
+ if (value instanceof BigDecimal) {
+ return convert((BigDecimal) value, MathContext.DECIMAL128);
+ } else {
+ return convert(value.doubleValue());
+ }
+ }
+
+ @Override
+ public boolean isLinear() {
+ return false;
+ }
+}
diff --git a/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/format/SymbolMapImpl.java b/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/format/SymbolMapImpl.java
index 8f3cf01..740a1bb 100644
--- a/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/format/SymbolMapImpl.java
+++ b/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/format/SymbolMapImpl.java
@@ -1,216 +1,216 @@
-/**
- * Copyright (c) 2005, 2011, 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, Eric Russell - initial API and implementation
- */
-package org.eclipse.uomo.units.impl.format;
-
-import java.lang.reflect.Field;
-import java.math.BigInteger;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.ResourceBundle;
-
-import org.eclipse.uomo.units.AbstractUnit;
-import org.eclipse.uomo.units.SymbolMap;
-import org.eclipse.uomo.units.impl.converter.MultiplyConverter;
-import org.eclipse.uomo.units.impl.converter.RationalConverter;
-import org.unitsofmeasurement.unit.Unit;
-import org.unitsofmeasurement.unit.UnitConverter;
-
-
-/**
- * <p> This class holds the default implementation of the SymbolMap
- * interface.</p>
- *
- * <p> No attempt is made to verify the uniqueness of the mappings.</p>
- *
- * <p> Mappings are read from a <code>ResourceBundle</code>, the keys
- * of which should consist of a fully-qualified class name, followed
- * by a dot ('.'), and then the name of a static field belonging
- * to that class, followed optionally by another dot and a number.
- * If the trailing dot and number are not present, the value
- * associated with the key is treated as a
- * {@linkplain SymbolMap#label(org.unitsofmeasure.Unit, String) label},
- * otherwise if the trailing dot and number are present, the value
- * is treated as an {@linkplain SymbolMap#alias(org.unitsofmeasure.Unit,String) alias}.
- * Aliases map from String to Unit only, whereas labels map in both
- * directions. A given unit may have any number of aliases, but may
- * have only one label.</p>
- *
- * @author <a href="mailto:eric-r@northwestern.edu">Eric Russell</a>
- * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
- * @version 1.8 ($Revision: 212 $), $Date: 2010-09-13 23:50:44 +0200 (Mo, 13 Sep 2010) $
- */
-class SymbolMapImpl implements SymbolMap {
- // TODO fix issue with duplicate symbols (i.E. in different systems)
- private final Map<String, Unit<?>> symbolToUnit;
- private final Map<Unit<?>, String> unitToSymbol;
- private final Map<String, ParsePrefix> symbolToPrefix;
- private final Map<ParsePrefix, String> prefixToSymbol;
- private final Map<UnitConverter, ParsePrefix> converterToPrefix;
-
- /**
- * Creates an empty mapping.
- */
- public SymbolMapImpl () {
- symbolToUnit = new HashMap<String, Unit<?>>();
- unitToSymbol = new HashMap<Unit<?>, String>();
- symbolToPrefix = new HashMap<String, ParsePrefix>();
- prefixToSymbol = new HashMap<ParsePrefix, String>();
- converterToPrefix = new HashMap<UnitConverter, ParsePrefix>();
- }
-
- /**
- * Creates a symbol map from the specified resource bundle,
- *
- * @param rb the resource bundle.
- */
- public SymbolMapImpl (ResourceBundle rb) {
- this();
- for (Enumeration<String> i = rb.getKeys(); i.hasMoreElements();) {
- String fqn = i.nextElement();
- String symbol = rb.getString(fqn);
- boolean isAlias = false;
- int lastDot = fqn.lastIndexOf('.');
- String className = fqn.substring(0, lastDot);
- String fieldName = fqn.substring(lastDot+1, fqn.length());
- if (Character.isDigit(fieldName.charAt(0))) {
- isAlias = true;
- fqn = className;
- lastDot = fqn.lastIndexOf('.');
- className = fqn.substring(0, lastDot);
- fieldName = fqn.substring(lastDot+1, fqn.length());
- }
- try {
- Class<?> c = Class.forName(className);
- Field field = c.getField(fieldName);
- Object value = field.get(null);
- if (value instanceof AbstractUnit<?>) {
- if (isAlias) {
- alias((AbstractUnit<?>)value, symbol);
- } else {
- label((AbstractUnit<?>)value, symbol);
- }
- } else if (value instanceof ParsePrefix) {
- label((ParsePrefix)value, symbol);
- } else {
- throw new ClassCastException("" + value + " to Unit or Prefix"); //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-1$
- }
- } catch (Exception e) {
- System.err.println("Error reading Unit names: " + e.toString()); //$NON-NLS-1$
- }
- }
- }
-
-// public void label (Unit<?> unit, String symbol) {
-// symbolToUnit.put(symbol, unit);
-// unitToSymbol.put(unit, symbol);
-// }
-//
-// public void alias (Unit<?> unit, String symbol) {
-// symbolToUnit.put(symbol, unit);
-// }
-
-
- public Unit<?> getUnit (String symbol) {
- return symbolToUnit.get(symbol);
- }
-
-// public String getSymbol (Unit<?> unit) {
-// return unitToSymbol.get(unit);
-// }
-
- public UnitConverter getConverter(String prefix) {
- ParsePrefix prefixObject = symbolToPrefix.get(prefix);
- if (prefixObject == null) return null;
- return prefixObject.getConverter();
- }
-
- /**
- * Attaches a label to the specified prefix. For example:[code]
- * symbolMap.label(Prefix.GIGA, "G");
- * symbolMap.label(Prefix.MICRO, "µ");
- * [/code]
- */
- void label(ParsePrefix prefix, String symbol) {
- symbolToPrefix.put(symbol, prefix);
- prefixToSymbol.put(prefix, symbol);
- converterToPrefix.put(prefix.getConverter(), prefix);
- // adding MultiplyConverters (ensuring KILO(METRE) = METRE.multiply(1000)
- if (prefix.getConverter() instanceof RationalConverter) {
- RationalConverter rc = (RationalConverter)prefix.getConverter();
- if (rc.getDividend() != null && BigInteger.ONE.equals(rc.getDivisor())) {
- converterToPrefix.put(new MultiplyConverter(rc.getDividend().doubleValue()), prefix);
- } else if (rc.getDivisor() != null && BigInteger.ONE.equals(rc.getDividend())) {
- converterToPrefix.put(new MultiplyConverter(1d / rc.getDivisor().doubleValue()), prefix);
- }
- }
- }
-
- /**
- * Returns the prefix (if any) for the specified symbol.
- *
- * @param symbol the unit symbol.
- * @return the corresponding prefix or <code>null</code> if none.
- */
- ParsePrefix getPrefix (String symbol) {
- for (Iterator<String> i = symbolToPrefix.keySet().iterator(); i.hasNext(); ) {
- String pfSymbol = i.next();
- if (symbol.startsWith(pfSymbol)) {
- return symbolToPrefix.get(pfSymbol);
- }
- }
- return null;
- }
-
- /**
- * Returns the prefix for the specified converter.
- *
- * @param converter the unit converter.
- * @return the corresponding prefix or <code>null</code> if none.
- */
- ParsePrefix getPrefixObject (UnitConverter converter) {
- return converterToPrefix.get(converter);
- }
-
- /**
- * Returns the symbol for the specified prefix.
- *
- * @param prefix the prefix.
- * @return the corresponding symbol or <code>null</code> if none.
- */
- String getSymbol (ParsePrefix prefix) {
- return prefixToSymbol.get(prefix);
- }
-
- public void alias(Unit<?> unit, String symbol) {
- symbolToUnit.put(symbol, unit);
- }
-
- public String getPrefix(UnitConverter converter) {
- ParsePrefix prefix = getPrefixObject(converter);
- if (prefix == null) return null;
- return prefixToSymbol.get(prefix);
- }
-
- public String getSymbol(Unit<?> unit) {
- return unitToSymbol.get(unit);
- }
-
- public void label(Unit<?> unit, String symbol) {
- symbolToUnit.put(symbol, unit);
- unitToSymbol.put(unit, symbol);
- }
-
- public void prefix(UnitConverter cvtr, String prefix) {
- throw new UnsupportedOperationException("Prefixes are not modifiable"); //$NON-NLS-1$
- }
-}
+/**
+ * Copyright (c) 2005, 2011, 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, Eric Russell - initial API and implementation
+ */
+package org.eclipse.uomo.units.impl.format;
+
+import java.lang.reflect.Field;
+import java.math.BigInteger;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+import org.eclipse.uomo.units.AbstractUnit;
+import org.eclipse.uomo.units.SymbolMap;
+import org.eclipse.uomo.units.impl.converter.MultiplyConverter;
+import org.eclipse.uomo.units.impl.converter.RationalConverter;
+import org.unitsofmeasurement.unit.Unit;
+import org.unitsofmeasurement.unit.UnitConverter;
+
+
+/**
+ * <p> This class holds the default implementation of the SymbolMap
+ * interface.</p>
+ *
+ * <p> No attempt is made to verify the uniqueness of the mappings.</p>
+ *
+ * <p> Mappings are read from a <code>ResourceBundle</code>, the keys
+ * of which should consist of a fully-qualified class name, followed
+ * by a dot ('.'), and then the name of a static field belonging
+ * to that class, followed optionally by another dot and a number.
+ * If the trailing dot and number are not present, the value
+ * associated with the key is treated as a
+ * {@linkplain SymbolMap#label(org.unitsofmeasure.Unit, String) label},
+ * otherwise if the trailing dot and number are present, the value
+ * is treated as an {@linkplain SymbolMap#alias(org.unitsofmeasure.Unit,String) alias}.
+ * Aliases map from String to Unit only, whereas labels map in both
+ * directions. A given unit may have any number of aliases, but may
+ * have only one label.</p>
+ *
+ * @author <a href="mailto:eric-r@northwestern.edu">Eric Russell</a>
+ * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
+ * @version 1.8 ($Revision: 212 $), $Date: 2010-09-13 23:50:44 +0200 (Mo, 13 Sep 2010) $
+ */
+class SymbolMapImpl implements SymbolMap {
+ // TODO fix issue with duplicate symbols (i.E. in different systems)
+ private final Map<String, Unit<?>> symbolToUnit;
+ private final Map<Unit<?>, String> unitToSymbol;
+ private final Map<String, ParsePrefix> symbolToPrefix;
+ private final Map<ParsePrefix, String> prefixToSymbol;
+ private final Map<UnitConverter, ParsePrefix> converterToPrefix;
+
+ /**
+ * Creates an empty mapping.
+ */
+ public SymbolMapImpl () {
+ symbolToUnit = new HashMap<String, Unit<?>>();
+ unitToSymbol = new HashMap<Unit<?>, String>();
+ symbolToPrefix = new HashMap<String, ParsePrefix>();
+ prefixToSymbol = new HashMap<ParsePrefix, String>();
+ converterToPrefix = new HashMap<UnitConverter, ParsePrefix>();
+ }
+
+ /**
+ * Creates a symbol map from the specified resource bundle,
+ *
+ * @param rb the resource bundle.
+ */
+ public SymbolMapImpl (ResourceBundle rb) {
+ this();
+ for (Enumeration<String> i = rb.getKeys(); i.hasMoreElements();) {
+ String fqn = i.nextElement();
+ String symbol = rb.getString(fqn);
+ boolean isAlias = false;
+ int lastDot = fqn.lastIndexOf('.');
+ String className = fqn.substring(0, lastDot);
+ String fieldName = fqn.substring(lastDot+1, fqn.length());
+ if (Character.isDigit(fieldName.charAt(0))) {
+ isAlias = true;
+ fqn = className;
+ lastDot = fqn.lastIndexOf('.');
+ className = fqn.substring(0, lastDot);
+ fieldName = fqn.substring(lastDot+1, fqn.length());
+ }
+ try {
+ Class<?> c = Class.forName(className);
+ Field field = c.getField(fieldName);
+ Object value = field.get(null);
+ if (value instanceof AbstractUnit<?>) {
+ if (isAlias) {
+ alias((AbstractUnit<?>)value, symbol);
+ } else {
+ label((AbstractUnit<?>)value, symbol);
+ }
+ } else if (value instanceof ParsePrefix) {
+ label((ParsePrefix)value, symbol);
+ } else {
+ throw new ClassCastException("" + value + " to Unit or Prefix"); //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-1$
+ }
+ } catch (Exception e) {
+ System.err.println("Error reading Unit names: " + e.toString()); //$NON-NLS-1$
+ }
+ }
+ }
+
+// public void label (Unit<?> unit, String symbol) {
+// symbolToUnit.put(symbol, unit);
+// unitToSymbol.put(unit, symbol);
+// }
+//
+// public void alias (Unit<?> unit, String symbol) {
+// symbolToUnit.put(symbol, unit);
+// }
+
+
+ public Unit<?> getUnit (String symbol) {
+ return symbolToUnit.get(symbol);
+ }
+
+// public String getSymbol (Unit<?> unit) {
+// return unitToSymbol.get(unit);
+// }
+
+ public UnitConverter getConverter(String prefix) {
+ ParsePrefix prefixObject = symbolToPrefix.get(prefix);
+ if (prefixObject == null) return null;
+ return prefixObject.getConverter();
+ }
+
+ /**
+ * Attaches a label to the specified prefix. For example:[code]
+ * symbolMap.label(Prefix.GIGA, "G");
+ * symbolMap.label(Prefix.MICRO, "µ");
+ * [/code]
+ */
+ void label(ParsePrefix prefix, String symbol) {
+ symbolToPrefix.put(symbol, prefix);
+ prefixToSymbol.put(prefix, symbol);
+ converterToPrefix.put(prefix.getConverter(), prefix);
+ // adding MultiplyConverters (ensuring KILO(METRE) = METRE.multiply(1000)
+ if (prefix.getConverter() instanceof RationalConverter) {
+ RationalConverter rc = (RationalConverter)prefix.getConverter();
+ if (rc.getDividend() != null && BigInteger.ONE.equals(rc.getDivisor())) {
+ converterToPrefix.put(new MultiplyConverter(rc.getDividend().doubleValue()), prefix);
+ } else if (rc.getDivisor() != null && BigInteger.ONE.equals(rc.getDividend())) {
+ converterToPrefix.put(new MultiplyConverter(1d / rc.getDivisor().doubleValue()), prefix);
+ }
+ }
+ }
+
+ /**
+ * Returns the prefix (if any) for the specified symbol.
+ *
+ * @param symbol the unit symbol.
+ * @return the corresponding prefix or <code>null</code> if none.
+ */
+ ParsePrefix getPrefix (String symbol) {
+ for (Iterator<String> i = symbolToPrefix.keySet().iterator(); i.hasNext(); ) {
+ String pfSymbol = i.next();
+ if (symbol.startsWith(pfSymbol)) {
+ return symbolToPrefix.get(pfSymbol);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the prefix for the specified converter.
+ *
+ * @param converter the unit converter.
+ * @return the corresponding prefix or <code>null</code> if none.
+ */
+ ParsePrefix getPrefixObject (UnitConverter converter) {
+ return converterToPrefix.get(converter);
+ }
+
+ /**
+ * Returns the symbol for the specified prefix.
+ *
+ * @param prefix the prefix.
+ * @return the corresponding symbol or <code>null</code> if none.
+ */
+ String getSymbol (ParsePrefix prefix) {
+ return prefixToSymbol.get(prefix);
+ }
+
+ public void alias(Unit<?> unit, String symbol) {
+ symbolToUnit.put(symbol, unit);
+ }
+
+ public String getPrefix(UnitConverter converter) {
+ ParsePrefix prefix = getPrefixObject(converter);
+ if (prefix == null) return null;
+ return prefixToSymbol.get(prefix);
+ }
+
+ public String getSymbol(Unit<?> unit) {
+ return unitToSymbol.get(unit);
+ }
+
+ public void label(Unit<?> unit, String symbol) {
+ symbolToUnit.put(symbol, unit);
+ unitToSymbol.put(unit, symbol);
+ }
+
+ public void prefix(UnitConverter cvtr, String prefix) {
+ throw new UnsupportedOperationException("Prefixes are not modifiable"); //$NON-NLS-1$
+ }
+}
diff --git a/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/format/TokenMgrError.java b/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/format/TokenMgrError.java
index 8ec9b7f..d48cbb2 100644
--- a/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/format/TokenMgrError.java
+++ b/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/format/TokenMgrError.java
@@ -1,158 +1,158 @@
-/**
- * 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, Ikayzo and others - initial API and implementation
- */
-/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */
-/* JavaCCOptions: */
-package org.eclipse.uomo.units.impl.format;
-
-/** Token Manager Error. */
-class TokenMgrError extends Error
-{
-
- /**
- * The version identifier for this Serializable class.
- * Increment only if the <i>serialized</i> form of the
- * class changes.
- */
- private static final long serialVersionUID = -3348968864772188432L;
-
- /*
- * Ordinals for various reasons why an Error of this type can be thrown.
- */
-
-
- /**
- * Lexical error occurred.
- */
- static final int LEXICAL_ERROR = 0;
-
- /**
- * An attempt was made to create a second instance of a static token manager.
- */
- static final int STATIC_LEXER_ERROR = 1;
-
- /**
- * Tried to change to an invalid lexical state.
- */
- static final int INVALID_LEXICAL_STATE = 2;
-
- /**
- * Detected (and bailed out of) an infinite loop in the token manager.
- */
- static final int LOOP_DETECTED = 3;
-
- /**
- * Indicates the reason why the exception is thrown. It will have
- * one of the above 4 values.
- */
- int errorCode;
-
- /**
- * Replaces unprintable characters by their escaped (or unicode escaped)
- * equivalents in the given string
- */
- static final String addEscapes(String str) {
- StringBuffer retval = new StringBuffer();
- char ch;
- for (int i = 0; i < str.length(); i++) {
- switch (str.charAt(i))
- {
- case 0 :
- continue;
- case '\b':
- retval.append("\\b");
- continue;
- case '\t':
- retval.append("\\t");
- continue;
- case '\n':
- retval.append("\\n");
- continue;
- case '\f':
- retval.append("\\f");
- continue;
- case '\r':
- retval.append("\\r");
- continue;
- case '\"':
- retval.append("\\\"");
- continue;
- case '\'':
- retval.append("\\\'");
- continue;
- case '\\':
- retval.append("\\\\");
- continue;
- default:
- if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
- String s = "0000" + Integer.toString(ch, 16);
- retval.append("\\u" + s.substring(s.length() - 4, s.length()));
- } else {
- retval.append(ch);
- }
- continue;
- }
- }
- return retval.toString();
- }
-
- /**
- * Returns a detailed message for the Error when it is thrown by the
- * token manager to indicate a lexical error.
- * Parameters :
- * EOFSeen : indicates if EOF caused the lexical error
- * curLexState : lexical state in which this error occurred
- * errorLine : line number when the error occurred
- * errorColumn : column number when the error occurred
- * errorAfter : prefix that was seen before this error occurred
- * curchar : the offending character
- * Note: You can customize the lexical error message by modifying this method.
- */
- static String lexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
- return("Lexical error at line " +
- errorLine + ", column " +
- errorColumn + ". Encountered: " +
- (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
- "after : \"" + addEscapes(errorAfter) + "\"");
- }
-
- /**
- * You can also modify the body of this method to customize your error messages.
- * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
- * of end-users concern, so you can return something like :
- *
- * "Internal Error : Please file a bug report .... "
- *
- * from this method for such cases in the release version of your parser.
- */
- public String getMessage() {
- return super.getMessage();
- }
-
- /*
- * Constructors of various flavors follow.
- */
-
- /** No arg constructor. */
- public TokenMgrError() {
- }
-
- /** Constructor with message and reason. */
- public TokenMgrError(String message, int reason) {
- super(message);
- errorCode = reason;
- }
-
- /** Full Constructor. */
- public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
- this(lexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
- }
-}
-/* JavaCC - OriginalChecksum=8a6e5be586cca28053ad55584e013006 (do not edit this line) */
+/**
+ * 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, Ikayzo and others - initial API and implementation
+ */
+/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */
+/* JavaCCOptions: */
+package org.eclipse.uomo.units.impl.format;
+
+/** Token Manager Error. */
+class TokenMgrError extends Error
+{
+
+ /**
+ * The version identifier for this Serializable class.
+ * Increment only if the <i>serialized</i> form of the
+ * class changes.
+ */
+ private static final long serialVersionUID = -3348968864772188432L;
+
+ /*
+ * Ordinals for various reasons why an Error of this type can be thrown.
+ */
+
+
+ /**
+ * Lexical error occurred.
+ */
+ static final int LEXICAL_ERROR = 0;
+
+ /**
+ * An attempt was made to create a second instance of a static token manager.
+ */
+ static final int STATIC_LEXER_ERROR = 1;
+
+ /**
+ * Tried to change to an invalid lexical state.
+ */
+ static final int INVALID_LEXICAL_STATE = 2;
+
+ /**
+ * Detected (and bailed out of) an infinite loop in the token manager.
+ */
+ static final int LOOP_DETECTED = 3;
+
+ /**
+ * Indicates the reason why the exception is thrown. It will have
+ * one of the above 4 values.
+ */
+ int errorCode;
+
+ /**
+ * Replaces unprintable characters by their escaped (or unicode escaped)
+ * equivalents in the given string
+ */
+ static final String addEscapes(String str) {
+ StringBuffer retval = new StringBuffer();
+ char ch;
+ for (int i = 0; i < str.length(); i++) {
+ switch (str.charAt(i))
+ {
+ case 0 :
+ continue;
+ case '\b':
+ retval.append("\\b");
+ continue;
+ case '\t':
+ retval.append("\\t");
+ continue;
+ case '\n':
+ retval.append("\\n");
+ continue;
+ case '\f':
+ retval.append("\\f");
+ continue;
+ case '\r':
+ retval.append("\\r");
+ continue;
+ case '\"':
+ retval.append("\\\"");
+ continue;
+ case '\'':
+ retval.append("\\\'");
+ continue;
+ case '\\':
+ retval.append("\\\\");
+ continue;
+ default:
+ if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
+ String s = "0000" + Integer.toString(ch, 16);
+ retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+ } else {
+ retval.append(ch);
+ }
+ continue;
+ }
+ }
+ return retval.toString();
+ }
+
+ /**
+ * Returns a detailed message for the Error when it is thrown by the
+ * token manager to indicate a lexical error.
+ * Parameters :
+ * EOFSeen : indicates if EOF caused the lexical error
+ * curLexState : lexical state in which this error occurred
+ * errorLine : line number when the error occurred
+ * errorColumn : column number when the error occurred
+ * errorAfter : prefix that was seen before this error occurred
+ * curchar : the offending character
+ * Note: You can customize the lexical error message by modifying this method.
+ */
+ static String lexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
+ return("Lexical error at line " +
+ errorLine + ", column " +
+ errorColumn + ". Encountered: " +
+ (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
+ "after : \"" + addEscapes(errorAfter) + "\"");
+ }
+
+ /**
+ * You can also modify the body of this method to customize your error messages.
+ * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
+ * of end-users concern, so you can return something like :
+ *
+ * "Internal Error : Please file a bug report .... "
+ *
+ * from this method for such cases in the release version of your parser.
+ */
+ public String getMessage() {
+ return super.getMessage();
+ }
+
+ /*
+ * Constructors of various flavors follow.
+ */
+
+ /** No arg constructor. */
+ public TokenMgrError() {
+ }
+
+ /** Constructor with message and reason. */
+ public TokenMgrError(String message, int reason) {
+ super(message);
+ errorCode = reason;
+ }
+
+ /** Full Constructor. */
+ public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
+ this(lexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
+ }
+}
+/* JavaCC - OriginalChecksum=8a6e5be586cca28053ad55584e013006 (do not edit this line) */
diff --git a/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/format/UnitFormatServiceImpl.java b/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/format/UnitFormatServiceImpl.java
index 49699a1..e3649fd 100644
--- a/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/format/UnitFormatServiceImpl.java
+++ b/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/format/UnitFormatServiceImpl.java
@@ -1,42 +1,42 @@
-/**
- * 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 - initial API and implementation
- */
-package org.eclipse.uomo.units.impl.format;
-
-import java.util.Locale;
-
-import org.eclipse.uomo.units.AbstractFormat;
-import org.unitsofmeasurement.service.UnitFormatService;
-import org.unitsofmeasurement.unit.UnitFormat;
-
-import com.ibm.icu.util.ULocale;
-
-/**
- * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
- * @version 0.5 ($Revision: 308 $), $Date: 2010-11-02 15:56:52 +0000 (Di, 02 Nov 2010) $
- */
-public class UnitFormatServiceImpl implements UnitFormatService {
-
- @Override
- public UnitFormat getUnitFormat() {
- return AbstractFormat.getUnitFormat();
- }
-
- @Override
- public UnitFormat getUnitFormat(String name) {
- return getUnitFormat();
- }
-
- @Override
- public UnitFormat getUnitFormat(Locale locale) {
- return AbstractFormat.getUnitFormat(ULocale.forLocale(locale));
- }
-
-}
+/**
+ * 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 - initial API and implementation
+ */
+package org.eclipse.uomo.units.impl.format;
+
+import java.util.Locale;
+
+import org.eclipse.uomo.units.AbstractFormat;
+import org.unitsofmeasurement.service.UnitFormatService;
+import org.unitsofmeasurement.unit.UnitFormat;
+
+import com.ibm.icu.util.ULocale;
+
+/**
+ * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
+ * @version 0.5 ($Revision: 308 $), $Date: 2010-11-02 15:56:52 +0000 (Di, 02 Nov 2010) $
+ */
+public class UnitFormatServiceImpl implements UnitFormatService {
+
+ @Override
+ public UnitFormat getUnitFormat() {
+ return AbstractFormat.getUnitFormat();
+ }
+
+ @Override
+ public UnitFormat getUnitFormat(String name) {
+ return getUnitFormat();
+ }
+
+ @Override
+ public UnitFormat getUnitFormat(Locale locale) {
+ return AbstractFormat.getUnitFormat(ULocale.forLocale(locale));
+ }
+
+}
diff --git a/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/quantity/ForceAmount.java b/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/quantity/ForceAmount.java
index 3d7864e..cac9663 100644
--- a/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/quantity/ForceAmount.java
+++ b/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/quantity/ForceAmount.java
@@ -1,32 +1,32 @@
-/**
- * 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.units.impl.quantity;
-
-import org.eclipse.uomo.units.impl.BaseQuantity;
-import org.eclipse.uomo.units.impl.BaseQuantity;
-import org.unitsofmeasurement.quantity.Force;
-import org.unitsofmeasurement.unit.Unit;
-
-/**
- * Represents a quantity that tends to produce an acceleration of a body in the
- * direction of its application. The metric system unit for this quantity is "N"
- * (Newton).
- *
- * @author <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
- * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
- * @version 1.3, $Date: 2013-05-21 $
- */
-public final class ForceAmount extends BaseQuantity<Force> implements Force {
-
- public ForceAmount(Number number, Unit<Force> unit) {
- super(number, unit);
- }
-}
+/**
+ * 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.units.impl.quantity;
+
+import org.eclipse.uomo.units.impl.BaseQuantity;
+import org.eclipse.uomo.units.impl.BaseQuantity;
+import org.unitsofmeasurement.quantity.Force;
+import org.unitsofmeasurement.unit.Unit;
+
+/**
+ * Represents a quantity that tends to produce an acceleration of a body in the
+ * direction of its application. The metric system unit for this quantity is "N"
+ * (Newton).
+ *
+ * @author <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
+ * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
+ * @version 1.3, $Date: 2013-05-21 $
+ */
+public final class ForceAmount extends BaseQuantity<Force> implements Force {
+
+ public ForceAmount(Number number, Unit<Force> unit) {
+ super(number, unit);
+ }
+}
diff --git a/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/quantity/InformationAmount.java b/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/quantity/InformationAmount.java
index 59a8912..908e059 100644
--- a/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/quantity/InformationAmount.java
+++ b/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/quantity/InformationAmount.java
@@ -1,31 +1,31 @@
-/**
- * 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.units.impl.quantity;
-
-import org.eclipse.uomo.units.impl.BaseQuantity;
-import org.unitsofmeasurement.quantity.Information;
-import org.unitsofmeasurement.unit.Unit;
-
-/**
- * Represents a measure of data amount. The metric system unit for this quantity
- * is "bit".
- *
- * @author <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
- * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
- * @version 1.5, $Date: 2013-05-21 $
- */
-public final class InformationAmount extends BaseQuantity<Information> implements
- Information {
-
- public InformationAmount(Number number, Unit<Information> unit) {
- super(number, unit);
- }
-}
+/**
+ * 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.units.impl.quantity;
+
+import org.eclipse.uomo.units.impl.BaseQuantity;
+import org.unitsofmeasurement.quantity.Information;
+import org.unitsofmeasurement.unit.Unit;
+
+/**
+ * Represents a measure of data amount. The metric system unit for this quantity
+ * is "bit".
+ *
+ * @author <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
+ * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
+ * @version 1.5, $Date: 2013-05-21 $
+ */
+public final class InformationAmount extends BaseQuantity<Information> implements
+ Information {
+
+ public InformationAmount(Number number, Unit<Information> unit) {
+ super(number, unit);
+ }
+}
diff --git a/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/quantity/PowerAmount.java b/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/quantity/PowerAmount.java
index bc4179b..62c267c 100644
--- a/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/quantity/PowerAmount.java
+++ b/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/quantity/PowerAmount.java
@@ -1,30 +1,30 @@
-/**
- * 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.units.impl.quantity;
-
-import org.eclipse.uomo.units.impl.BaseQuantity;
-import org.unitsofmeasurement.quantity.Power;
-import org.unitsofmeasurement.unit.Unit;
-
-/**
- * Represents the rate at which work is done.
- * The metric system unit for this quantity is "W" (Watt).
- *
- * @author <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
- * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
- * @version 1.2, $Date: 2013-05-21 $
- */
-public final class PowerAmount extends BaseQuantity<Power> implements Power {
-
- public PowerAmount(Number number,Unit<Power> unit) {
- super(number, unit);
- }
-}
+/**
+ * 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.units.impl.quantity;
+
+import org.eclipse.uomo.units.impl.BaseQuantity;
+import org.unitsofmeasurement.quantity.Power;
+import org.unitsofmeasurement.unit.Unit;
+
+/**
+ * Represents the rate at which work is done.
+ * The metric system unit for this quantity is "W" (Watt).
+ *
+ * @author <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
+ * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
+ * @version 1.2, $Date: 2013-05-21 $
+ */
+public final class PowerAmount extends BaseQuantity<Power> implements Power {
+
+ public PowerAmount(Number number,Unit<Power> unit) {
+ super(number, unit);
+ }
+}
diff --git a/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/quantity/SubstanceAmount.java b/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/quantity/SubstanceAmount.java
index 7e2f6d7..c34e743 100644
--- a/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/quantity/SubstanceAmount.java
+++ b/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/quantity/SubstanceAmount.java
@@ -1,30 +1,30 @@
-/**
- * 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 - initial API and implementation
- */
-package org.eclipse.uomo.units.impl.quantity;
-
-import org.eclipse.uomo.units.impl.BaseQuantity;
-import org.unitsofmeasurement.quantity.AmountOfSubstance;
-import org.unitsofmeasurement.unit.Unit;
-
-/**
- * Represents the number of elementary entities (molecules, for example) of a substance.
- * The metric system unit for this quantity is "mol" (mole).
- *
- * @author <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
- * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
- * @version 1.4 ($Revision: 212 $), $Date: 2010-09-13 23:50:44 +0200 (Mo, 13 Sep 2010) $
- */
-public class SubstanceAmount extends BaseQuantity<AmountOfSubstance> {
-
- public SubstanceAmount(Number number, Unit<AmountOfSubstance> unit) {
- super(number, unit);
- }
-}
+/**
+ * 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 - initial API and implementation
+ */
+package org.eclipse.uomo.units.impl.quantity;
+
+import org.eclipse.uomo.units.impl.BaseQuantity;
+import org.unitsofmeasurement.quantity.AmountOfSubstance;
+import org.unitsofmeasurement.unit.Unit;
+
+/**
+ * Represents the number of elementary entities (molecules, for example) of a substance.
+ * The metric system unit for this quantity is "mol" (mole).
+ *
+ * @author <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
+ * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
+ * @version 1.4 ($Revision: 212 $), $Date: 2010-09-13 23:50:44 +0200 (Mo, 13 Sep 2010) $
+ */
+public class SubstanceAmount extends BaseQuantity<AmountOfSubstance> {
+
+ public SubstanceAmount(Number number, Unit<AmountOfSubstance> unit) {
+ super(number, unit);
+ }
+}
diff --git a/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/package-info.java b/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/package-info.java
index d33ab3b..2929189 100644
--- a/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/package-info.java
+++ b/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/package-info.java
@@ -1,89 +1,89 @@
-/**
- * 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, Ikayzo and others - initial API and implementation
- */
-/**
- * Provides support for programatic unit handling.
- *
- * <h3> Standard/NonStandard Units</h3>
- * Standard units and prefixes are provided by the
- * {@link org.eclipse.uomo.units.SI} class (Système International d'Unités) and
- * about 50 non-standard units are available through the
- * {@link org.eclipse.uomo.units.impl.system.USCustomary} class.
- *
- * <h3>Usage examples:</h3>
- * [code]
- *
- * import static org.eclipse.uomo.units.SI.*;
- * import static org.eclipse.uomo.units.impl.system.USCustomary.*;
-
- * public class Main {
- * public void main(String[] args) {
- *
- * // Conversion between units (explicit way).
- * Unit<Length> sourceUnit = KILO(METRE);
- * Unit<Length> targetUnit = MILE;
- * UnitConverter uc = sourceUnit.getConverterTo(targetUnit);
- * System.out.println(uc.convert(10)); // Converts 10 km to miles.
- *
- * // Same conversion than above, packed in one line.
- * System.out.println(KILO(METRE).getConverterTo(MILE).convert(10));
- *
- * // Retrieval of the system unit (identifies the measurement type).
- * System.out.println(REVOLUTION.divide(MINUTE).toMetric());
- *
- * // Dimension checking (allows/disallows conversions)
- * System.out.println(ELECTRON_VOLT.isCompatible(WATT.times(HOUR)));
- *
- * // Retrieval of the unit dimension (depends upon the current model).
- * System.out.println(ELECTRON_VOLT.getDimension());
- * }
- * }
- *
- * > 6.2137119223733395
- * > 6.2137119223733395
- * > rad/s
- * > true
- * > [L]²·[M]/[T]²
- * [/code]
- *
- * <h3>Unit Parameterization</h3>
- *
- * Units are parameterized (e.g. <Time extends {@link org.unitsofmeasure.Quantity Quantity}>) to
- * enforce compile-time checks of units/measures consistency, for example:[code]
- *
- * Unit<Time> MINUTE = SECOND.times(60); // Ok.
- * Unit<Time> MINUTE = METRE.times(60); // Compile error.
- *
- * Unit<Pressure> HECTOPASCAL = HECTO(PASCAL); // Ok.
- * Unit<Pressure> HECTOPASCAL = HECTO(NEWTON); // Compile error.
- *
- * TimeAmount duration = new TimeAmount(2, MINUTE); // Ok.
- * TimeAmount duration = new TimeAmount(2, CELSIUS); // Compile error.
- *
- * long milliseconds = duration.longValue(MILLI(SECOND)); // Ok.
- * long milliseconds = duration.longValue(POUND); // Compile error.
- * [/code]
- *
- * Runtime checks of dimension consistency can be done for more complex cases.
- *
- * [code]
- * Unit<Area> SQUARE_FOOT = FOOT.times(FOOT).asType(Area.class); // Ok.
- * Unit<Area> SQUARE_FOOT = FOOT.times(KELVIN).asType(Area.class); // Runtime error.
- *
- * Unit<Temperature> KELVIN = Unit.valueOf("K").asType(Temperature.class); // Ok.
- * Unit<Temperature> KELVIN = Unit.valueOf("kg").asType(Temperature.class); // Runtime error.
- * [/code]
- * </p>
- *
- * @author <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
- * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
- * @version 0.5.1, $Date: 2010-08-10 07:04:41 +0100 (Di, 10 Aug 2010) $
- */
-package org.eclipse.uomo.units;
+/**
+ * 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, Ikayzo and others - initial API and implementation
+ */
+/**
+ * Provides support for programatic unit handling.
+ *
+ * <h3> Standard/NonStandard Units</h3>
+ * Standard units and prefixes are provided by the
+ * {@link org.eclipse.uomo.units.SI} class (Système International d'Unités) and
+ * about 50 non-standard units are available through the
+ * {@link org.eclipse.uomo.units.impl.system.USCustomary} class.
+ *
+ * <h3>Usage examples:</h3>
+ * [code]
+ *
+ * import static org.eclipse.uomo.units.SI.*;
+ * import static org.eclipse.uomo.units.impl.system.USCustomary.*;
+
+ * public class Main {
+ * public void main(String[] args) {
+ *
+ * // Conversion between units (explicit way).
+ * Unit<Length> sourceUnit = KILO(METRE);
+ * Unit<Length> targetUnit = MILE;
+ * UnitConverter uc = sourceUnit.getConverterTo(targetUnit);
+ * System.out.println(uc.convert(10)); // Converts 10 km to miles.
+ *
+ * // Same conversion than above, packed in one line.
+ * System.out.println(KILO(METRE).getConverterTo(MILE).convert(10));
+ *
+ * // Retrieval of the system unit (identifies the measurement type).
+ * System.out.println(REVOLUTION.divide(MINUTE).toMetric());
+ *
+ * // Dimension checking (allows/disallows conversions)
+ * System.out.println(ELECTRON_VOLT.isCompatible(WATT.times(HOUR)));
+ *
+ * // Retrieval of the unit dimension (depends upon the current model).
+ * System.out.println(ELECTRON_VOLT.getDimension());
+ * }
+ * }
+ *
+ * > 6.2137119223733395
+ * > 6.2137119223733395
+ * > rad/s
+ * > true
+ * > [L]²·[M]/[T]²
+ * [/code]
+ *
+ * <h3>Unit Parameterization</h3>
+ *
+ * Units are parameterized (e.g. <Time extends {@link org.unitsofmeasure.Quantity Quantity}>) to
+ * enforce compile-time checks of units/measures consistency, for example:[code]
+ *
+ * Unit<Time> MINUTE = SECOND.times(60); // Ok.
+ * Unit<Time> MINUTE = METRE.times(60); // Compile error.
+ *
+ * Unit<Pressure> HECTOPASCAL = HECTO(PASCAL); // Ok.
+ * Unit<Pressure> HECTOPASCAL = HECTO(NEWTON); // Compile error.
+ *
+ * TimeAmount duration = new TimeAmount(2, MINUTE); // Ok.
+ * TimeAmount duration = new TimeAmount(2, CELSIUS); // Compile error.
+ *
+ * long milliseconds = duration.longValue(MILLI(SECOND)); // Ok.
+ * long milliseconds = duration.longValue(POUND); // Compile error.
+ * [/code]
+ *
+ * Runtime checks of dimension consistency can be done for more complex cases.
+ *
+ * [code]
+ * Unit<Area> SQUARE_FOOT = FOOT.times(FOOT).asType(Area.class); // Ok.
+ * Unit<Area> SQUARE_FOOT = FOOT.times(KELVIN).asType(Area.class); // Runtime error.
+ *
+ * Unit<Temperature> KELVIN = Unit.valueOf("K").asType(Temperature.class); // Ok.
+ * Unit<Temperature> KELVIN = Unit.valueOf("kg").asType(Temperature.class); // Runtime error.
+ * [/code]
+ * </p>
+ *
+ * @author <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
+ * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
+ * @version 0.5.1, $Date: 2010-08-10 07:04:41 +0100 (Di, 10 Aug 2010) $
+ */
+package org.eclipse.uomo.units;
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 18e7765..6e96c98 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
@@ -1,90 +1,90 @@
-#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
-#
-# 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, Ikayzo and others - initial API and implementation
-#
-
-# Imperial Units
-org.eclipse.uomo.units.impl.system.Imperial.GALLON_UK = gal_uk
-# SI Units
-org.eclipse.uomo.units.SI.AMPERE = A
-org.eclipse.uomo.units.SI.AMPERE_TURN = At
-org.eclipse.uomo.units.SI.BECQUEREL = Bq
-org.eclipse.uomo.units.SI.CANDELA = cd
-org.eclipse.uomo.units.SI.CELSIUS = \u00B0C
-org.eclipse.uomo.units.SI.CELSIUS.1 = \u2103
-org.eclipse.uomo.units.SI.CELSIUS.2 = Celsius
-org.eclipse.uomo.units.SI.COULOMB = C
-org.eclipse.uomo.units.SI.FARAD = F
-org.eclipse.uomo.units.SI.GRAM = g
-org.eclipse.uomo.units.SI.GRAY = Gy
-org.eclipse.uomo.units.SI.HENRY = H
-org.eclipse.uomo.units.SI.HERTZ = Hz
-org.eclipse.uomo.units.SI.HERTZ.2 = hertz
-org.eclipse.uomo.units.SI.JOULE = J
-org.eclipse.uomo.units.SI.KATAL = kat
-org.eclipse.uomo.units.SI.KELVIN = K
-org.eclipse.uomo.units.SI.KILOGRAM = kg
-org.eclipse.uomo.units.SI.KILOGRAM.1 = kilogram
-org.eclipse.uomo.units.SI.LUMEN = lm
-org.eclipse.uomo.units.SI.LUX = lx
-org.eclipse.uomo.units.SI.METRE = m
-org.eclipse.uomo.units.SI.MOLE = mol
-org.eclipse.uomo.units.SI.NEWTON = N
-org.eclipse.uomo.units.SI.OHM = \u03A9
-org.eclipse.uomo.units.SI.PASCAL = Pa
-org.eclipse.uomo.units.SI.RADIAN = rad
-org.eclipse.uomo.units.SI.ROENTGEN = R
-org.eclipse.uomo.units.SI.SECOND = s
-org.eclipse.uomo.units.SI.SIEMENS = S
-org.eclipse.uomo.units.SI.SIEVERT = Sv
-org.eclipse.uomo.units.SI.STERADIAN = sr
-org.eclipse.uomo.units.SI.TESLA = T
-org.eclipse.uomo.units.SI.VOLT = V
-org.eclipse.uomo.units.SI.WATT = W
-org.eclipse.uomo.units.SI.WEBER = Wb
-
-# US Units
-org.eclipse.uomo.units.impl.system.USCustomary.FAHRENHEIT = \u00B0F
-org.eclipse.uomo.units.impl.system.USCustomary.FAHRENHEIT.1 = \u2109
-org.eclipse.uomo.units.impl.system.USCustomary.FOOT = ft
-org.eclipse.uomo.units.impl.system.USCustomary.HORSEPOWER = hp
-org.eclipse.uomo.units.impl.system.USCustomary.GALLON_LIQUID = gal
-org.eclipse.uomo.units.impl.system.USCustomary.GALLON_DRY = gal_dry
-org.eclipse.uomo.units.impl.system.USCustomary.INCH = in
-org.eclipse.uomo.units.impl.system.USCustomary.KNOT = kn
-org.eclipse.uomo.units.impl.system.USCustomary.LITER = l
-org.eclipse.uomo.units.impl.system.USCustomary.MILE = mi
-org.eclipse.uomo.units.impl.system.USCustomary.MILES_PER_HOUR = mph
-org.eclipse.uomo.units.impl.system.USCustomary.POUND = lb
-# SI Prefixes
-org.eclipse.uomo.units.impl.format.ParsePrefix.ATTO = a
-org.eclipse.uomo.units.impl.format.ParsePrefix.CENTI = c
-org.eclipse.uomo.units.impl.format.ParsePrefix.DECI = d
-org.eclipse.uomo.units.impl.format.ParsePrefix.DEKA = da
-org.eclipse.uomo.units.impl.format.ParsePrefix.EXA = E
-org.eclipse.uomo.units.impl.format.ParsePrefix.FEMTO = f
-org.eclipse.uomo.units.impl.format.ParsePrefix.GIGA = G
-org.eclipse.uomo.units.impl.format.ParsePrefix.HECTO = h
-org.eclipse.uomo.units.impl.format.ParsePrefix.KILO = k
-org.eclipse.uomo.units.impl.format.ParsePrefix.MEGA = M
-org.eclipse.uomo.units.impl.format.ParsePrefix.MICRO = \u00B5
-org.eclipse.uomo.units.impl.format.ParsePrefix.MILLI = m
-org.eclipse.uomo.units.impl.format.ParsePrefix.NANO = n
-org.eclipse.uomo.units.impl.format.ParsePrefix.PETA = P
-org.eclipse.uomo.units.impl.format.ParsePrefix.PICO = p
-org.eclipse.uomo.units.impl.format.ParsePrefix.TERA = T
-org.eclipse.uomo.units.impl.format.ParsePrefix.YOCTO = y
-org.eclipse.uomo.units.impl.format.ParsePrefix.YOTTA = Y
-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
-
+#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
+#
+# 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, Ikayzo and others - initial API and implementation
+#
+
+# Imperial Units
+org.eclipse.uomo.units.impl.system.Imperial.GALLON_UK = gal_uk
+# SI Units
+org.eclipse.uomo.units.SI.AMPERE = A
+org.eclipse.uomo.units.SI.AMPERE_TURN = At
+org.eclipse.uomo.units.SI.BECQUEREL = Bq
+org.eclipse.uomo.units.SI.CANDELA = cd
+org.eclipse.uomo.units.SI.CELSIUS = \u00B0C
+org.eclipse.uomo.units.SI.CELSIUS.1 = \u2103
+org.eclipse.uomo.units.SI.CELSIUS.2 = Celsius
+org.eclipse.uomo.units.SI.COULOMB = C
+org.eclipse.uomo.units.SI.FARAD = F
+org.eclipse.uomo.units.SI.GRAM = g
+org.eclipse.uomo.units.SI.GRAY = Gy
+org.eclipse.uomo.units.SI.HENRY = H
+org.eclipse.uomo.units.SI.HERTZ = Hz
+org.eclipse.uomo.units.SI.HERTZ.2 = hertz
+org.eclipse.uomo.units.SI.JOULE = J
+org.eclipse.uomo.units.SI.KATAL = kat
+org.eclipse.uomo.units.SI.KELVIN = K
+org.eclipse.uomo.units.SI.KILOGRAM = kg
+org.eclipse.uomo.units.SI.KILOGRAM.1 = kilogram
+org.eclipse.uomo.units.SI.LUMEN = lm
+org.eclipse.uomo.units.SI.LUX = lx
+org.eclipse.uomo.units.SI.METRE = m
+org.eclipse.uomo.units.SI.MOLE = mol
+org.eclipse.uomo.units.SI.NEWTON = N
+org.eclipse.uomo.units.SI.OHM = \u03A9
+org.eclipse.uomo.units.SI.PASCAL = Pa
+org.eclipse.uomo.units.SI.RADIAN = rad
+org.eclipse.uomo.units.SI.ROENTGEN = R
+org.eclipse.uomo.units.SI.SECOND = s
+org.eclipse.uomo.units.SI.SIEMENS = S
+org.eclipse.uomo.units.SI.SIEVERT = Sv
+org.eclipse.uomo.units.SI.STERADIAN = sr
+org.eclipse.uomo.units.SI.TESLA = T
+org.eclipse.uomo.units.SI.VOLT = V
+org.eclipse.uomo.units.SI.WATT = W
+org.eclipse.uomo.units.SI.WEBER = Wb
+
+# US Units
+org.eclipse.uomo.units.impl.system.USCustomary.FAHRENHEIT = \u00B0F
+org.eclipse.uomo.units.impl.system.USCustomary.FAHRENHEIT.1 = \u2109
+org.eclipse.uomo.units.impl.system.USCustomary.FOOT = ft
+org.eclipse.uomo.units.impl.system.USCustomary.HORSEPOWER = hp
+org.eclipse.uomo.units.impl.system.USCustomary.GALLON_LIQUID = gal
+org.eclipse.uomo.units.impl.system.USCustomary.GALLON_DRY = gal_dry
+org.eclipse.uomo.units.impl.system.USCustomary.INCH = in
+org.eclipse.uomo.units.impl.system.USCustomary.KNOT = kn
+org.eclipse.uomo.units.impl.system.USCustomary.LITER = l
+org.eclipse.uomo.units.impl.system.USCustomary.MILE = mi
+org.eclipse.uomo.units.impl.system.USCustomary.MILES_PER_HOUR = mph
+org.eclipse.uomo.units.impl.system.USCustomary.POUND = lb
+# SI Prefixes
+org.eclipse.uomo.units.impl.format.ParsePrefix.ATTO = a
+org.eclipse.uomo.units.impl.format.ParsePrefix.CENTI = c
+org.eclipse.uomo.units.impl.format.ParsePrefix.DECI = d
+org.eclipse.uomo.units.impl.format.ParsePrefix.DEKA = da
+org.eclipse.uomo.units.impl.format.ParsePrefix.EXA = E
+org.eclipse.uomo.units.impl.format.ParsePrefix.FEMTO = f
+org.eclipse.uomo.units.impl.format.ParsePrefix.GIGA = G
+org.eclipse.uomo.units.impl.format.ParsePrefix.HECTO = h
+org.eclipse.uomo.units.impl.format.ParsePrefix.KILO = k
+org.eclipse.uomo.units.impl.format.ParsePrefix.MEGA = M
+org.eclipse.uomo.units.impl.format.ParsePrefix.MICRO = \u00B5
+org.eclipse.uomo.units.impl.format.ParsePrefix.MILLI = m
+org.eclipse.uomo.units.impl.format.ParsePrefix.NANO = n
+org.eclipse.uomo.units.impl.format.ParsePrefix.PETA = P
+org.eclipse.uomo.units.impl.format.ParsePrefix.PICO = p
+org.eclipse.uomo.units.impl.format.ParsePrefix.TERA = T
+org.eclipse.uomo.units.impl.format.ParsePrefix.YOCTO = y
+org.eclipse.uomo.units.impl.format.ParsePrefix.YOTTA = Y
+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/bundles/org.eclipse.uomo.units/src/main/resources/org/eclipse/uomo/units/impl/format/messages_en_GB.properties b/bundles/org.eclipse.uomo.units/src/main/resources/org/eclipse/uomo/units/impl/format/messages_en_GB.properties
index a9c2d0e..45c31eb 100644
--- a/bundles/org.eclipse.uomo.units/src/main/resources/org/eclipse/uomo/units/impl/format/messages_en_GB.properties
+++ b/bundles/org.eclipse.uomo.units/src/main/resources/org/eclipse/uomo/units/impl/format/messages_en_GB.properties
@@ -1,19 +1,19 @@
-#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
-# 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, Ikayzo and others - initial API and implementation
-#
-
-org.eclipse.uomo.units.impl.system.Imperial.GALLON_UK = gal
-org.eclipse.uomo.units.impl.system.Imperial.OUNCE_LIQUID = fl oz
-org.eclipse.uomo.units.impl.system.Imperial.TON_UK = ton
-org.eclipse.uomo.units.impl.system.USCustomary.FOOT_SURVEY = ft_survey_us
-org.eclipse.uomo.units.impl.system.USCustomary.GALLON_DRY = gallon_dry_us
-org.eclipse.uomo.units.impl.system.USCustomary.GALLON_LIQUID = gal_us
-org.eclipse.uomo.units.impl.system.USCustomary.OUNCE_LIQUID = fl oz US
-org.eclipse.uomo.units.impl.system.USCustomary.TON = ton_us
+#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
+# 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, Ikayzo and others - initial API and implementation
+#
+
+org.eclipse.uomo.units.impl.system.Imperial.GALLON_UK = gal
+org.eclipse.uomo.units.impl.system.Imperial.OUNCE_LIQUID = fl oz
+org.eclipse.uomo.units.impl.system.Imperial.TON_UK = ton
+org.eclipse.uomo.units.impl.system.USCustomary.FOOT_SURVEY = ft_survey_us
+org.eclipse.uomo.units.impl.system.USCustomary.GALLON_DRY = gallon_dry_us
+org.eclipse.uomo.units.impl.system.USCustomary.GALLON_LIQUID = gal_us
+org.eclipse.uomo.units.impl.system.USCustomary.OUNCE_LIQUID = fl oz US
+org.eclipse.uomo.units.impl.system.USCustomary.TON = ton_us
diff --git a/bundles/org.eclipse.uomo.units/src/main/resources/org/eclipse/uomo/units/impl/format/messages_en_US.properties b/bundles/org.eclipse.uomo.units/src/main/resources/org/eclipse/uomo/units/impl/format/messages_en_US.properties
index d1426d7..bf8349f 100644
--- a/bundles/org.eclipse.uomo.units/src/main/resources/org/eclipse/uomo/units/impl/format/messages_en_US.properties
+++ b/bundles/org.eclipse.uomo.units/src/main/resources/org/eclipse/uomo/units/impl/format/messages_en_US.properties
@@ -1,17 +1,17 @@
-#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
-#
-# 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, Ikayzo and others - initial API and implementation
-#
-
-org.eclipse.uomo.units.impl.system.USCustomary.ELECTRON_VOLT = eV
-org.eclipse.uomo.units.impl.system.USCustomary.GALLON_DRY = gallon_dry
-org.eclipse.uomo.units.impl.system.USCustomary.GALLON_LIQUID = gal
-org.eclipse.uomo.units.impl.system.USCustomary.OUNCE_LIQUID = fl oz
-org.eclipse.uomo.units.impl.system.USCustomary.TON = ton
+#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
+#
+# 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, Ikayzo and others - initial API and implementation
+#
+
+org.eclipse.uomo.units.impl.system.USCustomary.ELECTRON_VOLT = eV
+org.eclipse.uomo.units.impl.system.USCustomary.GALLON_DRY = gallon_dry
+org.eclipse.uomo.units.impl.system.USCustomary.GALLON_LIQUID = gal
+org.eclipse.uomo.units.impl.system.USCustomary.OUNCE_LIQUID = fl oz
+org.eclipse.uomo.units.impl.system.USCustomary.TON = ton
diff --git a/bundles/org.eclipse.uomo.units/src/main/resources/org/eclipse/uomo/units/impl/format/messages_fr.properties b/bundles/org.eclipse.uomo.units/src/main/resources/org/eclipse/uomo/units/impl/format/messages_fr.properties
index e25054a..4b79570 100644
--- a/bundles/org.eclipse.uomo.units/src/main/resources/org/eclipse/uomo/units/impl/format/messages_fr.properties
+++ b/bundles/org.eclipse.uomo.units/src/main/resources/org/eclipse/uomo/units/impl/format/messages_fr.properties
@@ -1,37 +1,37 @@
-#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
-#
-# 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, Ikayzo and others - initial API and implementation
-#
-# Contributors:
-# Werner Keil, Ikayzo and others - initial API and implementation
-#
-# See LICENSE.txt for full License
-#
-# See LICENSE.txt for full License
-#
-# See LICENSE.txt for full License
-#
-# See LICENSE.txt for full License
-#
-# See LICENSE.txt for full License
-#
-# See LICENSE.txt for full License
-#
-#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
-#
-# Copyright (c) 2005-2010, Jean-Marie Dautelle, Werner Keil
-# All rights reserved.
-#
-# See LICENSE.txt for the Specification License
-#
-# NOTE: as a Java properties file, this file must use the
-# ISO 8859-1 encoding, so all non-ASCII Unicode characters
-# must be escaped using the \uXXXX syntax.
-# See http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html#encoding
+#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
+#
+# 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, Ikayzo and others - initial API and implementation
+#
+# Contributors:
+# Werner Keil, Ikayzo and others - initial API and implementation
+#
+# See LICENSE.txt for full License
+#
+# See LICENSE.txt for full License
+#
+# See LICENSE.txt for full License
+#
+# See LICENSE.txt for full License
+#
+# See LICENSE.txt for full License
+#
+# See LICENSE.txt for full License
+#
+#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
+#
+# Copyright (c) 2005-2010, Jean-Marie Dautelle, Werner Keil
+# All rights reserved.
+#
+# See LICENSE.txt for the Specification License
+#
+# NOTE: as a Java properties file, this file must use the
+# ISO 8859-1 encoding, so all non-ASCII Unicode characters
+# must be escaped using the \uXXXX syntax.
+# See http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html#encoding
diff --git a/bundles/org.eclipse.uomo.util.tests/.classpath b/bundles/org.eclipse.uomo.util.tests/.classpath
index 9bc33d3..0b1bcf9 100644
--- a/bundles/org.eclipse.uomo.util.tests/.classpath
+++ b/bundles/org.eclipse.uomo.util.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.util.tests/src/org/eclipse/uomo/util/test/Iso8601DateUtilityTests.java b/bundles/org.eclipse.uomo.util.tests/src/org/eclipse/uomo/util/test/Iso8601DateUtilityTests.java
index 1bb8f3e..7568053 100644
--- a/bundles/org.eclipse.uomo.util.tests/src/org/eclipse/uomo/util/test/Iso8601DateUtilityTests.java
+++ b/bundles/org.eclipse.uomo.util.tests/src/org/eclipse/uomo/util/test/Iso8601DateUtilityTests.java
@@ -1,38 +1,38 @@
-/*******************************************************************************
- * 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.util.test;
-
-import junit.framework.TestCase;
-
-import org.eclipse.uomo.util.impl.Iso8601Date;
-import org.junit.Test;
-
-public class Iso8601DateUtilityTests extends TestCase {
-
- private Iso8601Date du;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- du = new Iso8601Date();
- }
-
- @Test
- public void testFullDate() {
- String st;
- st = du.parse("20071017111114.789", Iso8601Date.ISO_DATE_VALIDATION_FULL, Iso8601Date.OPTIONAL);
- assertTrue(st, st == null);
- st = du.parse("20061027000000.0020", Iso8601Date.ISO_DATE_VALIDATION_FULL, Iso8601Date.OPTIONAL);
- assertTrue(st, st == null);
- }
-
-}
+/*******************************************************************************
+ * 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.util.test;
+
+import junit.framework.TestCase;
+
+import org.eclipse.uomo.util.impl.Iso8601Date;
+import org.junit.Test;
+
+public class Iso8601DateUtilityTests extends TestCase {
+
+ private Iso8601Date du;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ du = new Iso8601Date();
+ }
+
+ @Test
+ public void testFullDate() {
+ String st;
+ st = du.parse("20071017111114.789", Iso8601Date.ISO_DATE_VALIDATION_FULL, Iso8601Date.OPTIONAL);
+ assertTrue(st, st == null);
+ st = du.parse("20061027000000.0020", Iso8601Date.ISO_DATE_VALIDATION_FULL, Iso8601Date.OPTIONAL);
+ assertTrue(st, st == null);
+ }
+
+}
diff --git a/bundles/org.eclipse.uomo.util.tests/src/org/eclipse/uomo/util/test/numbers/RomanNumberDemos.java b/bundles/org.eclipse.uomo.util.tests/src/org/eclipse/uomo/util/test/numbers/RomanNumberDemos.java
index 97bfa39..0e9bad8 100644
--- a/bundles/org.eclipse.uomo.util.tests/src/org/eclipse/uomo/util/test/numbers/RomanNumberDemos.java
+++ b/bundles/org.eclipse.uomo.util.tests/src/org/eclipse/uomo/util/test/numbers/RomanNumberDemos.java
@@ -1,32 +1,32 @@
-/**
- * Copyright (c) 1996, 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.util.test.numbers;
-
-import org.eclipse.uomo.util.numbers.ISpeller;
-import org.eclipse.uomo.util.numbers.impl.RomanNumberSpeller;
-
-public class RomanNumberDemos {
-
- public static void main(String args[]) throws Exception {
- System.out.println("Display massage number to Text!");
- final ISpeller num = RomanNumberSpeller.of();
- System.out.println("Spelling: " + num.spell(10) + ".");
- System.out.println("Spelling: " + num.spell(15) + ".");
- System.out.println("Spelling: " + num.spell(50) + ".");
- System.out.println("Spelling: " + num.spell(99) + ".");
- System.out.println("Spelling: " + num.spell(150) + ".");
- System.out.println("Spelling: " + num.spell(234) + ".");
- System.out.println("Spelling: " + num.spell(250) + ".");
- System.out.println("Spelling: " + num.spell(2500) + ".");
- System.out.println("Spelling: " + num.spell(3900) + ".");
- // System.out.println("Spelling: " + num.spell(4000) + ".");
- }
+/**
+ * Copyright (c) 1996, 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.util.test.numbers;
+
+import org.eclipse.uomo.util.numbers.ISpeller;
+import org.eclipse.uomo.util.numbers.impl.RomanNumberSpeller;
+
+public class RomanNumberDemos {
+
+ public static void main(String args[]) throws Exception {
+ System.out.println("Display massage number to Text!");
+ final ISpeller num = RomanNumberSpeller.of();
+ System.out.println("Spelling: " + num.spell(10) + ".");
+ System.out.println("Spelling: " + num.spell(15) + ".");
+ System.out.println("Spelling: " + num.spell(50) + ".");
+ System.out.println("Spelling: " + num.spell(99) + ".");
+ System.out.println("Spelling: " + num.spell(150) + ".");
+ System.out.println("Spelling: " + num.spell(234) + ".");
+ System.out.println("Spelling: " + num.spell(250) + ".");
+ System.out.println("Spelling: " + num.spell(2500) + ".");
+ System.out.println("Spelling: " + num.spell(3900) + ".");
+ // System.out.println("Spelling: " + num.spell(4000) + ".");
+ }
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.uomo.util/.classpath b/bundles/org.eclipse.uomo.util/.classpath
index c5e4a21..70ee3e9 100644
--- a/bundles/org.eclipse.uomo.util/.classpath
+++ b/bundles/org.eclipse.uomo.util/.classpath
@@ -1,8 +1,8 @@
-<?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="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 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.util/src/main/java/org/eclipse/uomo/util/Registry.java b/bundles/org.eclipse.uomo.util/src/main/java/org/eclipse/uomo/util/Registry.java
index 8f8a529..b505f26 100644
--- a/bundles/org.eclipse.uomo.util/src/main/java/org/eclipse/uomo/util/Registry.java
+++ b/bundles/org.eclipse.uomo.util/src/main/java/org/eclipse/uomo/util/Registry.java
@@ -1,22 +1,22 @@
-/**
- * Copyright (c) 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
- */
-package org.eclipse.uomo.util;
-
-/**
- * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
- *
- * @param <V> the type of mapped values
- */
-public interface Registry<V> {
- public boolean exists(String key);
-
- public V get(String key);
-}
+/**
+ * Copyright (c) 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
+ */
+package org.eclipse.uomo.util;
+
+/**
+ * @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
+ *
+ * @param <V> the type of mapped values
+ */
+public interface Registry<V> {
+ public boolean exists(String key);
+
+ public V get(String key);
+}
diff --git a/bundles/org.eclipse.uomo.util/src/main/java/org/eclipse/uomo/util/internal/ErrorMessages.java b/bundles/org.eclipse.uomo.util/src/main/java/org/eclipse/uomo/util/internal/ErrorMessages.java
index 7a4f8e9..d3d2cb1 100644
--- a/bundles/org.eclipse.uomo.util/src/main/java/org/eclipse/uomo/util/internal/ErrorMessages.java
+++ b/bundles/org.eclipse.uomo.util/src/main/java/org/eclipse/uomo/util/internal/ErrorMessages.java
@@ -1,29 +1,29 @@
-package org.eclipse.uomo.util.internal;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import org.eclipse.osgi.util.NLS;
-
-public class ErrorMessages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.uomo.util.errors"; //$NON-NLS-1$
- private static ResourceBundle RESOURCE_BUNDLE;
-
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, ErrorMessages.class);
- RESOURCE_BUNDLE = ResourceBundle
- .getBundle(BUNDLE_NAME);
- }
-
- public static String getString(String key) {
- try {
- return RESOURCE_BUNDLE.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- }
- }
-
- private ErrorMessages() {
- }
-}
+package org.eclipse.uomo.util.internal;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.eclipse.osgi.util.NLS;
+
+public class ErrorMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.uomo.util.errors"; //$NON-NLS-1$
+ private static ResourceBundle RESOURCE_BUNDLE;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, ErrorMessages.class);
+ RESOURCE_BUNDLE = ResourceBundle
+ .getBundle(BUNDLE_NAME);
+ }
+
+ public static String getString(String key) {
+ try {
+ return RESOURCE_BUNDLE.getString(key);
+ } catch (MissingResourceException e) {
+ return '!' + key + '!';
+ }
+ }
+
+ private ErrorMessages() {
+ }
+}
diff --git a/bundles/org.eclipse.uomo.util/src/main/java/org/eclipse/uomo/util/numbers/RealFormatOptions.java b/bundles/org.eclipse.uomo.util/src/main/java/org/eclipse/uomo/util/numbers/RealFormatOptions.java
index 04f1a7c..cd31ece 100644
--- a/bundles/org.eclipse.uomo.util/src/main/java/org/eclipse/uomo/util/numbers/RealFormatOptions.java
+++ b/bundles/org.eclipse.uomo.util/src/main/java/org/eclipse/uomo/util/numbers/RealFormatOptions.java
@@ -1,71 +1,71 @@
-/**
- * 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:
- * Grahame Grieve - initial API and implementation
- */
-package org.eclipse.uomo.util.numbers;
-
-final class RealFormatOptions extends DecimalFormatOptions {
-
- /**
- * null - exponent form is allowed
- * false - exponent form is not allowed
- * true - exponent form is required
- *
- * FIXME change this to a more descriptive enum
- */
- private Boolean exponent;
- private boolean allowSpecial;
-
- /**
- * @param exponent
- * @param totalDigits
- * @param fractionDigits
- */
- public RealFormatOptions(Boolean exponent, boolean allowSpecial, int totalDigits, int fractionDigits) {
- super();
- this.exponent = exponent;
- this.totalDigits = totalDigits;
- this.fractionDigits = fractionDigits;
- this.allowSpecial = allowSpecial;
- }
-
- /**
- * @return the exponent
- */
- public Boolean getExponent() {
- return exponent;
- }
-
- /**
- * @param exponent the exponent to set
- */
- public void setExponent(Boolean exponent) {
- this.exponent = exponent;
- }
-
- /**
- * @return the allowSpecial
- */
- public boolean isAllowSpecial() {
- return allowSpecial;
- }
-
- /**
- * @param allowSpecial the allowSpecial to set
- */
- public void setAllowSpecial(boolean allowSpecial) {
- this.allowSpecial = allowSpecial;
- }
-
- public static RealFormatOptions allowComplex() {
- return new RealFormatOptions(null, true, ANY_DIGITS, ANY_DIGITS);
- }
-
-
+/**
+ * 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:
+ * Grahame Grieve - initial API and implementation
+ */
+package org.eclipse.uomo.util.numbers;
+
+final class RealFormatOptions extends DecimalFormatOptions {
+
+ /**
+ * null - exponent form is allowed
+ * false - exponent form is not allowed
+ * true - exponent form is required
+ *
+ * FIXME change this to a more descriptive enum
+ */
+ private Boolean exponent;
+ private boolean allowSpecial;
+
+ /**
+ * @param exponent
+ * @param totalDigits
+ * @param fractionDigits
+ */
+ public RealFormatOptions(Boolean exponent, boolean allowSpecial, int totalDigits, int fractionDigits) {
+ super();
+ this.exponent = exponent;
+ this.totalDigits = totalDigits;
+ this.fractionDigits = fractionDigits;
+ this.allowSpecial = allowSpecial;
+ }
+
+ /**
+ * @return the exponent
+ */
+ public Boolean getExponent() {
+ return exponent;
+ }
+
+ /**
+ * @param exponent the exponent to set
+ */
+ public void setExponent(Boolean exponent) {
+ this.exponent = exponent;
+ }
+
+ /**
+ * @return the allowSpecial
+ */
+ public boolean isAllowSpecial() {
+ return allowSpecial;
+ }
+
+ /**
+ * @param allowSpecial the allowSpecial to set
+ */
+ public void setAllowSpecial(boolean allowSpecial) {
+ this.allowSpecial = allowSpecial;
+ }
+
+ public static RealFormatOptions allowComplex() {
+ return new RealFormatOptions(null, true, ANY_DIGITS, ANY_DIGITS);
+ }
+
+
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.uomo.xml.tests/.classpath b/bundles/org.eclipse.uomo.xml.tests/.classpath
index 9bc33d3..0b1bcf9 100644
--- a/bundles/org.eclipse.uomo.xml.tests/.classpath
+++ b/bundles/org.eclipse.uomo.xml.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.xml/.classpath b/bundles/org.eclipse.uomo.xml/.classpath
index 17054ca..5aff1fe 100644
--- a/bundles/org.eclipse.uomo.xml/.classpath
+++ b/bundles/org.eclipse.uomo.xml/.classpath
@@ -1,10 +1,10 @@
-<?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/xmlpull_1_1_3_4b.jar"/>
- <classpathentry exported="true" kind="lib" path="libs/xpp3_min-1.1.3.4.O.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/xmlpull_1_1_3_4b.jar"/>
+ <classpathentry exported="true" kind="lib" path="libs/xpp3_min-1.1.3.4.O.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.xml/.springBeans b/bundles/org.eclipse.uomo.xml/.springBeans
index ef666ef..6c6cb5a 100644
--- a/bundles/org.eclipse.uomo.xml/.springBeans
+++ b/bundles/org.eclipse.uomo.xml/.springBeans
@@ -1,13 +1,13 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beansProjectDescription>
- <version>1</version>
- <pluginVersion><![CDATA[2.5.0.201010221000-RELEASE]]></pluginVersion>
- <configSuffixes>
- <configSuffix><![CDATA[xml]]></configSuffix>
- </configSuffixes>
- <enableImports><![CDATA[false]]></enableImports>
- <configs>
- </configs>
- <configSets>
- </configSets>
-</beansProjectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<beansProjectDescription>
+ <version>1</version>
+ <pluginVersion><![CDATA[2.5.0.201010221000-RELEASE]]></pluginVersion>
+ <configSuffixes>
+ <configSuffix><![CDATA[xml]]></configSuffix>
+ </configSuffixes>
+ <enableImports><![CDATA[false]]></enableImports>
+ <configs>
+ </configs>
+ <configSets>
+ </configSets>
+</beansProjectDescription>
diff --git a/bundles/org.eclipse.uomo.xml/src/main/java/org/eclipse/uomo/xml/XMLMessages.java b/bundles/org.eclipse.uomo.xml/src/main/java/org/eclipse/uomo/xml/XMLMessages.java
index c860fc5..c58f2fd 100644
--- a/bundles/org.eclipse.uomo.xml/src/main/java/org/eclipse/uomo/xml/XMLMessages.java
+++ b/bundles/org.eclipse.uomo.xml/src/main/java/org/eclipse/uomo/xml/XMLMessages.java
@@ -1,15 +1,15 @@
-package org.eclipse.uomo.xml;
-
-import org.eclipse.osgi.util.NLS;
-
-public final class XMLMessages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.uomo.xml.messages"; //$NON-NLS-1$
- public static String XMLObjectParsers_stackUnderflow;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, XMLMessages.class);
- }
-
- private XMLMessages() {
- }
-}
+package org.eclipse.uomo.xml;
+
+import org.eclipse.osgi.util.NLS;
+
+public final class XMLMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.uomo.xml.messages"; //$NON-NLS-1$
+ public static String XMLObjectParsers_stackUnderflow;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, XMLMessages.class);
+ }
+
+ private XMLMessages() {
+ }
+}
diff --git a/bundles/org.eclipse.uomo.xml/src/main/java/org/eclipse/uomo/xml/impl/DOMXMLWriter.java b/bundles/org.eclipse.uomo.xml/src/main/java/org/eclipse/uomo/xml/impl/DOMXMLWriter.java
index d89ef4f..c01bec4 100644
--- a/bundles/org.eclipse.uomo.xml/src/main/java/org/eclipse/uomo/xml/impl/DOMXMLWriter.java
+++ b/bundles/org.eclipse.uomo.xml/src/main/java/org/eclipse/uomo/xml/impl/DOMXMLWriter.java
@@ -1,527 +1,527 @@
-/*******************************************************************************
- * Crown Copyright (c) 2009, 2009, Copyright (c) 2009, 2009 Kestral Computing.
- * 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 - initial API and implementation
- *******************************************************************************/
-package org.eclipse.uomo.xml.impl;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Stack;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.eclipse.uomo.xml.DOMUtil;
-import org.eclipse.uomo.xml.IXMLWriter;
-import org.eclipse.uomo.xml.XMLUtil;
-import org.w3c.dom.Comment;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentFragment;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * A DOM-base XML writer
- *
- * @author dennisn
- *
- */
-public class DOMXMLWriter implements IXMLWriter {
-
- /**
- * The internal document
- */
- private Document doc = null;
-
- private boolean isPretty = true;
-
- // the current stack of element
- private Stack<Node> current = new Stack<Node>();
-
- // defined attributes for the new coming element
- private Map attributes = new HashMap();
-
- // the defined namespace for the new coming element
- private Map definedNS = new HashMap();
-
- private DocumentFragment commentBlock = null;
-
- public DOMXMLWriter() throws ParserConfigurationException {
- DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
- builderFactory.setNamespaceAware(true);
- DocumentBuilder docBuilder = builderFactory.newDocumentBuilder();
- doc = docBuilder.newDocument();
- }
-
- public DOMXMLWriter(Document doc) {
- this.doc = doc;
- }
-
- /**
- * @return the internal document
- * NOTE: be careful when changing the internal document, as it may
- * cause error for the writer
- */
- public Document getDOMDocument() {
- return doc;
- }
-
- public Element getCurrentElement() {
- return (Element) current.peek();
- }
-
- protected boolean condition(boolean bTest, String message) throws IOException {
- if (!bTest)
- throw new IOException(message);
- return bTest;
- }
-
- private void addAttribute(String name, String value) throws IOException {
- addAttribute(name, value, false);
- }
-
- private void addAttribute(String name, String value, boolean isNoLines) throws IOException {
- if (!XMLUtil.isNMToken(name))
- throw new IOException("XML name "+name+" is not valid");
-
- condition(!attributes.containsKey(name), "attempt to define attribute with name "+name+" more than once");
- attributes.put(name, XMLUtil.escapeXML(value, null, isNoLines));
- }
-
- private void defineNamespace(String namespace, String prefix) {
- if (namespace != null) {
- if (prefix == null)
- prefix = "";
-
- definedNS.put(prefix, namespace);
- }
- }
-
- private String getPrefixForNamespace(String namespace) throws IOException {
- if ("http://www.w3.org/XML/1998/namespace".equals(namespace))
- return "xml:";
-
- String prefix = null;
- if (definedNS.containsValue(namespace)) {
- Iterator iter = definedNS.keySet().iterator();
- while (prefix == null && iter.hasNext()) {
- Object k = iter.next();
- if (definedNS.get(k).equals(namespace))
- prefix = k.toString();
- }
- }
- else if (current.size() > 0)
- prefix = DOMUtil.lookupPrefixForNamespace((Element) current.peek(), namespace);
-
- if (prefix == null)
- throw new IOException("Namespace "+namespace+" is not defined");
- return prefix + ":";
- }
-
- private String getNamespaceForPrefix(String prefix) throws IOException {
- if ("xml".equals(prefix))
- return "http://www.w3.org/XML/1998/namespace";
-
- String result = null;
- if (definedNS.containsKey(prefix))
- result = definedNS.get(prefix).toString();
- else if (current.size() > 0)
- prefix = DOMUtil.lookupNamespaceForPrefix((Element) current.peek(), prefix);
- return result == null ? "" : result;
- }
-
- private void checkInElement() throws IOException {
- condition(current != null && current.size() > 0, "Not in an element");
- }
-
- // IXMLWriter methods
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#abbreviationDefined(java.lang.String)
- */
- public boolean abbreviationDefined(String abbreviation) {
- return definedNS.containsKey(abbreviation)
- || (current.size() > 0 && DOMUtil.lookupNamespaceForPrefix(getCurrentElement(), abbreviation) != null);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#attribute(java.lang.String, java.lang.String, java.lang.String, boolean)
- */
- public void attribute(String namespace, String name, String value, boolean onlyIfNotEmpty) throws IOException {
- if (!onlyIfNotEmpty || value != null && !value.equals(""))
- attribute(namespace, name, value);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#attribute(java.lang.String, java.lang.String, java.lang.String)
- */
- public void attribute(String namespace, String name, String value) throws IOException {
- if (namespace == null || namespace.equals(""))
- addAttribute(name, value);
- else
- addAttribute(getPrefixForNamespace(namespace)+name, value);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#attribute(java.lang.String, java.lang.String, boolean)
- */
- public void attribute(String name, String value, boolean onlyIfNotEmpty) throws IOException {
- if (!onlyIfNotEmpty || value != null && !value.equals(""))
- attribute(name, value);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#attribute(java.lang.String, java.lang.String)
- */
- public void attribute(String name, String value) throws IOException {
- addAttribute(name, value);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#attributeNoLines(java.lang.String, java.lang.String)
- */
- public void attributeNoLines(String name, String value) throws IOException {
- addAttribute(name, value, true);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#cData(java.lang.String)
- */
- public void cData(String text) throws IOException {
- checkInElement();
- getCurrentElement().appendChild(doc.createCDATASection(text));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#close(java.lang.String)
- */
- public void close(String name) throws IOException {
- if (current.size() == 0)
- throw new IOException("Unable to close null|"+name+", nothing to close");
- if (!getCurrentElement().getNodeName().equals(name))
- throw new IOException("Unable to close null|"+name+", found "+getCurrentElement().getNodeName());
- close();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#close(java.lang.String, java.lang.String)
- */
- public void close(String namespace, String name) throws IOException {
- if (current.size() == 0)
- throw new IOException("Unable to close null|"+name+", nothing to close");
- // assume current is DOM level 3
- Element ele = getCurrentElement();
- if (!namespace.equals(ele.getNamespaceURI()) || !name.equals(ele.getLocalName()))
- throw new IOException("Unable to close "+namespace+"|"+name+", found "+ele.getNamespaceURI() +"|"+ele.getLocalName());
- close();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#close()
- */
- public void close() throws IOException {
- checkInElement();
- current.pop();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#closeToLevel(int)
- */
- public void closeToLevel(int count) throws IOException {
- while (current.size() > count)
- close();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#comment(java.lang.String, boolean)
- */
- public void comment(String comment, boolean doPretty) throws IOException {
- Comment c = doc.createComment(comment);
- getCurrentElement().appendChild(c);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#element(java.lang.String, java.lang.String, java.lang.String, boolean)
- */
- public void element(String namespace, String name, String content, boolean onlyIfNotEmpty) throws IOException {
- if (!onlyIfNotEmpty || content != null && !content.equals(""))
- element(namespace, name, content);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#element(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
- */
- public void element(String namespace, String name, String content, String comment) throws IOException {
- if (!XMLUtil.isNMToken(name))
- throw new IOException("XML name "+name+" is not valid");
- open(namespace, name, comment);
- text(content);
- close();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#element(java.lang.String, java.lang.String, java.lang.String)
- */
- public void element(String namespace, String name, String content) throws IOException {
- if (!XMLUtil.isNMToken(name))
- throw new IOException("XML name "+name+" is not valid");
- open(namespace, name);
- text(content);
- close();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#element(java.lang.String, java.lang.String, boolean)
- */
- public void element(String name, String content, boolean onlyIfNotEmpty) throws IOException {
- if (!onlyIfNotEmpty || content != null && !content.equals(""))
- element(null, name, content);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#element(java.lang.String, java.lang.String)
- */
- public void element(String name, String content) throws IOException {
- element(null, name, content);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#endCommentBlock()
- */
- public void endCommentBlock() throws IOException {
- if (commentBlock == null)
- throw new IOException("Cannot close a comment block when none existed");
- else if (getCurrentElement().getParentNode() != commentBlock)
- throw new IOException("Cannot close a comment block when it's still opened");
-
- ByteArrayOutputStream temp = new ByteArrayOutputStream();
- try {
- // re-create the comment nodes
- NodeList children = getCurrentElement().getChildNodes();
- DocumentFragment frag = doc.createDocumentFragment();
- for (int i = 0; i < children.getLength(); i++)
- frag.appendChild(children.item(i));
-
- // init DOM->String transformer
- Transformer trans = TransformerFactory.newInstance().newTransformer();
- trans.setOutputProperty(OutputKeys.STANDALONE, "no");
- trans.setOutputProperty(OutputKeys.INDENT, "yes");
- trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
-
- // convert from DOM to string comment
-
- trans.transform(new DOMSource(frag), new StreamResult(temp));
- }
- catch (Exception e) {
- throw new IOException(e.getLocalizedMessage());
- }
- finally {
- current.pop();
- commentBlock = null;
- }
- comment(temp.toString(), true);
- }
-
-// /* (non-Javadoc)
-// * @see org.eclipse.ohf.utilities.xml.IXMLWriter#escapedText(java.lang.String)
-// */
-// public void escapedText(String content) throws IOException {
-// checkInElement();
-// text(content);
-// }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#getDefaultNamespace()
- */
- public String getDefaultNamespace() {
- String result = null;
- if (definedNS.size() > 0) {
- try {
- result = getNamespaceForPrefix("");
- } catch (IOException e) {
- // do nothing
- }
- }
-
- if (result == null && current.size() > 0)
- result = DOMUtil.lookupNamespaceForPrefix(getCurrentElement(), "");
-
- return result == null ? "": result;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#isPretty()
- */
- public boolean isPretty() throws IOException {
- return isPretty;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#namespace(java.lang.String)
- */
- public void namespace(String namespace) throws IOException {
- if (!namespaceDefined(namespace)) {
- int index = 0;
- while (abbreviationDefined("ns"+Integer.toString(index)))
- index++;
- defineNamespace(namespace, "ns"+Integer.toString(index));
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#namespace(java.lang.String, java.lang.String)
- */
- public void namespace(String namespace, String prefix) throws IOException {
- String ns = getNamespaceForPrefix(prefix);
- if (ns == null || !ns.equals(namespace))
- defineNamespace(namespace, prefix);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#namespaceDefined(java.lang.String)
- */
- public boolean namespaceDefined(String namespace) {
- try {
- return getPrefixForNamespace(namespace) != null;
- } catch (IOException e) {
- return false;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#open(java.lang.String, java.lang.String)
- */
- public void open(String namespace, String name) throws IOException {
- open(namespace, name, null);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#open(java.lang.String, java.lang.String, java.lang.String)
- */
- public void open(String namespace, String name, String comment) throws IOException {
- if (!XMLUtil.isNMToken(name))
- throw new IOException("XML name "+name+" is not valid");
- if (name == null)
- throw new IOException("XML name is null");
-
- Element ele;
- if (namespace != null) {
- name = getPrefixForNamespace(namespace) + name;
- ele = doc.createElementNS(namespace, name);
- }
- else if (getDefaultNamespace().length() > 0)
- ele = doc.createElementNS(getDefaultNamespace(), name);
- else
- ele = doc.createElement(name);
- defineAttributes(ele);
- defineNamespaces(ele);
- if (current.size() == 0)
- doc.appendChild(ele);
- else
- getCurrentElement().appendChild(ele);
- current.push(ele);
- if (comment != null) comment(comment, true);
- }
-
- private void defineNamespaces(Element ele) {
- Iterator<?> iter = definedNS.keySet().iterator();
- while (iter.hasNext()) {
- Object k = iter.next();
- ele.setAttribute("xmlns:" + k.toString(), definedNS.get(k).toString());
- }
- definedNS.clear();
- }
-
- private void defineAttributes(Element ele) {
- Iterator<?> iter = attributes.keySet().iterator();
- while (iter.hasNext()) {
- Object k = iter.next();
- ele.setAttribute(k.toString(), attributes.get(k).toString());
- }
- attributes.clear();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#open(java.lang.String)
- */
- public void open(String name) throws IOException {
- open(null, name);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#setDefaultNamespace(java.lang.String)
- */
- public void setDefaultNamespace(String namespace) throws IOException {
- if ((namespace == null && getDefaultNamespace() != null) ||
- (namespace != null && !namespace.equals(getDefaultNamespace())))
- defineNamespace(namespace, "");
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#setPretty(boolean)
- */
- public void setPretty(boolean pretty) throws IOException {
- this.isPretty = pretty;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#start()
- */
- public void start() throws IOException {
- // dont need to do anything
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#startCommentBlock()
- */
- public void startCommentBlock() throws IOException {
- if (commentBlock != null)
- throw new IOException("Cannot nest comments");
- /* we start a comment block by create a document fragment with 1 element root: commentRoot
- * Further node will be add to be children of this element root.
- */
- commentBlock = doc.createDocumentFragment();
- Node node = doc.createElement("commentRoot");
- commentBlock.appendChild(node);
- current.push(node);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#text(java.lang.String)
- */
- public void text(String content) throws IOException {
- text(content, false);
- }
-
- public void text(String content, boolean dontEscape) throws IOException {
- if (!dontEscape)
- content = XMLUtil.escapeXML(content, null, false);
- checkInElement();
- Node node = doc.createTextNode(content);
- getCurrentElement().appendChild(node);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#writeBytes(byte[])
- */
- public void writeBytes(byte[] bytes) throws IOException {
- text(new String(bytes));
- }
-
-}
+/*******************************************************************************
+ * Crown Copyright (c) 2009, 2009, Copyright (c) 2009, 2009 Kestral Computing.
+ * 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 - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.uomo.xml.impl;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Stack;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.eclipse.uomo.xml.DOMUtil;
+import org.eclipse.uomo.xml.IXMLWriter;
+import org.eclipse.uomo.xml.XMLUtil;
+import org.w3c.dom.Comment;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * A DOM-base XML writer
+ *
+ * @author dennisn
+ *
+ */
+public class DOMXMLWriter implements IXMLWriter {
+
+ /**
+ * The internal document
+ */
+ private Document doc = null;
+
+ private boolean isPretty = true;
+
+ // the current stack of element
+ private Stack<Node> current = new Stack<Node>();
+
+ // defined attributes for the new coming element
+ private Map attributes = new HashMap();
+
+ // the defined namespace for the new coming element
+ private Map definedNS = new HashMap();
+
+ private DocumentFragment commentBlock = null;
+
+ public DOMXMLWriter() throws ParserConfigurationException {
+ DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
+ builderFactory.setNamespaceAware(true);
+ DocumentBuilder docBuilder = builderFactory.newDocumentBuilder();
+ doc = docBuilder.newDocument();
+ }
+
+ public DOMXMLWriter(Document doc) {
+ this.doc = doc;
+ }
+
+ /**
+ * @return the internal document
+ * NOTE: be careful when changing the internal document, as it may
+ * cause error for the writer
+ */
+ public Document getDOMDocument() {
+ return doc;
+ }
+
+ public Element getCurrentElement() {
+ return (Element) current.peek();
+ }
+
+ protected boolean condition(boolean bTest, String message) throws IOException {
+ if (!bTest)
+ throw new IOException(message);
+ return bTest;
+ }
+
+ private void addAttribute(String name, String value) throws IOException {
+ addAttribute(name, value, false);
+ }
+
+ private void addAttribute(String name, String value, boolean isNoLines) throws IOException {
+ if (!XMLUtil.isNMToken(name))
+ throw new IOException("XML name "+name+" is not valid");
+
+ condition(!attributes.containsKey(name), "attempt to define attribute with name "+name+" more than once");
+ attributes.put(name, XMLUtil.escapeXML(value, null, isNoLines));
+ }
+
+ private void defineNamespace(String namespace, String prefix) {
+ if (namespace != null) {
+ if (prefix == null)
+ prefix = "";
+
+ definedNS.put(prefix, namespace);
+ }
+ }
+
+ private String getPrefixForNamespace(String namespace) throws IOException {
+ if ("http://www.w3.org/XML/1998/namespace".equals(namespace))
+ return "xml:";
+
+ String prefix = null;
+ if (definedNS.containsValue(namespace)) {
+ Iterator iter = definedNS.keySet().iterator();
+ while (prefix == null && iter.hasNext()) {
+ Object k = iter.next();
+ if (definedNS.get(k).equals(namespace))
+ prefix = k.toString();
+ }
+ }
+ else if (current.size() > 0)
+ prefix = DOMUtil.lookupPrefixForNamespace((Element) current.peek(), namespace);
+
+ if (prefix == null)
+ throw new IOException("Namespace "+namespace+" is not defined");
+ return prefix + ":";
+ }
+
+ private String getNamespaceForPrefix(String prefix) throws IOException {
+ if ("xml".equals(prefix))
+ return "http://www.w3.org/XML/1998/namespace";
+
+ String result = null;
+ if (definedNS.containsKey(prefix))
+ result = definedNS.get(prefix).toString();
+ else if (current.size() > 0)
+ prefix = DOMUtil.lookupNamespaceForPrefix((Element) current.peek(), prefix);
+ return result == null ? "" : result;
+ }
+
+ private void checkInElement() throws IOException {
+ condition(current != null && current.size() > 0, "Not in an element");
+ }
+
+ // IXMLWriter methods
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#abbreviationDefined(java.lang.String)
+ */
+ public boolean abbreviationDefined(String abbreviation) {
+ return definedNS.containsKey(abbreviation)
+ || (current.size() > 0 && DOMUtil.lookupNamespaceForPrefix(getCurrentElement(), abbreviation) != null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#attribute(java.lang.String, java.lang.String, java.lang.String, boolean)
+ */
+ public void attribute(String namespace, String name, String value, boolean onlyIfNotEmpty) throws IOException {
+ if (!onlyIfNotEmpty || value != null && !value.equals(""))
+ attribute(namespace, name, value);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#attribute(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void attribute(String namespace, String name, String value) throws IOException {
+ if (namespace == null || namespace.equals(""))
+ addAttribute(name, value);
+ else
+ addAttribute(getPrefixForNamespace(namespace)+name, value);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#attribute(java.lang.String, java.lang.String, boolean)
+ */
+ public void attribute(String name, String value, boolean onlyIfNotEmpty) throws IOException {
+ if (!onlyIfNotEmpty || value != null && !value.equals(""))
+ attribute(name, value);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#attribute(java.lang.String, java.lang.String)
+ */
+ public void attribute(String name, String value) throws IOException {
+ addAttribute(name, value);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#attributeNoLines(java.lang.String, java.lang.String)
+ */
+ public void attributeNoLines(String name, String value) throws IOException {
+ addAttribute(name, value, true);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#cData(java.lang.String)
+ */
+ public void cData(String text) throws IOException {
+ checkInElement();
+ getCurrentElement().appendChild(doc.createCDATASection(text));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#close(java.lang.String)
+ */
+ public void close(String name) throws IOException {
+ if (current.size() == 0)
+ throw new IOException("Unable to close null|"+name+", nothing to close");
+ if (!getCurrentElement().getNodeName().equals(name))
+ throw new IOException("Unable to close null|"+name+", found "+getCurrentElement().getNodeName());
+ close();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#close(java.lang.String, java.lang.String)
+ */
+ public void close(String namespace, String name) throws IOException {
+ if (current.size() == 0)
+ throw new IOException("Unable to close null|"+name+", nothing to close");
+ // assume current is DOM level 3
+ Element ele = getCurrentElement();
+ if (!namespace.equals(ele.getNamespaceURI()) || !name.equals(ele.getLocalName()))
+ throw new IOException("Unable to close "+namespace+"|"+name+", found "+ele.getNamespaceURI() +"|"+ele.getLocalName());
+ close();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#close()
+ */
+ public void close() throws IOException {
+ checkInElement();
+ current.pop();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#closeToLevel(int)
+ */
+ public void closeToLevel(int count) throws IOException {
+ while (current.size() > count)
+ close();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#comment(java.lang.String, boolean)
+ */
+ public void comment(String comment, boolean doPretty) throws IOException {
+ Comment c = doc.createComment(comment);
+ getCurrentElement().appendChild(c);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#element(java.lang.String, java.lang.String, java.lang.String, boolean)
+ */
+ public void element(String namespace, String name, String content, boolean onlyIfNotEmpty) throws IOException {
+ if (!onlyIfNotEmpty || content != null && !content.equals(""))
+ element(namespace, name, content);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#element(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void element(String namespace, String name, String content, String comment) throws IOException {
+ if (!XMLUtil.isNMToken(name))
+ throw new IOException("XML name "+name+" is not valid");
+ open(namespace, name, comment);
+ text(content);
+ close();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#element(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void element(String namespace, String name, String content) throws IOException {
+ if (!XMLUtil.isNMToken(name))
+ throw new IOException("XML name "+name+" is not valid");
+ open(namespace, name);
+ text(content);
+ close();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#element(java.lang.String, java.lang.String, boolean)
+ */
+ public void element(String name, String content, boolean onlyIfNotEmpty) throws IOException {
+ if (!onlyIfNotEmpty || content != null && !content.equals(""))
+ element(null, name, content);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#element(java.lang.String, java.lang.String)
+ */
+ public void element(String name, String content) throws IOException {
+ element(null, name, content);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#endCommentBlock()
+ */
+ public void endCommentBlock() throws IOException {
+ if (commentBlock == null)
+ throw new IOException("Cannot close a comment block when none existed");
+ else if (getCurrentElement().getParentNode() != commentBlock)
+ throw new IOException("Cannot close a comment block when it's still opened");
+
+ ByteArrayOutputStream temp = new ByteArrayOutputStream();
+ try {
+ // re-create the comment nodes
+ NodeList children = getCurrentElement().getChildNodes();
+ DocumentFragment frag = doc.createDocumentFragment();
+ for (int i = 0; i < children.getLength(); i++)
+ frag.appendChild(children.item(i));
+
+ // init DOM->String transformer
+ Transformer trans = TransformerFactory.newInstance().newTransformer();
+ trans.setOutputProperty(OutputKeys.STANDALONE, "no");
+ trans.setOutputProperty(OutputKeys.INDENT, "yes");
+ trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+
+ // convert from DOM to string comment
+
+ trans.transform(new DOMSource(frag), new StreamResult(temp));
+ }
+ catch (Exception e) {
+ throw new IOException(e.getLocalizedMessage());
+ }
+ finally {
+ current.pop();
+ commentBlock = null;
+ }
+ comment(temp.toString(), true);
+ }
+
+// /* (non-Javadoc)
+// * @see org.eclipse.ohf.utilities.xml.IXMLWriter#escapedText(java.lang.String)
+// */
+// public void escapedText(String content) throws IOException {
+// checkInElement();
+// text(content);
+// }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#getDefaultNamespace()
+ */
+ public String getDefaultNamespace() {
+ String result = null;
+ if (definedNS.size() > 0) {
+ try {
+ result = getNamespaceForPrefix("");
+ } catch (IOException e) {
+ // do nothing
+ }
+ }
+
+ if (result == null && current.size() > 0)
+ result = DOMUtil.lookupNamespaceForPrefix(getCurrentElement(), "");
+
+ return result == null ? "": result;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#isPretty()
+ */
+ public boolean isPretty() throws IOException {
+ return isPretty;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#namespace(java.lang.String)
+ */
+ public void namespace(String namespace) throws IOException {
+ if (!namespaceDefined(namespace)) {
+ int index = 0;
+ while (abbreviationDefined("ns"+Integer.toString(index)))
+ index++;
+ defineNamespace(namespace, "ns"+Integer.toString(index));
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#namespace(java.lang.String, java.lang.String)
+ */
+ public void namespace(String namespace, String prefix) throws IOException {
+ String ns = getNamespaceForPrefix(prefix);
+ if (ns == null || !ns.equals(namespace))
+ defineNamespace(namespace, prefix);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#namespaceDefined(java.lang.String)
+ */
+ public boolean namespaceDefined(String namespace) {
+ try {
+ return getPrefixForNamespace(namespace) != null;
+ } catch (IOException e) {
+ return false;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#open(java.lang.String, java.lang.String)
+ */
+ public void open(String namespace, String name) throws IOException {
+ open(namespace, name, null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#open(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void open(String namespace, String name, String comment) throws IOException {
+ if (!XMLUtil.isNMToken(name))
+ throw new IOException("XML name "+name+" is not valid");
+ if (name == null)
+ throw new IOException("XML name is null");
+
+ Element ele;
+ if (namespace != null) {
+ name = getPrefixForNamespace(namespace) + name;
+ ele = doc.createElementNS(namespace, name);
+ }
+ else if (getDefaultNamespace().length() > 0)
+ ele = doc.createElementNS(getDefaultNamespace(), name);
+ else
+ ele = doc.createElement(name);
+ defineAttributes(ele);
+ defineNamespaces(ele);
+ if (current.size() == 0)
+ doc.appendChild(ele);
+ else
+ getCurrentElement().appendChild(ele);
+ current.push(ele);
+ if (comment != null) comment(comment, true);
+ }
+
+ private void defineNamespaces(Element ele) {
+ Iterator<?> iter = definedNS.keySet().iterator();
+ while (iter.hasNext()) {
+ Object k = iter.next();
+ ele.setAttribute("xmlns:" + k.toString(), definedNS.get(k).toString());
+ }
+ definedNS.clear();
+ }
+
+ private void defineAttributes(Element ele) {
+ Iterator<?> iter = attributes.keySet().iterator();
+ while (iter.hasNext()) {
+ Object k = iter.next();
+ ele.setAttribute(k.toString(), attributes.get(k).toString());
+ }
+ attributes.clear();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#open(java.lang.String)
+ */
+ public void open(String name) throws IOException {
+ open(null, name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#setDefaultNamespace(java.lang.String)
+ */
+ public void setDefaultNamespace(String namespace) throws IOException {
+ if ((namespace == null && getDefaultNamespace() != null) ||
+ (namespace != null && !namespace.equals(getDefaultNamespace())))
+ defineNamespace(namespace, "");
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#setPretty(boolean)
+ */
+ public void setPretty(boolean pretty) throws IOException {
+ this.isPretty = pretty;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#start()
+ */
+ public void start() throws IOException {
+ // dont need to do anything
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#startCommentBlock()
+ */
+ public void startCommentBlock() throws IOException {
+ if (commentBlock != null)
+ throw new IOException("Cannot nest comments");
+ /* we start a comment block by create a document fragment with 1 element root: commentRoot
+ * Further node will be add to be children of this element root.
+ */
+ commentBlock = doc.createDocumentFragment();
+ Node node = doc.createElement("commentRoot");
+ commentBlock.appendChild(node);
+ current.push(node);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#text(java.lang.String)
+ */
+ public void text(String content) throws IOException {
+ text(content, false);
+ }
+
+ public void text(String content, boolean dontEscape) throws IOException {
+ if (!dontEscape)
+ content = XMLUtil.escapeXML(content, null, false);
+ checkInElement();
+ Node node = doc.createTextNode(content);
+ getCurrentElement().appendChild(node);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#writeBytes(byte[])
+ */
+ public void writeBytes(byte[] bytes) throws IOException {
+ text(new String(bytes));
+ }
+
+}
diff --git a/bundles/org.eclipse.uomo.xml/src/main/java/org/eclipse/uomo/xml/impl/XMLNamespace.java b/bundles/org.eclipse.uomo.xml/src/main/java/org/eclipse/uomo/xml/impl/XMLNamespace.java
index 3d72e83..85690bd 100644
--- a/bundles/org.eclipse.uomo.xml/src/main/java/org/eclipse/uomo/xml/impl/XMLNamespace.java
+++ b/bundles/org.eclipse.uomo.xml/src/main/java/org/eclipse/uomo/xml/impl/XMLNamespace.java
@@ -1,41 +1,41 @@
-/*******************************************************************************
- * 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.xml.impl;
-
-public class XMLNamespace {
-
- private String namespace;
- private String abbreviation;
-
- public XMLNamespace(String namespace, String abbreviation) {
- super();
- setNamespace(namespace);
- setAbbreviation(abbreviation);
- }
-
- public String getAbbreviation() {
- return abbreviation;
- }
-
- public void setAbbreviation(String abbreviation) {
- this.abbreviation = abbreviation;
- }
-
- public String getNamespace() {
- return namespace;
- }
-
- public void setNamespace(String namespace) {
- this.namespace = namespace;
- }
-
-}
+/*******************************************************************************
+ * 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.xml.impl;
+
+public class XMLNamespace {
+
+ private String namespace;
+ private String abbreviation;
+
+ public XMLNamespace(String namespace, String abbreviation) {
+ super();
+ setNamespace(namespace);
+ setAbbreviation(abbreviation);
+ }
+
+ public String getAbbreviation() {
+ return abbreviation;
+ }
+
+ public void setAbbreviation(String abbreviation) {
+ this.abbreviation = abbreviation;
+ }
+
+ public String getNamespace() {
+ return namespace;
+ }
+
+ public void setNamespace(String namespace) {
+ this.namespace = namespace;
+ }
+
+}
diff --git a/bundles/org.eclipse.uomo.xml/src/main/java/org/eclipse/uomo/xml/impl/XMLPullWriter.java b/bundles/org.eclipse.uomo.xml/src/main/java/org/eclipse/uomo/xml/impl/XMLPullWriter.java
index 5e63e2a..a5f781c 100644
--- a/bundles/org.eclipse.uomo.xml/src/main/java/org/eclipse/uomo/xml/impl/XMLPullWriter.java
+++ b/bundles/org.eclipse.uomo.xml/src/main/java/org/eclipse/uomo/xml/impl/XMLPullWriter.java
@@ -1,101 +1,101 @@
-/*******************************************************************************
- * 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.xml.impl;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-
-import org.eclipse.uomo.core.UOMoException;
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-
-public class XMLPullWriter {
-
- private XMLWriter xml;
-
- public XMLPullWriter(OutputStream stream) throws UnsupportedEncodingException, IOException {
- super();
- xml = new XMLWriter(stream, "UTF-8");
- xml.start();
- }
-
- public XMLPullWriter(XMLWriter writer) throws UnsupportedEncodingException {
- super();
- xml = writer;
- }
-
- public void write(XmlPullParser xpp, boolean rootElement, String elementName, String defaultNamespace) throws UOMoException, IOException, XmlPullParserException {
- if (defaultNamespace != null) {
- if (!xml.namespaceDefined(defaultNamespace))
- xml.setDefaultNamespace(defaultNamespace);
- } else if (rootElement)
- xml.setDefaultNamespace(xpp.getNamespace());
-
- if (elementName != null)
- xml.open(defaultNamespace, elementName);
-
- if (rootElement)
- processElement(xpp);
- else {
- processContents(xpp);
- if (xpp.getEventType() != XmlPullParser.END_DOCUMENT)
- xpp.next();
- }
-
- if (elementName != null)
- xml.close();
- xml.flush();
- }
-
- private void processContents(XmlPullParser xpp) throws XmlPullParserException, UOMoException, IOException {
- while (xpp.getEventType() != XmlPullParser.END_TAG && xpp.getEventType() != XmlPullParser.END_DOCUMENT) {
- if (xpp.getEventType() == XmlPullParser.START_TAG)
- processElement(xpp);
- else if (xpp.getEventType() == XmlPullParser.TEXT)
- processText(xpp);
- else
- throw new UOMoException("unhandled event type "+Integer.toString(xpp.getEventType()));
- }
- }
-
- private void processElement(XmlPullParser xpp) throws UOMoException, XmlPullParserException, IOException {
- xml.namespace(xpp.getNamespace());
-
- processAttributes(xpp);
- xml.open(xpp.getNamespace(), xpp.getName());
- xpp.next();
-
- processContents(xpp);
-
- xml.close();
- if (xpp.getEventType() != XmlPullParser.END_DOCUMENT)
- xpp.next();
- }
-
- private void processText(XmlPullParser xpp) throws UOMoException, XmlPullParserException, IOException {
- xml.text(xpp.getText());
- xpp.next();
- }
-
- private void processAttributes(XmlPullParser xpp) throws IOException {
- for (int i = 0; i < xpp.getAttributeCount(); i++) {
- String ns = xpp.getAttributeNamespace(i);
- if (!"".equals(ns)) {
- xml.namespace(ns);
- xml.attribute(ns, xpp.getAttributeName(i), xpp.getAttributeValue(i));
- } else
- xml.attribute(xpp.getAttributeName(i), xpp.getAttributeValue(i));
- }
-
- }
-
-}
+/*******************************************************************************
+ * 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.xml.impl;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+
+import org.eclipse.uomo.core.UOMoException;
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
+public class XMLPullWriter {
+
+ private XMLWriter xml;
+
+ public XMLPullWriter(OutputStream stream) throws UnsupportedEncodingException, IOException {
+ super();
+ xml = new XMLWriter(stream, "UTF-8");
+ xml.start();
+ }
+
+ public XMLPullWriter(XMLWriter writer) throws UnsupportedEncodingException {
+ super();
+ xml = writer;
+ }
+
+ public void write(XmlPullParser xpp, boolean rootElement, String elementName, String defaultNamespace) throws UOMoException, IOException, XmlPullParserException {
+ if (defaultNamespace != null) {
+ if (!xml.namespaceDefined(defaultNamespace))
+ xml.setDefaultNamespace(defaultNamespace);
+ } else if (rootElement)
+ xml.setDefaultNamespace(xpp.getNamespace());
+
+ if (elementName != null)
+ xml.open(defaultNamespace, elementName);
+
+ if (rootElement)
+ processElement(xpp);
+ else {
+ processContents(xpp);
+ if (xpp.getEventType() != XmlPullParser.END_DOCUMENT)
+ xpp.next();
+ }
+
+ if (elementName != null)
+ xml.close();
+ xml.flush();
+ }
+
+ private void processContents(XmlPullParser xpp) throws XmlPullParserException, UOMoException, IOException {
+ while (xpp.getEventType() != XmlPullParser.END_TAG && xpp.getEventType() != XmlPullParser.END_DOCUMENT) {
+ if (xpp.getEventType() == XmlPullParser.START_TAG)
+ processElement(xpp);
+ else if (xpp.getEventType() == XmlPullParser.TEXT)
+ processText(xpp);
+ else
+ throw new UOMoException("unhandled event type "+Integer.toString(xpp.getEventType()));
+ }
+ }
+
+ private void processElement(XmlPullParser xpp) throws UOMoException, XmlPullParserException, IOException {
+ xml.namespace(xpp.getNamespace());
+
+ processAttributes(xpp);
+ xml.open(xpp.getNamespace(), xpp.getName());
+ xpp.next();
+
+ processContents(xpp);
+
+ xml.close();
+ if (xpp.getEventType() != XmlPullParser.END_DOCUMENT)
+ xpp.next();
+ }
+
+ private void processText(XmlPullParser xpp) throws UOMoException, XmlPullParserException, IOException {
+ xml.text(xpp.getText());
+ xpp.next();
+ }
+
+ private void processAttributes(XmlPullParser xpp) throws IOException {
+ for (int i = 0; i < xpp.getAttributeCount(); i++) {
+ String ns = xpp.getAttributeNamespace(i);
+ if (!"".equals(ns)) {
+ xml.namespace(ns);
+ xml.attribute(ns, xpp.getAttributeName(i), xpp.getAttributeValue(i));
+ } else
+ xml.attribute(xpp.getAttributeName(i), xpp.getAttributeValue(i));
+ }
+
+ }
+
+}
diff --git a/bundles/org.eclipse.uomo.xml/src/main/java/org/eclipse/uomo/xml/impl/XMLStringsParser.java b/bundles/org.eclipse.uomo.xml/src/main/java/org/eclipse/uomo/xml/impl/XMLStringsParser.java
index c794c81..651a181 100644
--- a/bundles/org.eclipse.uomo.xml/src/main/java/org/eclipse/uomo/xml/impl/XMLStringsParser.java
+++ b/bundles/org.eclipse.uomo.xml/src/main/java/org/eclipse/uomo/xml/impl/XMLStringsParser.java
@@ -1,76 +1,76 @@
-/*******************************************************************************
- * 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.xml.impl;
-
-import org.eclipse.uomo.xml.XMLObjectParser;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-
-public class XMLStringsParser extends XMLObjectParser {
-
- private String namespace;
- private String name;
-
- private String[] content;
- private StringBuffer current = null;
-
-
- public XMLStringsParser(String namespace, String name) {
- super();
- this.namespace = namespace;
- this.name = name;
- }
-
- public void endElement(String namespace, String name) throws SAXException {
- if (current != null)
- addContent(current.toString());
-
- current = null;
- }
-
- private void addContent(String string) {
- if (content == null)
- content = new String[] {string};
- else {
- String[] newContent = new String[content.length + 1];
- for (int i = 0; i < content.length; i++)
- newContent[i] = content[i];
- newContent[content.length] = string;
- content = newContent;
- }
- }
-
- public XMLObjectParser startElement(String namespace, String name, String defaultNamespace, Attributes attributes) throws SAXException {
- if (namespace.equals(this.namespace) && name.equals(this.name)) {
- current = new StringBuffer();
- return null;
- }
- else
- return super.startElement(namespace, name, defaultNamespace, attributes);
- }
-
- public void findText(char[] ch, int start, int length, boolean whitespace) throws SAXException {
- if (current == null)
- super.findText(ch, start, length, whitespace);
- else
- current.append(ch, start, length);
- }
-
- public String[] getContent() {
- return content;
- }
-
- public boolean hasText() throws SAXException {
- return true;
- }
-
-}
+/*******************************************************************************
+ * 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.xml.impl;
+
+import org.eclipse.uomo.xml.XMLObjectParser;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class XMLStringsParser extends XMLObjectParser {
+
+ private String namespace;
+ private String name;
+
+ private String[] content;
+ private StringBuffer current = null;
+
+
+ public XMLStringsParser(String namespace, String name) {
+ super();
+ this.namespace = namespace;
+ this.name = name;
+ }
+
+ public void endElement(String namespace, String name) throws SAXException {
+ if (current != null)
+ addContent(current.toString());
+
+ current = null;
+ }
+
+ private void addContent(String string) {
+ if (content == null)
+ content = new String[] {string};
+ else {
+ String[] newContent = new String[content.length + 1];
+ for (int i = 0; i < content.length; i++)
+ newContent[i] = content[i];
+ newContent[content.length] = string;
+ content = newContent;
+ }
+ }
+
+ public XMLObjectParser startElement(String namespace, String name, String defaultNamespace, Attributes attributes) throws SAXException {
+ if (namespace.equals(this.namespace) && name.equals(this.name)) {
+ current = new StringBuffer();
+ return null;
+ }
+ else
+ return super.startElement(namespace, name, defaultNamespace, attributes);
+ }
+
+ public void findText(char[] ch, int start, int length, boolean whitespace) throws SAXException {
+ if (current == null)
+ super.findText(ch, start, length, whitespace);
+ else
+ current.append(ch, start, length);
+ }
+
+ public String[] getContent() {
+ return content;
+ }
+
+ public boolean hasText() throws SAXException {
+ return true;
+ }
+
+}
diff --git a/bundles/org.eclipse.uomo.xml/src/main/java/org/eclipse/uomo/xml/impl/XMLWriter.java b/bundles/org.eclipse.uomo.xml/src/main/java/org/eclipse/uomo/xml/impl/XMLWriter.java
index 5b33c71..7f44294 100644
--- a/bundles/org.eclipse.uomo.xml/src/main/java/org/eclipse/uomo/xml/impl/XMLWriter.java
+++ b/bundles/org.eclipse.uomo.xml/src/main/java/org/eclipse/uomo/xml/impl/XMLWriter.java
@@ -1,780 +1,780 @@
-/*******************************************************************************
- * 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.xml.impl;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.UnsupportedEncodingException;
-
-import org.eclipse.uomo.xml.IXMLWriter;
-import org.eclipse.uomo.xml.XMLUtil;
-
-/**
- * XML Writer class.
- */
-public class XMLWriter extends OutputStreamWriter implements IXMLWriter {
-
- private boolean xmlHeader = true;
- private String charset;
- private boolean prettyBase;
- private boolean prettyHeader;
- private boolean pendingClose;
- private boolean pendingOpen;
- private String pendingComment;
- private int lineType = LINE_UNIX;
- private OutputStream stream;
- private boolean started = false;
- private String[] specialAttributeNames = new String[] {"id", "name" };
- private boolean sortAttributes;
- private int attributeLineWrap;
-
- public final static int LINE_UNIX = 0;
- public final static int LINE_WINDOWS = 1;
-
- public XMLWriter(OutputStream stream, String charset) throws UnsupportedEncodingException {
- super(stream, charset);
- this.stream = stream;
- this.charset = charset;
- }
-
- protected boolean condition(boolean bTest, String message) throws IOException {
- if (!bTest)
- throw new IOException(message);
- return bTest;
- }
-
- // -- writing context ------------------------------------------------
-
-
-
- /**
- * Returns the encoding.
- *
- * @param charset
- * @return encoding
- * @throws IOException
- */
- public static String getXMLCharsetName(String charset) throws IOException {
- if (charset == null || charset.equals(""))
- return "UTF-8";
- else if (charset.equals("US-ASCII"))
- return "UTF-8";
- else if (XMLUtil.charSetImpliesAscii(charset))
- return "ISO-8859-1";
- else if (charset.equals("UTF-8"))
- return "UTF-8";
- else if (charset.equals("UTF-16") || charset.equals("UTF-16BE") || charset.equals("UTF-16LE"))
- return "UTF-16";
- else
- throw new IOException("Unknown charset encoding "+charset);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#start()
- */
- public void start() throws IOException {
- condition(!started, "attempt to start after starting");
- levels.clear();
- attributes = null;
- try {
- if (xmlHeader) {
- write("<?xml version=\"1.0\" encoding=\""+getXMLCharsetName(charset)+"\"?>");
- if (prettyBase || prettyHeader)
- write(lineType == LINE_UNIX ? "\n" : "\r\n");
- }
- } catch (UnsupportedEncodingException e) {
- // TODO Auto-generated catch block
- throw new IOException(e.getMessage());
- }
- started = true;
- }
-
- private void checkStarted () throws IOException {
- condition(started, "not started");
- }
-
- private void checkInElement() throws IOException {
- condition(levels.size() > 0, "not in an element");
- }
-
- // -- attributes ----------------------------------------------------
-
- private String[][] attributes;
-
- private void addAttribute(String name, String value) throws IOException {
- addAttribute(name, value, false);
- }
-
- private void addAttribute(String name, String value, boolean noLines) throws IOException {
- if (!XMLUtil.isNMToken(name))
- throw new IOException("XML name "+name+" is not valid");
-
- newLevelIfRequired();
- value = XMLUtil.escapeXML(value, charset, noLines);
-
- if (attributes == null)
- attributes = new String[][] {{name, value}};
- else {
- String[][] newattr = new String[attributes.length+1][];
- for (int i = 0; i < attributes.length; i++) {
- condition(!attributes[i][0].equals(name), "attempt to define attribute with name "+name+" more than once");
- newattr[i] = attributes[i];
- }
- attributes = newattr;
- attributes[attributes.length-1] = new String[] {name, value};
- }
- }
-
- protected String getAttribute(String name) {
- if (attributes != null) {
- for (int i = 0; i < attributes.length; i++) {
- if (attributes[i][0].equals(name)) {
- return attributes[i][1];
- }
- }
- }
- return null;
- }
-
- protected void setAttribute(String name, String value) throws IOException {
- newLevelIfRequired();
- if (attributes == null)
- addAttribute(name, value, false);
- else {
- for (int i = 0; i < attributes.length; i++) {
- if (attributes[i][0].equals(name)) {
- attributes[i][1] = XMLUtil.escapeXML(value, charset, false);
- return;
- }
- }
- addAttribute(name, value);
- }
- }
-
- protected void commitAttributes() throws IOException {
-
- }
-
-
- private boolean nameIsSpecial(String name) {
- for (int i = 0; i < specialAttributeNames.length; i++) {
- String n = specialAttributeNames[i];
- if (n.equalsIgnoreCase(name))
- return true;
- }
- return false;
- }
-
- private void writeAttributes(int col) throws IOException {
- commitAttributes();
- if (attributes != null && sortAttributes)
- sortAttributes();
- int c = col;
- c = writeAttributeSet(true, c, col);
- writeAttributeSet(false, c, col);
- attributes = null;
- }
-
-
- private void sortAttributes() {
- // bubble sort - look, it's easy
- for (int i = 0; i < attributes.length - 1; i++) {
- for (int j = 0; j < attributes.length - 1; j++) {
- if (String.CASE_INSENSITIVE_ORDER.compare(attributes[j][0], attributes[j+1][0]) < 0) {
- String[] t = attributes[j];
- attributes[j] = attributes[j+1];
- attributes[j+1] = t;
- }
- }
- }
-
- }
-
-
- private int writeAttributeSet(boolean special, int col, int wrap) throws IOException {
- // first pass: name, id
- if (attributes != null) {
- for (int i=0; i < attributes.length; i++) {
- String[] element = attributes[i];
- if (nameIsSpecial(element[0]) == special) {
- col = col + element[0].length()+element[1].length() + 4;
- if (isPretty() && attributeLineWrap > 0 && col > attributeLineWrap && col > wrap) {
- write(lineType == LINE_UNIX ? "\n" : "\r\n");
- for (int j = 0; j < wrap; j++)
- write(" ");
- col = wrap;
- }
- write(' ');
- write(element[0]);
- write("=\"");
- if (element[1] != null)
- write(element[1]);
- write("\"");
- }
- }
- }
- return col;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#attribute(java.lang.String, java.lang.String, java.lang.String, boolean)
- */
- public void attribute(String namespace, String name, String value, boolean onlyIfNotEmpty) throws IOException {
- if (!onlyIfNotEmpty || value != null && !value.equals(""))
- attribute(namespace, name, value);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#attribute(java.lang.String, java.lang.String, java.lang.String)
- */
- public void attribute(String namespace, String name, String value) throws IOException {
-
- checkStarted();
- if (namespace == null || namespace.equals(""))
- addAttribute(name, value);
- else
- addAttribute(getNSAbbreviation(namespace)+name, value);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#attribute(java.lang.String, java.lang.String, boolean)
- */
- public void attribute(String name, String value, boolean onlyIfNotEmpty) throws IOException {
- if (!onlyIfNotEmpty || value != null && !value.equals(""))
- attribute(name, value);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#attribute(java.lang.String, java.lang.String)
- */
- public void attribute(String name, String value) throws IOException {
- checkStarted();
- addAttribute(name, value);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#attributeNoLines(java.lang.String, java.lang.String)
- */
- public void attributeNoLines(String name, String value) throws IOException {
- checkStarted();
- addAttribute(name, value, true);
- }
-
- // -- levels -------------------------------------------------
-
- private XMLWriterStateStack levels = new XMLWriterStateStack();
-
- private void newLevelIfRequired() throws IOException {
- if (!pendingOpen) {
- if (!levels.empty())
- levels.current().seeChild();
- XMLWriterState level = new XMLWriterState();
- level.setPretty(isPretty());
- levels.push(level);
- pendingOpen = true;
- }
- }
-
- // -- namespaces ---------------------------------------------
-
-
- private void defineNamespace(String namespace, String abbrev) throws IOException {
- checkStarted();
- if (namespace != null && !namespace.equals("")) {
- if (abbrev.equals(""))
- abbrev = null;
-
- newLevelIfRequired();
-
- levels.current().addNamespaceDefn(namespace, abbrev);
- if (abbrev == null)
- addAttribute("xmlns", namespace);
- else
- addAttribute("xmlns:"+abbrev, namespace);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#findByNamespace(java.lang.String)
- */
- public XMLNamespace findByNamespace(String namespace) {
- for (int i = levels.size() - 1; i >= 0; i--) {
- XMLNamespace ns = levels.item(i).getDefnByNamespace(namespace);
- if (ns != null)
- return ns;
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#namespaceDefined(java.lang.String)
- */
- public boolean namespaceDefined(String namespace) {
- return namespace == null || namespace.equals("") || findByNamespace(namespace) != null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#findByAbbreviation(java.lang.String)
- */
- public XMLNamespace findByAbbreviation(String abbreviation) {
- for (int i = levels.size() - 1; i >= 0; i--) {
- XMLNamespace ns = levels.item(i).getDefnByAbbreviation(abbreviation);
- if (ns != null)
- return ns;
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#abbreviationDefined(java.lang.String)
- */
- public boolean abbreviationDefined(String abbreviation) {
- return findByAbbreviation(abbreviation) != null;
- }
-
- protected XMLNamespace findDefaultNamespace() {
- for (int i = levels.size() - 1; i >= 0; i--) {
- XMLNamespace ns = levels.item(i).getDefaultNamespace();
- if (ns != null)
- return ns;
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#getDefaultNamespace()
- */
- public String getDefaultNamespace() {
- XMLNamespace ns = findDefaultNamespace();
- if (ns == null)
- return null;
- else
- return ns.getNamespace();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#namespace(java.lang.String)
- */
- public void namespace(String namespace) throws IOException {
- if (!namespaceDefined(namespace)) {
- int index = 0;
- while (abbreviationDefined("ns"+Integer.toString(index)))
- index++;
- defineNamespace(namespace, "ns"+Integer.toString(index));
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#defaultNamespace(java.lang.String)
- *
- * Replace defaultNamespace()
- */
- public void setDefaultNamespace(String namespace) throws IOException {
- if ((namespace == null && getDefaultNamespace() != null) ||
- (namespace != null && !namespace.equals(getDefaultNamespace())))
- defineNamespace(namespace, "");
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#namespace(java.lang.String, java.lang.String)
- */
- public void namespace(String namespace, String abbreviation) throws IOException {
- XMLNamespace ns = findByAbbreviation(abbreviation);
- if (ns == null || !ns.getNamespace().equals(namespace))
- defineNamespace(namespace, abbreviation);
- }
-
-
- private String getNSAbbreviation(String namespace) throws IOException {
- if ("http://www.w3.org/XML/1998/namespace".equals(namespace))
- return "xml:";
-
- if (namespace == null || "".equals(namespace))
- return "";
-
- XMLNamespace ns = findByNamespace(namespace);
- if (ns == null)
- throw new IOException("Namespace "+namespace+" is not defined");
- else if (ns.getAbbreviation() == null)
- return "";
- else
- return ns.getAbbreviation()+":";
- }
-
- // -- public API -----------------------------------------------------------
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#comment(java.lang.String, boolean)
- */
- public void comment(String comment, boolean doPretty) throws IOException {
- checkStarted();
- if (pendingClose) {
- write('>');
- writePendingComment();
- pendingClose = false;
- }
- if (doPretty) {
- writePretty();
- if (isPretty()) {
- for (int i = 0; i < levels.size(); i++)
- write(" ");
- }
- }
- if (levels.inComment())
- write("<!-- "+comment+" -- >");
- else
- write("<!-- "+comment+" -->");
- if (doPretty && !isPretty())
- writePretty();
- }
-
-
- private void writePendingComment() throws IOException {
- if (pendingComment != null) {
- if (isPretty())
- write(" ");
- if (levels.inComment())
- write("<!-- "+pendingComment+" -- >");
- else
- write("<!-- "+pendingComment+" -->");
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#open(java.lang.String, java.lang.String)
- */
- public void open(String namespace, String name) throws IOException {
- open(namespace, name, null);
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#open(java.lang.String, java.lang.String, java.lang.String)
- */
- public void open(String namespace, String name, String comment) throws IOException {
- if (!XMLUtil.isNMToken(name))
- throw new IOException("XML name "+name+" is not valid");
- checkStarted();
- if (pendingClose) {
- write('>');
- writePendingComment();
- pendingClose = false;
- }
-
- if (name == null) {
- throw new IOException("name is null");
- }
- newLevelIfRequired();
- levels.current().setName(name);
- levels.current().setNamespace(namespace);
- int col = writePretty();
- write('<');
- if (namespace == null) {
- write(name);
- col = col + name.length()+1;
- } else {
- String n = getNSAbbreviation(namespace)+name;
- write(n);
- col = col + n.length()+1;
- }
- writeAttributes(col);
- pendingOpen = false;
- pendingClose = true;
- pendingComment = comment;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#close(java.lang.String)
- */
- public void close(String name) throws IOException {
- checkStarted();
- if (levels.empty())
- throw new IOException("Unable to close null|"+name+", nothing to close");
- if (levels.current().getNamespace() != null || !levels.current().getName().equals(name))
- throw new IOException("Unable to close null|"+name+", found "+levels.current().getNamespace()+"|"+levels.current().getName());
- close();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#close(java.lang.String, java.lang.String)
- */
- public void close(String namespace, String name) throws IOException {
- checkStarted();
- if (levels.empty())
- throw new IOException("Unable to close "+namespace+"|"+name+", nothing to close");
- if (!levels.current().getNamespace().equals(namespace) || !levels.current().getName().equals(name))
- throw new IOException("Unable to close "+namespace+"|"+name+", found "+levels.current().getNamespace()+"|"+levels.current().getName());
- close();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#closeToLevel(int)
- */
- public void closeToLevel(int count) throws IOException {
- while (levels.size() > count)
- close();
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#close()
- */
- public void close() throws IOException {
- checkStarted();
- if (levels.empty()) {
- super.close();
- } else {
- if (pendingClose) {
- write("/>");
- writePendingComment();
- pendingClose = false;
- } else {
- if (levels.current().hasChildren())
- writePretty();
- write("</");
- if (levels.current().getNamespace() == null)
- write(levels.current().getName());
- else
- write(getNSAbbreviation(levels.current().getNamespace())+levels.current().getName());
- write('>');
- }
- levels.pop();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#open(java.lang.String)
- */
- public void open(String name) throws IOException {
- open(null, name);
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#element(java.lang.String, java.lang.String, java.lang.String, boolean)
- */
- public void element(String namespace, String name, String content, boolean onlyIfNotEmpty) throws IOException {
- if (!onlyIfNotEmpty || content != null && !content.equals(""))
- element(namespace, name, content);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#element(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
- */
- public void element(String namespace, String name, String content, String comment) throws IOException {
- if (!XMLUtil.isNMToken(name))
- throw new IOException("XML name "+name+" is not valid");
- open(namespace, name, comment);
- text(content);
- close();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#element(java.lang.String, java.lang.String, java.lang.String)
- */
- public void element(String namespace, String name, String content) throws IOException {
- if (!XMLUtil.isNMToken(name))
- throw new IOException("XML name "+name+" is not valid");
- open(namespace, name);
- text(content);
- close();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#element(java.lang.String, java.lang.String, boolean)
- */
- public void element(String name, String content, boolean onlyIfNotEmpty) throws IOException {
- if (!onlyIfNotEmpty || content != null && !content.equals(""))
- element(null, name, content);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#element(java.lang.String, java.lang.String)
- */
- public void element(String name, String content) throws IOException {
- element(null, name, content);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#text(java.lang.String)
- */
- public void text(String content) throws IOException {
- text(content, false);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#text(java.lang.String, boolean)
- *
- * Replace escapeText()
- */
- public void text(String content, boolean dontEscape) throws IOException {
- checkInElement();
- if (content != null) {
- if (pendingClose) {
- write(">");
- writePendingComment();
- pendingClose = false;
- }
- if (dontEscape)
- write(content);
- else
- write(XMLUtil.escapeXML(content, charset, false));
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#cData(java.lang.String)
- */
- public void cData(String text) throws IOException {
- text("<![CDATA["+text+"]]>");
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#writeBytes(byte[])
- */
- public void writeBytes(byte[] bytes) throws IOException {
- checkInElement();
- if (pendingClose) {
- write(">");
- writePendingComment();
- pendingClose = false;
- }
- flush();
- stream.write(bytes);
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#isPretty()
- */
- public boolean isPretty() throws IOException {
- return (levels == null || levels.empty()) ? prettyBase : levels.current().isPretty();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#setPretty(boolean)
- */
- public void setPretty(boolean pretty) throws IOException {
- if (levels == null || levels.empty())
- this.prettyBase = pretty;
- else
- levels.current().setPretty(pretty);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#startCommentBlock()
- */
- public void startCommentBlock() throws IOException {
- if (levels.inComment())
- throw new IOException("cannot nest comments");
- levels.current().setInComment(true);
- if (isPretty())
- writePretty();
- write("<!--");
- if (isPretty())
- writePretty();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ohf.utilities.xml.IXMLWriter#endCommentBlock()
- */
- public void endCommentBlock() throws IOException {
- if (!levels.inComment())
- throw new IOException("cannot close a comment block when it is open");
- if (!levels.current().isInComment())
- throw new IOException("cannot close a comment block when it is open");
- if (isPretty())
- writePretty();
- write("-->");
- if (isPretty())
- writePretty();
- levels.current().setInComment(false);
- }
-
- public boolean isSortAttributes() {
- return sortAttributes;
- }
-
- public void setSortAttributes(boolean sortAttributes) {
- this.sortAttributes = sortAttributes;
- }
-
-
- public boolean isPrettyHeader() {
- return prettyHeader;
- }
-
- public void setPrettyHeader(boolean pretty) {
- this.prettyHeader = pretty;
- }
-
- public int writePretty() throws IOException {
- return writePretty(true);
- }
-
- public int writePretty(boolean eoln) throws IOException {
- if (isPretty()) {
- if (eoln)
- write(lineType == LINE_UNIX ? "\n" : "\r\n");
- for (int i = 0; i < levels.size() - 1; i++)
- write(" ");
- return (levels.size() - 1) * 2;
- } else
- return 0;
- }
-
- public int getLineType() {
- return lineType;
- }
-
- public void setLineType(int lineType) {
- this.lineType = lineType;
- }
-
- public boolean isXmlHeader() {
- return xmlHeader;
- }
-
- public void setXmlHeader(boolean xmlHeader) {
- this.xmlHeader = xmlHeader;
- }
-
- public String[] getSpecialAttributeNames() {
- return specialAttributeNames;
- }
-
- public void setSpecialAttributeNames(String[] specialAttributeNames) {
- this.specialAttributeNames = specialAttributeNames;
- }
-
- public int getAttributeLineWrap() {
- return attributeLineWrap;
- }
-
- public void setAttributeLineWrap(int attributeLineWrap) {
- this.attributeLineWrap = attributeLineWrap;
- }
-
- public void escapedText(String content) throws IOException {
- text("");
- int i = content.length();
- if (isPretty())
- while (i > 0 && (content.charAt(i-1) == '\r' || content.charAt(i-1) == '\n'))
- i--;
- write(content.substring(0, i));
- }
-
-
-}
-
+/*******************************************************************************
+ * 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.xml.impl;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
+
+import org.eclipse.uomo.xml.IXMLWriter;
+import org.eclipse.uomo.xml.XMLUtil;
+
+/**
+ * XML Writer class.
+ */
+public class XMLWriter extends OutputStreamWriter implements IXMLWriter {
+
+ private boolean xmlHeader = true;
+ private String charset;
+ private boolean prettyBase;
+ private boolean prettyHeader;
+ private boolean pendingClose;
+ private boolean pendingOpen;
+ private String pendingComment;
+ private int lineType = LINE_UNIX;
+ private OutputStream stream;
+ private boolean started = false;
+ private String[] specialAttributeNames = new String[] {"id", "name" };
+ private boolean sortAttributes;
+ private int attributeLineWrap;
+
+ public final static int LINE_UNIX = 0;
+ public final static int LINE_WINDOWS = 1;
+
+ public XMLWriter(OutputStream stream, String charset) throws UnsupportedEncodingException {
+ super(stream, charset);
+ this.stream = stream;
+ this.charset = charset;
+ }
+
+ protected boolean condition(boolean bTest, String message) throws IOException {
+ if (!bTest)
+ throw new IOException(message);
+ return bTest;
+ }
+
+ // -- writing context ------------------------------------------------
+
+
+
+ /**
+ * Returns the encoding.
+ *
+ * @param charset
+ * @return encoding
+ * @throws IOException
+ */
+ public static String getXMLCharsetName(String charset) throws IOException {
+ if (charset == null || charset.equals(""))
+ return "UTF-8";
+ else if (charset.equals("US-ASCII"))
+ return "UTF-8";
+ else if (XMLUtil.charSetImpliesAscii(charset))
+ return "ISO-8859-1";
+ else if (charset.equals("UTF-8"))
+ return "UTF-8";
+ else if (charset.equals("UTF-16") || charset.equals("UTF-16BE") || charset.equals("UTF-16LE"))
+ return "UTF-16";
+ else
+ throw new IOException("Unknown charset encoding "+charset);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#start()
+ */
+ public void start() throws IOException {
+ condition(!started, "attempt to start after starting");
+ levels.clear();
+ attributes = null;
+ try {
+ if (xmlHeader) {
+ write("<?xml version=\"1.0\" encoding=\""+getXMLCharsetName(charset)+"\"?>");
+ if (prettyBase || prettyHeader)
+ write(lineType == LINE_UNIX ? "\n" : "\r\n");
+ }
+ } catch (UnsupportedEncodingException e) {
+ // TODO Auto-generated catch block
+ throw new IOException(e.getMessage());
+ }
+ started = true;
+ }
+
+ private void checkStarted () throws IOException {
+ condition(started, "not started");
+ }
+
+ private void checkInElement() throws IOException {
+ condition(levels.size() > 0, "not in an element");
+ }
+
+ // -- attributes ----------------------------------------------------
+
+ private String[][] attributes;
+
+ private void addAttribute(String name, String value) throws IOException {
+ addAttribute(name, value, false);
+ }
+
+ private void addAttribute(String name, String value, boolean noLines) throws IOException {
+ if (!XMLUtil.isNMToken(name))
+ throw new IOException("XML name "+name+" is not valid");
+
+ newLevelIfRequired();
+ value = XMLUtil.escapeXML(value, charset, noLines);
+
+ if (attributes == null)
+ attributes = new String[][] {{name, value}};
+ else {
+ String[][] newattr = new String[attributes.length+1][];
+ for (int i = 0; i < attributes.length; i++) {
+ condition(!attributes[i][0].equals(name), "attempt to define attribute with name "+name+" more than once");
+ newattr[i] = attributes[i];
+ }
+ attributes = newattr;
+ attributes[attributes.length-1] = new String[] {name, value};
+ }
+ }
+
+ protected String getAttribute(String name) {
+ if (attributes != null) {
+ for (int i = 0; i < attributes.length; i++) {
+ if (attributes[i][0].equals(name)) {
+ return attributes[i][1];
+ }
+ }
+ }
+ return null;
+ }
+
+ protected void setAttribute(String name, String value) throws IOException {
+ newLevelIfRequired();
+ if (attributes == null)
+ addAttribute(name, value, false);
+ else {
+ for (int i = 0; i < attributes.length; i++) {
+ if (attributes[i][0].equals(name)) {
+ attributes[i][1] = XMLUtil.escapeXML(value, charset, false);
+ return;
+ }
+ }
+ addAttribute(name, value);
+ }
+ }
+
+ protected void commitAttributes() throws IOException {
+
+ }
+
+
+ private boolean nameIsSpecial(String name) {
+ for (int i = 0; i < specialAttributeNames.length; i++) {
+ String n = specialAttributeNames[i];
+ if (n.equalsIgnoreCase(name))
+ return true;
+ }
+ return false;
+ }
+
+ private void writeAttributes(int col) throws IOException {
+ commitAttributes();
+ if (attributes != null && sortAttributes)
+ sortAttributes();
+ int c = col;
+ c = writeAttributeSet(true, c, col);
+ writeAttributeSet(false, c, col);
+ attributes = null;
+ }
+
+
+ private void sortAttributes() {
+ // bubble sort - look, it's easy
+ for (int i = 0; i < attributes.length - 1; i++) {
+ for (int j = 0; j < attributes.length - 1; j++) {
+ if (String.CASE_INSENSITIVE_ORDER.compare(attributes[j][0], attributes[j+1][0]) < 0) {
+ String[] t = attributes[j];
+ attributes[j] = attributes[j+1];
+ attributes[j+1] = t;
+ }
+ }
+ }
+
+ }
+
+
+ private int writeAttributeSet(boolean special, int col, int wrap) throws IOException {
+ // first pass: name, id
+ if (attributes != null) {
+ for (int i=0; i < attributes.length; i++) {
+ String[] element = attributes[i];
+ if (nameIsSpecial(element[0]) == special) {
+ col = col + element[0].length()+element[1].length() + 4;
+ if (isPretty() && attributeLineWrap > 0 && col > attributeLineWrap && col > wrap) {
+ write(lineType == LINE_UNIX ? "\n" : "\r\n");
+ for (int j = 0; j < wrap; j++)
+ write(" ");
+ col = wrap;
+ }
+ write(' ');
+ write(element[0]);
+ write("=\"");
+ if (element[1] != null)
+ write(element[1]);
+ write("\"");
+ }
+ }
+ }
+ return col;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#attribute(java.lang.String, java.lang.String, java.lang.String, boolean)
+ */
+ public void attribute(String namespace, String name, String value, boolean onlyIfNotEmpty) throws IOException {
+ if (!onlyIfNotEmpty || value != null && !value.equals(""))
+ attribute(namespace, name, value);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#attribute(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void attribute(String namespace, String name, String value) throws IOException {
+
+ checkStarted();
+ if (namespace == null || namespace.equals(""))
+ addAttribute(name, value);
+ else
+ addAttribute(getNSAbbreviation(namespace)+name, value);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#attribute(java.lang.String, java.lang.String, boolean)
+ */
+ public void attribute(String name, String value, boolean onlyIfNotEmpty) throws IOException {
+ if (!onlyIfNotEmpty || value != null && !value.equals(""))
+ attribute(name, value);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#attribute(java.lang.String, java.lang.String)
+ */
+ public void attribute(String name, String value) throws IOException {
+ checkStarted();
+ addAttribute(name, value);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#attributeNoLines(java.lang.String, java.lang.String)
+ */
+ public void attributeNoLines(String name, String value) throws IOException {
+ checkStarted();
+ addAttribute(name, value, true);
+ }
+
+ // -- levels -------------------------------------------------
+
+ private XMLWriterStateStack levels = new XMLWriterStateStack();
+
+ private void newLevelIfRequired() throws IOException {
+ if (!pendingOpen) {
+ if (!levels.empty())
+ levels.current().seeChild();
+ XMLWriterState level = new XMLWriterState();
+ level.setPretty(isPretty());
+ levels.push(level);
+ pendingOpen = true;
+ }
+ }
+
+ // -- namespaces ---------------------------------------------
+
+
+ private void defineNamespace(String namespace, String abbrev) throws IOException {
+ checkStarted();
+ if (namespace != null && !namespace.equals("")) {
+ if (abbrev.equals(""))
+ abbrev = null;
+
+ newLevelIfRequired();
+
+ levels.current().addNamespaceDefn(namespace, abbrev);
+ if (abbrev == null)
+ addAttribute("xmlns", namespace);
+ else
+ addAttribute("xmlns:"+abbrev, namespace);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#findByNamespace(java.lang.String)
+ */
+ public XMLNamespace findByNamespace(String namespace) {
+ for (int i = levels.size() - 1; i >= 0; i--) {
+ XMLNamespace ns = levels.item(i).getDefnByNamespace(namespace);
+ if (ns != null)
+ return ns;
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#namespaceDefined(java.lang.String)
+ */
+ public boolean namespaceDefined(String namespace) {
+ return namespace == null || namespace.equals("") || findByNamespace(namespace) != null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#findByAbbreviation(java.lang.String)
+ */
+ public XMLNamespace findByAbbreviation(String abbreviation) {
+ for (int i = levels.size() - 1; i >= 0; i--) {
+ XMLNamespace ns = levels.item(i).getDefnByAbbreviation(abbreviation);
+ if (ns != null)
+ return ns;
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#abbreviationDefined(java.lang.String)
+ */
+ public boolean abbreviationDefined(String abbreviation) {
+ return findByAbbreviation(abbreviation) != null;
+ }
+
+ protected XMLNamespace findDefaultNamespace() {
+ for (int i = levels.size() - 1; i >= 0; i--) {
+ XMLNamespace ns = levels.item(i).getDefaultNamespace();
+ if (ns != null)
+ return ns;
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#getDefaultNamespace()
+ */
+ public String getDefaultNamespace() {
+ XMLNamespace ns = findDefaultNamespace();
+ if (ns == null)
+ return null;
+ else
+ return ns.getNamespace();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#namespace(java.lang.String)
+ */
+ public void namespace(String namespace) throws IOException {
+ if (!namespaceDefined(namespace)) {
+ int index = 0;
+ while (abbreviationDefined("ns"+Integer.toString(index)))
+ index++;
+ defineNamespace(namespace, "ns"+Integer.toString(index));
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#defaultNamespace(java.lang.String)
+ *
+ * Replace defaultNamespace()
+ */
+ public void setDefaultNamespace(String namespace) throws IOException {
+ if ((namespace == null && getDefaultNamespace() != null) ||
+ (namespace != null && !namespace.equals(getDefaultNamespace())))
+ defineNamespace(namespace, "");
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#namespace(java.lang.String, java.lang.String)
+ */
+ public void namespace(String namespace, String abbreviation) throws IOException {
+ XMLNamespace ns = findByAbbreviation(abbreviation);
+ if (ns == null || !ns.getNamespace().equals(namespace))
+ defineNamespace(namespace, abbreviation);
+ }
+
+
+ private String getNSAbbreviation(String namespace) throws IOException {
+ if ("http://www.w3.org/XML/1998/namespace".equals(namespace))
+ return "xml:";
+
+ if (namespace == null || "".equals(namespace))
+ return "";
+
+ XMLNamespace ns = findByNamespace(namespace);
+ if (ns == null)
+ throw new IOException("Namespace "+namespace+" is not defined");
+ else if (ns.getAbbreviation() == null)
+ return "";
+ else
+ return ns.getAbbreviation()+":";
+ }
+
+ // -- public API -----------------------------------------------------------
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#comment(java.lang.String, boolean)
+ */
+ public void comment(String comment, boolean doPretty) throws IOException {
+ checkStarted();
+ if (pendingClose) {
+ write('>');
+ writePendingComment();
+ pendingClose = false;
+ }
+ if (doPretty) {
+ writePretty();
+ if (isPretty()) {
+ for (int i = 0; i < levels.size(); i++)
+ write(" ");
+ }
+ }
+ if (levels.inComment())
+ write("<!-- "+comment+" -- >");
+ else
+ write("<!-- "+comment+" -->");
+ if (doPretty && !isPretty())
+ writePretty();
+ }
+
+
+ private void writePendingComment() throws IOException {
+ if (pendingComment != null) {
+ if (isPretty())
+ write(" ");
+ if (levels.inComment())
+ write("<!-- "+pendingComment+" -- >");
+ else
+ write("<!-- "+pendingComment+" -->");
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#open(java.lang.String, java.lang.String)
+ */
+ public void open(String namespace, String name) throws IOException {
+ open(namespace, name, null);
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#open(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void open(String namespace, String name, String comment) throws IOException {
+ if (!XMLUtil.isNMToken(name))
+ throw new IOException("XML name "+name+" is not valid");
+ checkStarted();
+ if (pendingClose) {
+ write('>');
+ writePendingComment();
+ pendingClose = false;
+ }
+
+ if (name == null) {
+ throw new IOException("name is null");
+ }
+ newLevelIfRequired();
+ levels.current().setName(name);
+ levels.current().setNamespace(namespace);
+ int col = writePretty();
+ write('<');
+ if (namespace == null) {
+ write(name);
+ col = col + name.length()+1;
+ } else {
+ String n = getNSAbbreviation(namespace)+name;
+ write(n);
+ col = col + n.length()+1;
+ }
+ writeAttributes(col);
+ pendingOpen = false;
+ pendingClose = true;
+ pendingComment = comment;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#close(java.lang.String)
+ */
+ public void close(String name) throws IOException {
+ checkStarted();
+ if (levels.empty())
+ throw new IOException("Unable to close null|"+name+", nothing to close");
+ if (levels.current().getNamespace() != null || !levels.current().getName().equals(name))
+ throw new IOException("Unable to close null|"+name+", found "+levels.current().getNamespace()+"|"+levels.current().getName());
+ close();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#close(java.lang.String, java.lang.String)
+ */
+ public void close(String namespace, String name) throws IOException {
+ checkStarted();
+ if (levels.empty())
+ throw new IOException("Unable to close "+namespace+"|"+name+", nothing to close");
+ if (!levels.current().getNamespace().equals(namespace) || !levels.current().getName().equals(name))
+ throw new IOException("Unable to close "+namespace+"|"+name+", found "+levels.current().getNamespace()+"|"+levels.current().getName());
+ close();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#closeToLevel(int)
+ */
+ public void closeToLevel(int count) throws IOException {
+ while (levels.size() > count)
+ close();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#close()
+ */
+ public void close() throws IOException {
+ checkStarted();
+ if (levels.empty()) {
+ super.close();
+ } else {
+ if (pendingClose) {
+ write("/>");
+ writePendingComment();
+ pendingClose = false;
+ } else {
+ if (levels.current().hasChildren())
+ writePretty();
+ write("</");
+ if (levels.current().getNamespace() == null)
+ write(levels.current().getName());
+ else
+ write(getNSAbbreviation(levels.current().getNamespace())+levels.current().getName());
+ write('>');
+ }
+ levels.pop();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#open(java.lang.String)
+ */
+ public void open(String name) throws IOException {
+ open(null, name);
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#element(java.lang.String, java.lang.String, java.lang.String, boolean)
+ */
+ public void element(String namespace, String name, String content, boolean onlyIfNotEmpty) throws IOException {
+ if (!onlyIfNotEmpty || content != null && !content.equals(""))
+ element(namespace, name, content);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#element(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void element(String namespace, String name, String content, String comment) throws IOException {
+ if (!XMLUtil.isNMToken(name))
+ throw new IOException("XML name "+name+" is not valid");
+ open(namespace, name, comment);
+ text(content);
+ close();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#element(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void element(String namespace, String name, String content) throws IOException {
+ if (!XMLUtil.isNMToken(name))
+ throw new IOException("XML name "+name+" is not valid");
+ open(namespace, name);
+ text(content);
+ close();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#element(java.lang.String, java.lang.String, boolean)
+ */
+ public void element(String name, String content, boolean onlyIfNotEmpty) throws IOException {
+ if (!onlyIfNotEmpty || content != null && !content.equals(""))
+ element(null, name, content);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#element(java.lang.String, java.lang.String)
+ */
+ public void element(String name, String content) throws IOException {
+ element(null, name, content);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#text(java.lang.String)
+ */
+ public void text(String content) throws IOException {
+ text(content, false);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#text(java.lang.String, boolean)
+ *
+ * Replace escapeText()
+ */
+ public void text(String content, boolean dontEscape) throws IOException {
+ checkInElement();
+ if (content != null) {
+ if (pendingClose) {
+ write(">");
+ writePendingComment();
+ pendingClose = false;
+ }
+ if (dontEscape)
+ write(content);
+ else
+ write(XMLUtil.escapeXML(content, charset, false));
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#cData(java.lang.String)
+ */
+ public void cData(String text) throws IOException {
+ text("<![CDATA["+text+"]]>");
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#writeBytes(byte[])
+ */
+ public void writeBytes(byte[] bytes) throws IOException {
+ checkInElement();
+ if (pendingClose) {
+ write(">");
+ writePendingComment();
+ pendingClose = false;
+ }
+ flush();
+ stream.write(bytes);
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#isPretty()
+ */
+ public boolean isPretty() throws IOException {
+ return (levels == null || levels.empty()) ? prettyBase : levels.current().isPretty();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#setPretty(boolean)
+ */
+ public void setPretty(boolean pretty) throws IOException {
+ if (levels == null || levels.empty())
+ this.prettyBase = pretty;
+ else
+ levels.current().setPretty(pretty);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#startCommentBlock()
+ */
+ public void startCommentBlock() throws IOException {
+ if (levels.inComment())
+ throw new IOException("cannot nest comments");
+ levels.current().setInComment(true);
+ if (isPretty())
+ writePretty();
+ write("<!--");
+ if (isPretty())
+ writePretty();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ohf.utilities.xml.IXMLWriter#endCommentBlock()
+ */
+ public void endCommentBlock() throws IOException {
+ if (!levels.inComment())
+ throw new IOException("cannot close a comment block when it is open");
+ if (!levels.current().isInComment())
+ throw new IOException("cannot close a comment block when it is open");
+ if (isPretty())
+ writePretty();
+ write("-->");
+ if (isPretty())
+ writePretty();
+ levels.current().setInComment(false);
+ }
+
+ public boolean isSortAttributes() {
+ return sortAttributes;
+ }
+
+ public void setSortAttributes(boolean sortAttributes) {
+ this.sortAttributes = sortAttributes;
+ }
+
+
+ public boolean isPrettyHeader() {
+ return prettyHeader;
+ }
+
+ public void setPrettyHeader(boolean pretty) {
+ this.prettyHeader = pretty;
+ }
+
+ public int writePretty() throws IOException {
+ return writePretty(true);
+ }
+
+ public int writePretty(boolean eoln) throws IOException {
+ if (isPretty()) {
+ if (eoln)
+ write(lineType == LINE_UNIX ? "\n" : "\r\n");
+ for (int i = 0; i < levels.size() - 1; i++)
+ write(" ");
+ return (levels.size() - 1) * 2;
+ } else
+ return 0;
+ }
+
+ public int getLineType() {
+ return lineType;
+ }
+
+ public void setLineType(int lineType) {
+ this.lineType = lineType;
+ }
+
+ public boolean isXmlHeader() {
+ return xmlHeader;
+ }
+
+ public void setXmlHeader(boolean xmlHeader) {
+ this.xmlHeader = xmlHeader;
+ }
+
+ public String[] getSpecialAttributeNames() {
+ return specialAttributeNames;
+ }
+
+ public void setSpecialAttributeNames(String[] specialAttributeNames) {
+ this.specialAttributeNames = specialAttributeNames;
+ }
+
+ public int getAttributeLineWrap() {
+ return attributeLineWrap;
+ }
+
+ public void setAttributeLineWrap(int attributeLineWrap) {
+ this.attributeLineWrap = attributeLineWrap;
+ }
+
+ public void escapedText(String content) throws IOException {
+ text("");
+ int i = content.length();
+ if (isPretty())
+ while (i > 0 && (content.charAt(i-1) == '\r' || content.charAt(i-1) == '\n'))
+ i--;
+ write(content.substring(0, i));
+ }
+
+
+}
+
diff --git a/bundles/org.eclipse.uomo.xml/src/main/java/org/eclipse/uomo/xml/impl/XMLWriterStateStack.java b/bundles/org.eclipse.uomo.xml/src/main/java/org/eclipse/uomo/xml/impl/XMLWriterStateStack.java
index cd49566..c3c90f1 100644
--- a/bundles/org.eclipse.uomo.xml/src/main/java/org/eclipse/uomo/xml/impl/XMLWriterStateStack.java
+++ b/bundles/org.eclipse.uomo.xml/src/main/java/org/eclipse/uomo/xml/impl/XMLWriterStateStack.java
@@ -1,67 +1,67 @@
-/*******************************************************************************
- * 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.xml.impl;
-
-import java.io.IOException;
-import java.util.Vector;
-
-
-class XMLWriterStateStack {
-
- private Vector<XMLWriterState> items = new Vector<XMLWriterState>();
-
- public int size(){
- return items.size();
- }
-
- public boolean empty(){
- return items.size() == 0;
- }
-
- public XMLWriterState current() throws IOException {
- if (empty())
- throw new IOException("stack is empty trying to get current");
- return (XMLWriterState)items.get(items.size() - 1);
- }
-
-
- public void push(XMLWriterState element) {
- items.add(element);
- }
-
- public void clear () {
- if (items != null)
- items.clear();
- }
-
- public void pop() throws IOException {
- if (empty())
- throw new IOException("stack is empty trying to pop");
- if (current().isInComment())
- throw new IOException("Must close a comment sequence in the element in which it was started");
-
- items.remove(items.size() - 1);
- }
-
- public XMLWriterState item(int index) {
- return (XMLWriterState)items.get(index);
- }
-
- public boolean inComment() {
- for (int i = 0; i < items.size(); i++) {
- if (((XMLWriterState)items.get(i)).isInComment())
- return true;
- }
- return false;
- }
-
-}
+/*******************************************************************************
+ * 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.xml.impl;
+
+import java.io.IOException;
+import java.util.Vector;
+
+
+class XMLWriterStateStack {
+
+ private Vector<XMLWriterState> items = new Vector<XMLWriterState>();
+
+ public int size(){
+ return items.size();
+ }
+
+ public boolean empty(){
+ return items.size() == 0;
+ }
+
+ public XMLWriterState current() throws IOException {
+ if (empty())
+ throw new IOException("stack is empty trying to get current");
+ return (XMLWriterState)items.get(items.size() - 1);
+ }
+
+
+ public void push(XMLWriterState element) {
+ items.add(element);
+ }
+
+ public void clear () {
+ if (items != null)
+ items.clear();
+ }
+
+ public void pop() throws IOException {
+ if (empty())
+ throw new IOException("stack is empty trying to pop");
+ if (current().isInComment())
+ throw new IOException("Must close a comment sequence in the element in which it was started");
+
+ items.remove(items.size() - 1);
+ }
+
+ public XMLWriterState item(int index) {
+ return (XMLWriterState)items.get(index);
+ }
+
+ public boolean inComment() {
+ for (int i = 0; i < items.size(); i++) {
+ if (((XMLWriterState)items.get(i)).isInComment())
+ return true;
+ }
+ return false;
+ }
+
+}
diff --git a/bundles/pom.xml b/bundles/pom.xml
index db800e0..9b57053 100644
--- a/bundles/pom.xml
+++ b/bundles/pom.xml
@@ -1,28 +1,28 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>org.eclipse.uomo</artifactId>
- <groupId>org.eclipse.uomo</groupId>
- <version>0.7.0-SNAPSHOT</version>
- </parent>
- <artifactId>org.eclipse.uomo.bundles</artifactId>
- <name>Eclipse UOMo Bundles</name>
- <packaging>pom</packaging>
- <modules>
- <module>org.eclipse.uomo.core</module>
- <module>org.eclipse.uomo.core.tests</module>
- <module>org.eclipse.uomo.units</module>
- <module>org.eclipse.uomo.units.tests</module>
- <module>org.eclipse.uomo.xml</module>
- <module>org.eclipse.uomo.xml.tests</module>
- <module>org.eclipse.uomo.util</module>
- <module>org.eclipse.uomo.util.tests</module>
- <module>org.eclipse.uomo.ucum</module>
- <module>org.eclipse.uomo.ucum.tests</module>
- <module>org.eclipse.uomo.business</module>
- <module>org.eclipse.uomo.ui</module>
- <!-- <module>org.eclipse.uomo.business.tests</module>-->
- </modules>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>org.eclipse.uomo</artifactId>
+ <groupId>org.eclipse.uomo</groupId>
+ <version>0.7.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.uomo.bundles</artifactId>
+ <name>Eclipse UOMo Bundles</name>
+ <packaging>pom</packaging>
+ <modules>
+ <module>org.eclipse.uomo.core</module>
+ <module>org.eclipse.uomo.core.tests</module>
+ <module>org.eclipse.uomo.units</module>
+ <module>org.eclipse.uomo.units.tests</module>
+ <module>org.eclipse.uomo.xml</module>
+ <module>org.eclipse.uomo.xml.tests</module>
+ <module>org.eclipse.uomo.util</module>
+ <module>org.eclipse.uomo.util.tests</module>
+ <module>org.eclipse.uomo.ucum</module>
+ <module>org.eclipse.uomo.ucum.tests</module>
+ <module>org.eclipse.uomo.business</module>
+ <module>org.eclipse.uomo.ui</module>
+ <!-- <module>org.eclipse.uomo.business.tests</module>-->
+ </modules>
</project>
\ No newline at end of file
diff --git a/examples/business/.project b/examples/business/.project
new file mode 100644
index 0000000..152554a
--- /dev/null
+++ b/examples/business/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.uomo.examples.business</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ </natures>
+</projectDescription>
diff --git a/examples/business/org.eclipse.uomo.examples.business.console/.classpath b/examples/business/org.eclipse.uomo.examples.business.console/.classpath
index 63cc387..6a6c8e3 100644
--- a/examples/business/org.eclipse.uomo.examples.business.console/.classpath
+++ b/examples/business/org.eclipse.uomo.examples.business.console/.classpath
@@ -1,31 +1,31 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" output="target/classes" path="src/main/java">
- <attributes>
- <attribute name="optional" value="true"/>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="src" output="target/test-classes" path="src/test/java">
- <attributes>
- <attribute name="optional" value="true"/>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/examples/business/org.eclipse.uomo.examples.business.console/pom.xml b/examples/business/org.eclipse.uomo.examples.business.console/pom.xml
index 38a7c4c..2203c39 100644
--- a/examples/business/org.eclipse.uomo.examples.business.console/pom.xml
+++ b/examples/business/org.eclipse.uomo.examples.business.console/pom.xml
@@ -1,56 +1,56 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.eclipse.uomo.examples.business</groupId>
- <artifactId>org.eclipse.uomo.examples.business</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- </parent>
- <artifactId>org.eclipse.uomo.examples.business.console</artifactId>
-
- <dependencies>
- <dependency>
- <groupId>org.unitsofmeasurement</groupId>
- <artifactId>unit-api</artifactId>
- <version>0.6.1</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.uomo</groupId>
- <artifactId>org.eclipse.uomo.units</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.uomo</groupId>
- <artifactId>org.eclipse.uomo.business</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.8.1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-all</artifactId>
- <version>1.1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.uomo</groupId>
- <artifactId>org.eclipse.uomo.core</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>com.ibm.icu</groupId>
- <artifactId>icu4j</artifactId>
- <version>50.1.1</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse</groupId>
- <artifactId>osgi</artifactId>
- <version>3.5.0.v20090520</version>
- </dependency>
- </dependencies>
- <name>UOMo Business Console Examples</name>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.uomo.examples.business</groupId>
+ <artifactId>org.eclipse.uomo.examples.business</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.uomo.examples.business.console</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.unitsofmeasurement</groupId>
+ <artifactId>unit-api</artifactId>
+ <version>0.6.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.uomo</groupId>
+ <artifactId>org.eclipse.uomo.units</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.uomo</groupId>
+ <artifactId>org.eclipse.uomo.business</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-all</artifactId>
+ <version>1.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.uomo</groupId>
+ <artifactId>org.eclipse.uomo.core</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>com.ibm.icu</groupId>
+ <artifactId>icu4j</artifactId>
+ <version>50.1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse</groupId>
+ <artifactId>osgi</artifactId>
+ <version>3.5.0.v20090520</version>
+ </dependency>
+ </dependencies>
+ <name>UOMo Business Console Examples</name>
</project>
\ No newline at end of file
diff --git a/examples/pom.xml b/examples/pom.xml
index 1b1f2cd..1acf98c 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -1,35 +1,35 @@
-<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">
- <parent>
- <artifactId>org.eclipse.uomo</artifactId>
- <groupId>org.eclipse.uomo</groupId>
- <version>0.7.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.eclipse.uomo.examples</artifactId>
- <packaging>pom</packaging>
- <name>Eclipse UOMo Examples</name>
- <build>
- <plugins>
- <!-- ======================================================= -->
- <!-- Compilation -->
- <!-- ======================================================= -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>${maven.compilerPlugin.version}</version>
- <configuration>
- <source>${project.build.javaVersion}</source>
- <target>${project.build.javaVersion}</target>
- <encoding>${project.build.sourceEncoding}</encoding>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <modules>
- <module>business</module>
- <module>units</module>
- </modules>
-<!-- modules> <module>org.eclipse.uomo.test</module> </modules -->
+<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">
+ <parent>
+ <artifactId>org.eclipse.uomo</artifactId>
+ <groupId>org.eclipse.uomo</groupId>
+ <version>0.7.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.eclipse.uomo.examples</artifactId>
+ <packaging>pom</packaging>
+ <name>Eclipse UOMo Examples</name>
+ <build>
+ <plugins>
+ <!-- ======================================================= -->
+ <!-- Compilation -->
+ <!-- ======================================================= -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${maven.compilerPlugin.version}</version>
+ <configuration>
+ <source>${project.build.javaVersion}</source>
+ <target>${project.build.javaVersion}</target>
+ <encoding>${project.build.sourceEncoding}</encoding>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <modules>
+ <module>business</module>
+ <module>units</module>
+ </modules>
+<!-- modules> <module>org.eclipse.uomo.test</module> </modules -->
</project>
\ No newline at end of file
diff --git a/examples/units/.project b/examples/units/.project
index 0502e80..ea8a7db 100644
--- a/examples/units/.project
+++ b/examples/units/.project
@@ -1,17 +1,17 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.uomo.examples.units</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.m2e.core.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.m2e.core.maven2Nature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.uomo.examples.units</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ </natures>
+</projectDescription>
diff --git a/examples/units/org.eclipse.uomo.examples.units.android/player/.project b/examples/units/org.eclipse.uomo.examples.units.android/player/.project
index ae08877..06bd759 100644
--- a/examples/units/org.eclipse.uomo.examples.units.android/player/.project
+++ b/examples/units/org.eclipse.uomo.examples.units.android/player/.project
@@ -1,39 +1,39 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>player</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>com.android.ide.eclipse.adt.ApkBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.m2e.core.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>com.android.ide.eclipse.adt.AndroidNature</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>player</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.ApkBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ </natures>
+</projectDescription>
diff --git a/examples/units/org.eclipse.uomo.examples.units.android/web/.classpath b/examples/units/org.eclipse.uomo.examples.units.android/web/.classpath
index 806c814..5e745f7 100644
--- a/examples/units/org.eclipse.uomo.examples.units.android/web/.classpath
+++ b/examples/units/org.eclipse.uomo.examples.units.android/web/.classpath
@@ -1,28 +1,28 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" output="target/classes" path="src/main/java">
- <attributes>
- <attribute name="optional" value="true"/>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.jboss.ide.eclipse.as.core.server.runtime.runtimeTarget/JBoss 7.0 Runtime"/>
- <classpathentry kind="src" output="target/test-classes" path="src/test/java">
- <attributes>
- <attribute name="optional" value="true"/>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
- <attributes>
- <attribute name="owner.project.facets" value="java"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.jboss.ide.eclipse.as.core.server.runtime.runtimeTarget/JBoss 7.0 Runtime"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/examples/units/org.eclipse.uomo.examples.units.android/web/.project b/examples/units/org.eclipse.uomo.examples.units.android/web/.project
index d8bd967..e13faeb 100644
--- a/examples/units/org.eclipse.uomo.examples.units.android/web/.project
+++ b/examples/units/org.eclipse.uomo.examples.units.android/web/.project
@@ -1,48 +1,48 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>web</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
- <arguments>
- </arguments>
- </buildCommand>
- <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.jboss.tools.ws.jaxrs.metamodelBuilder</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>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.m2e.core.maven2Nature</nature>
- <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
- <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
- <nature>org.jboss.tools.ws.jaxrs.nature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>web</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <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.jboss.tools.ws.jaxrs.metamodelBuilder</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>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
+ <nature>org.jboss.tools.ws.jaxrs.nature</nature>
+ </natures>
+</projectDescription>
diff --git a/examples/units/org.eclipse.uomo.examples.units.android/web/.settings/.jsdtscope b/examples/units/org.eclipse.uomo.examples.units.android/web/.settings/.jsdtscope
index fac399c..b46b920 100644
--- a/examples/units/org.eclipse.uomo.examples.units.android/web/.settings/.jsdtscope
+++ b/examples/units/org.eclipse.uomo.examples.units.android/web/.settings/.jsdtscope
@@ -1,12 +1,12 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src/main/webapp"/>
- <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
- <attributes>
- <attribute name="hide" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
- <classpathentry kind="output" path=""/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/main/webapp"/>
+ <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
+ <attributes>
+ <attribute name="hide" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
+ <classpathentry kind="output" path=""/>
+</classpath>
diff --git a/examples/units/org.eclipse.uomo.examples.units.android/web/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml b/examples/units/org.eclipse.uomo.examples.units.android/web/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml
index b01fdb7..cc81385 100644
--- a/examples/units/org.eclipse.uomo.examples.units.android/web/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml
+++ b/examples/units/org.eclipse.uomo.examples.units.android/web/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml
@@ -1,7 +1,7 @@
-<root>
- <facet id="jst.jaxrs">
- <node name="libprov">
- <attribute name="provider-id" value="jaxrs-no-op-library-provider"/>
- </node>
- </facet>
-</root>
+<root>
+ <facet id="jst.jaxrs">
+ <node name="libprov">
+ <attribute name="provider-id" value="jaxrs-no-op-library-provider"/>
+ </node>
+ </facet>
+</root>
diff --git a/examples/units/org.eclipse.uomo.examples.units.console/.classpath b/examples/units/org.eclipse.uomo.examples.units.console/.classpath
index ab2b25d..ea2b731 100644
--- a/examples/units/org.eclipse.uomo.examples.units.console/.classpath
+++ b/examples/units/org.eclipse.uomo.examples.units.console/.classpath
@@ -1,37 +1,37 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" output="target/classes" path="src/main/java">
- <attributes>
- <attribute name="optional" value="true"/>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="src" output="target/test-classes" path="src/test/java">
- <attributes>
- <attribute name="optional" value="true"/>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/examples/units/org.eclipse.uomo.examples.units.console/src/etc/org.eclipse.uomo.examples.units.console.launch b/examples/units/org.eclipse.uomo.examples.units.console/src/etc/org.eclipse.uomo.examples.units.console.launch
index 3ca885e..372196f 100644
--- a/examples/units/org.eclipse.uomo.examples.units.console/src/etc/org.eclipse.uomo.examples.units.console.launch
+++ b/examples/units/org.eclipse.uomo.examples.units.console/src/etc/org.eclipse.uomo.examples.units.console.launch
@@ -1,21 +1,21 @@
-<?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.examples.units.console"/>
-</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.examples.units.console"/>
-<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.examples.units.console"/>
-<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-DconsoleOutput=true"/>
-</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.examples.units.console"/>
+</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.examples.units.console"/>
+<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.examples.units.console"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-DconsoleOutput=true"/>
+</launchConfiguration>
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 59929d9..332e920 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
@@ -1,20 +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);
- }
-
-}
+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/console/sandbox/HealthExamples.java b/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/console/sandbox/HealthExamples.java
index fd69592..8f6d2fa 100644
--- a/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/console/sandbox/HealthExamples.java
+++ b/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/console/sandbox/HealthExamples.java
@@ -1,45 +1,45 @@
-/**
- * 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.console.sandbox;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.uomo.examples.units.types.Health;
-import org.eclipse.uomo.examples.units.types.HeartRate;
-import org.eclipse.uomo.examples.units.types.HeartRateAmount;
-import org.eclipse.uomo.units.IMeasure;
-
-/**
- * @author Werner Keil
- * @version 0.1
- */
-public class HealthExamples {
-
- /**
- * @param args
- */
- public static void main(String[] args) {
- List<IMeasure<HeartRate>> rates = new LinkedList<IMeasure<HeartRate>>();
- int value = 0;
- for (int i=0; i<50; i++) {
- value = (int) (Math.random() * 40 + 50);
-
- IMeasure<HeartRate> rate = new HeartRateAmount(value, Health.BPM);
- rates.add(rate);
- }
-
- for (IMeasure<HeartRate> r : rates) {
- System.out.println("Rate: " + r);
- }
- }
-
-}
+/**
+ * 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.console.sandbox;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.uomo.examples.units.types.Health;
+import org.eclipse.uomo.examples.units.types.HeartRate;
+import org.eclipse.uomo.examples.units.types.HeartRateAmount;
+import org.eclipse.uomo.units.IMeasure;
+
+/**
+ * @author Werner Keil
+ * @version 0.1
+ */
+public class HealthExamples {
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+ List<IMeasure<HeartRate>> rates = new LinkedList<IMeasure<HeartRate>>();
+ int value = 0;
+ for (int i=0; i<50; i++) {
+ value = (int) (Math.random() * 40 + 50);
+
+ IMeasure<HeartRate> rate = new HeartRateAmount(value, Health.BPM);
+ rates.add(rate);
+ }
+
+ for (IMeasure<HeartRate> r : rates) {
+ System.out.println("Rate: " + r);
+ }
+ }
+
+}
diff --git a/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/console/sandbox/KawaExample.java b/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/console/sandbox/KawaExample.java
index b3ef9d3..69ae5b6 100644
--- a/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/console/sandbox/KawaExample.java
+++ b/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/console/sandbox/KawaExample.java
@@ -1,35 +1,35 @@
-package org.eclipse.uomo.examples.units.console.sandbox;
-
-import org.eclipse.uomo.units.IMeasure;
-import org.eclipse.uomo.units.SI;
-import org.eclipse.uomo.units.impl.quantity.LengthAmount;
-import org.eclipse.uomo.units.impl.quantity.MassAmount;
-import org.unitsofmeasurement.quantity.Length;
-import org.unitsofmeasurement.quantity.Mass;
-import org.unitsofmeasurement.quantity.Quantity;
-import org.unitsofmeasurement.unit.Unit;
-
-
-public class KawaExample {
-
- /**
- * @param args
- */
- public static void main(String[] args) {
- Unit<Length> m = SI.METRE;
- Unit<Mass> g = SI.GRAM;
-
- Unit<?> result = g.multiply(m);
- System.out.println(result);
-
- IMeasure<Length> q1 = new LengthAmount(1, m);
- System.out.println(q1);
- IMeasure<Mass> q2 = new MassAmount(1, g);
- System.out.println(q2);
- Quantity<?> q3 = q1.multiply(q2);
- System.out.println(q3);
-// Quantity<Length> q4 = q1.add(q2); // this fails at compile time, not at runtime
-// System.out.println(q4);
- }
-
-}
+package org.eclipse.uomo.examples.units.console.sandbox;
+
+import org.eclipse.uomo.units.IMeasure;
+import org.eclipse.uomo.units.SI;
+import org.eclipse.uomo.units.impl.quantity.LengthAmount;
+import org.eclipse.uomo.units.impl.quantity.MassAmount;
+import org.unitsofmeasurement.quantity.Length;
+import org.unitsofmeasurement.quantity.Mass;
+import org.unitsofmeasurement.quantity.Quantity;
+import org.unitsofmeasurement.unit.Unit;
+
+
+public class KawaExample {
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+ Unit<Length> m = SI.METRE;
+ Unit<Mass> g = SI.GRAM;
+
+ Unit<?> result = g.multiply(m);
+ System.out.println(result);
+
+ IMeasure<Length> q1 = new LengthAmount(1, m);
+ System.out.println(q1);
+ IMeasure<Mass> q2 = new MassAmount(1, g);
+ System.out.println(q2);
+ Quantity<?> q3 = q1.multiply(q2);
+ System.out.println(q3);
+// Quantity<Length> q4 = q1.add(q2); // this fails at compile time, not at runtime
+// System.out.println(q4);
+ }
+
+}
diff --git a/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/console/sandbox/ObsoleteUnitsExample.java b/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/console/sandbox/ObsoleteUnitsExample.java
index 3cefc34..6e4a2a0 100644
--- a/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/console/sandbox/ObsoleteUnitsExample.java
+++ b/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/console/sandbox/ObsoleteUnitsExample.java
@@ -1,44 +1,44 @@
-/**
- * Copyright (c) 2012, 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.console.sandbox;
-
-import static org.eclipse.uomo.examples.units.types.GermanObsolete.*;
-import static org.eclipse.uomo.units.impl.system.USCustomary.FOOT;
-import static org.eclipse.uomo.units.SI.*;
-
-import org.eclipse.uomo.examples.units.types.PolishObsolete;
-import org.eclipse.uomo.units.IMeasure;
-import org.eclipse.uomo.units.impl.BaseAmount;
-import org.unitsofmeasurement.quantity.Length;
-
-/**
- * @author Werner Keil
- *
- */
-public class ObsoleteUnitsExample {
-
- /**
- * @param args
- */
- @SuppressWarnings("deprecation")
- public static void main(String[] args) {
- IMeasure<Length> l = BaseAmount.valueOf(10, METRE);
- System.out.println(l);
- System.out.println(l.to(FOOT));
- System.out.println(l.to(FOOT_ZURICH));
- System.out.println(l.to(STONE_FOOT));
- System.out.println(l.to(FOOT_LAUSANNE));
- System.out.println(l.to(ELL_NORTH));
- System.out.println(l.to(ELL_SOUTH));
- System.out.println(l.to(PolishObsolete.ELL));
- }
-
-}
+/**
+ * Copyright (c) 2012, 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.console.sandbox;
+
+import static org.eclipse.uomo.examples.units.types.GermanObsolete.*;
+import static org.eclipse.uomo.units.impl.system.USCustomary.FOOT;
+import static org.eclipse.uomo.units.SI.*;
+
+import org.eclipse.uomo.examples.units.types.PolishObsolete;
+import org.eclipse.uomo.units.IMeasure;
+import org.eclipse.uomo.units.impl.BaseAmount;
+import org.unitsofmeasurement.quantity.Length;
+
+/**
+ * @author Werner Keil
+ *
+ */
+public class ObsoleteUnitsExample {
+
+ /**
+ * @param args
+ */
+ @SuppressWarnings("deprecation")
+ public static void main(String[] args) {
+ IMeasure<Length> l = BaseAmount.valueOf(10, METRE);
+ System.out.println(l);
+ System.out.println(l.to(FOOT));
+ System.out.println(l.to(FOOT_ZURICH));
+ System.out.println(l.to(STONE_FOOT));
+ System.out.println(l.to(FOOT_LAUSANNE));
+ System.out.println(l.to(ELL_NORTH));
+ System.out.println(l.to(ELL_SOUTH));
+ System.out.println(l.to(PolishObsolete.ELL));
+ }
+
+}
diff --git a/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/console/sandbox/TemperatureExample.java b/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/console/sandbox/TemperatureExample.java
index a813e53..9c3fd4a 100644
--- a/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/console/sandbox/TemperatureExample.java
+++ b/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/console/sandbox/TemperatureExample.java
@@ -1,36 +1,36 @@
-/**
- * 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 - initial API and implementation
- */
-package org.eclipse.uomo.examples.units.console.sandbox;
-
-import org.eclipse.uomo.units.AbstractQuantity;
-import org.eclipse.uomo.units.SI;
-import org.eclipse.uomo.units.impl.quantity.TemperatureAmount;
-import org.eclipse.uomo.units.impl.system.USCustomary;
-import org.unitsofmeasurement.quantity.Temperature;
-
-/**
- * @author Werner Keil
- * @version 1.1
- *
- */
-public class TemperatureExample {
-
- /**
- * @param args
- */
- public static void main(String[] args) {
- TemperatureAmount temp1 = new TemperatureAmount(0, SI.CELSIUS);
- AbstractQuantity<Temperature> temp2 = temp1.to(SI.KELVIN);
- AbstractQuantity<Temperature> temp3 = temp1.to(USCustomary.FAHRENHEIT);
- System.out.println(temp1 + " -> " + temp2 + " -> " + temp3);
- }
-
-}
+/**
+ * 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 - initial API and implementation
+ */
+package org.eclipse.uomo.examples.units.console.sandbox;
+
+import org.eclipse.uomo.units.AbstractQuantity;
+import org.eclipse.uomo.units.SI;
+import org.eclipse.uomo.units.impl.quantity.TemperatureAmount;
+import org.eclipse.uomo.units.impl.system.USCustomary;
+import org.unitsofmeasurement.quantity.Temperature;
+
+/**
+ * @author Werner Keil
+ * @version 1.1
+ *
+ */
+public class TemperatureExample {
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+ TemperatureAmount temp1 = new TemperatureAmount(0, SI.CELSIUS);
+ AbstractQuantity<Temperature> temp2 = temp1.to(SI.KELVIN);
+ AbstractQuantity<Temperature> temp3 = temp1.to(USCustomary.FAHRENHEIT);
+ System.out.println(temp1 + " -> " + temp2 + " -> " + temp3);
+ }
+
+}
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
index 9f8be84..6f4e8c5 100644
--- 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
@@ -1,93 +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();
- }
+/**
+ * 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
index 276cae7..957c4b8 100644
--- 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
@@ -1,96 +1,96 @@
-/**
- * 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.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();
- }
+/**
+ * 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.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/resources/org/eclipse/uomo/examples/units/types/messages.properties b/examples/units/org.eclipse.uomo.examples.units.console/src/main/resources/org/eclipse/uomo/examples/units/types/messages.properties
index a5a1ce1..e4210f9 100644
--- a/examples/units/org.eclipse.uomo.examples.units.console/src/main/resources/org/eclipse/uomo/examples/units/types/messages.properties
+++ b/examples/units/org.eclipse.uomo.examples.units.console/src/main/resources/org/eclipse/uomo/examples/units/types/messages.properties
@@ -1,21 +1,21 @@
-#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
-#
-
-Planet_Radius = Radius:
-
-Planet_SurfaceWeight = Surface Weight:
-
-Planet_SurfaceGravity = Surface Gravity:
-
-Planet_Usage = Usage
-
+#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
+#
+
+Planet_Radius = Radius:
+
+Planet_SurfaceWeight = Surface Weight:
+
+Planet_SurfaceGravity = Surface Gravity:
+
+Planet_Usage = Usage
+
BEAT = b
\ No newline at end of file
diff --git a/examples/units/org.eclipse.uomo.examples.units.pluginsample/build.properties b/examples/units/org.eclipse.uomo.examples.units.pluginsample/build.properties
index ec21ee7..80bc250 100644
--- a/examples/units/org.eclipse.uomo.examples.units.pluginsample/build.properties
+++ b/examples/units/org.eclipse.uomo.examples.units.pluginsample/build.properties
@@ -1,6 +1,6 @@
-source.. = src/main/java/,\
- src/main/resources/,\
- src/test/java/,\
- src/test/resources/
-bin.includes = META-INF/,\
- .
+source.. = src/main/java/,\
+ src/main/resources/,\
+ src/test/java/,\
+ src/test/resources/
+bin.includes = META-INF/,\
+ .
diff --git a/examples/units/org.eclipse.uomo.examples.units.pluginsample/pom.xml b/examples/units/org.eclipse.uomo.examples.units.pluginsample/pom.xml
index 37bc23c..21931d2 100644
--- a/examples/units/org.eclipse.uomo.examples.units.pluginsample/pom.xml
+++ b/examples/units/org.eclipse.uomo.examples.units.pluginsample/pom.xml
@@ -1,32 +1,32 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>org.eclipse.uomo.examples.units</artifactId>
- <groupId>org.eclipse.uomo.examples</groupId>
- <version>0.1.0.SNAPSHOT</version>
- </parent>
- <artifactId>org.eclipse.uomo.examples.units.pluginsample</artifactId>
- <name>UOMo Units Plugin Sample</name>
- <dependencies>
- <dependency>
- <groupId>org.eclipse.uomo</groupId>
- <artifactId>org.eclipse.uomo.core</artifactId>
- <version>0.2.0.SNAPSHOT</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.unitsofmeasurement</groupId>
- <artifactId>unit-api</artifactId>
- <version>0.6.1</version>
- <type>bundle</type>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.uomo</groupId>
- <artifactId>org.eclipse.uomo.units</artifactId>
- <version>0.7.0.SNAPSHOT</version>
- <type>jar</type>
- <scope>compile</scope>
- </dependency>
- </dependencies>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>org.eclipse.uomo.examples.units</artifactId>
+ <groupId>org.eclipse.uomo.examples</groupId>
+ <version>0.1.0.SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.uomo.examples.units.pluginsample</artifactId>
+ <name>UOMo Units Plugin Sample</name>
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse.uomo</groupId>
+ <artifactId>org.eclipse.uomo.core</artifactId>
+ <version>0.2.0.SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.unitsofmeasurement</groupId>
+ <artifactId>unit-api</artifactId>
+ <version>0.6.1</version>
+ <type>bundle</type>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.uomo</groupId>
+ <artifactId>org.eclipse.uomo.units</artifactId>
+ <version>0.7.0.SNAPSHOT</version>
+ <type>jar</type>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
</project>
\ No newline at end of file
diff --git a/features/org.eclipse.uomo.feature/.project b/features/org.eclipse.uomo.feature/.project
index 09dd5a1..2511082 100644
--- a/features/org.eclipse.uomo.feature/.project
+++ b/features/org.eclipse.uomo.feature/.project
@@ -1,41 +1,41 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.uomo.feature</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.maven.ide.eclipse.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.FeatureBuilder</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.jdt.core.javanature</nature>
- <nature>org.maven.ide.eclipse.maven2Nature</nature>
- <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
- <nature>org.eclipse.pde.FeatureNature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.uomo.feature</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.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</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.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
diff --git a/features/pom.xml b/features/pom.xml
index ae69d95..d8f9848 100644
--- a/features/pom.xml
+++ b/features/pom.xml
@@ -1,14 +1,14 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>org.eclipse.uomo</artifactId>
- <groupId>org.eclipse.uomo</groupId>
- <version>0.7.0-SNAPSHOT</version>
- </parent>
- <artifactId>org.eclipse.uomo.features</artifactId>
- <name>Eclipse UOMo Features</name>
- <packaging>pom</packaging>
- <modules>
- <module>org.eclipse.uomo.feature</module>
- </modules>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>org.eclipse.uomo</artifactId>
+ <groupId>org.eclipse.uomo</groupId>
+ <version>0.7.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.uomo.features</artifactId>
+ <name>Eclipse UOMo Features</name>
+ <packaging>pom</packaging>
+ <modules>
+ <module>org.eclipse.uomo.feature</module>
+ </modules>
</project>
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 51d433d..ea762e1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,202 +1,202 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- =======================================================================
- Maven Project Configuration File Eclipse UOMo http://www.eclipse.org/proposals/uomo/
- ======================================================================= -->
-
-<!-- $Id: pom.xml 306 2012-10-29 20:42:27Z werner.keil $ -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>eclipse-parent</artifactId>
- <groupId>org.eclipse</groupId>
- <version>1.0.0</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <properties>
- <sourceEncoding>UTF-8</sourceEncoding> <!-- in Maven 3. -->
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.build.javaVersion>1.6</project.build.javaVersion>
- <maven.compilerPlugin.version>2.3.2</maven.compilerPlugin.version>
- <tycho-version>0.16.0</tycho-version>
- <icu4j-version>50.1.1</icu4j-version>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
- <site.basedir>${project.basedir}</site.basedir>
- </properties>
-
- <groupId>org.eclipse.uomo</groupId>
- <artifactId>org.eclipse.uomo</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- <packaging>pom</packaging>
- <name>Eclipse UOMo</name>
-
- <!-- =========================================================== -->
- <!-- Developers and Contributors -->
- <!-- =========================================================== -->
- <description>UOMo adds Units of Measurement support for IT Systems and Services both to Language and Data.</description>
- <url>http://www.eclipse.org/uomo/</url>
- <issueManagement>
- <system>Bugzilla</system>
- <url>https://bugs.eclipse.org/bugs/</url>
- </issueManagement>
- <inceptionYear>2010</inceptionYear>
- <developers>
- <developer>
- <name>Werner Keil</name>
- <id>wkeil</id>
- <organization>Creative Arts & Technologies</organization>
- <organizationUrl>http://www.catmedia.us</organizationUrl>
- <email>werner.keil@gmx.net</email>
- <timezone>0</timezone>
- <roles>
- <role>Project Lead</role>
- <role>Architect</role>
- <role>Java Developer</role>
- </roles>
- </developer>
- <developer>
- <name>Chris Senior</name>
- <id>csenior</id>
- <email>christopher.senior@gmail.com</email>
- <organization>Private Individual</organization>
- <roles>
- <role>Architect</role>
- <role>Java Developer</role>
- </roles>
- </developer>
- </developers>
- <contributors>
- <contributor>
- <name>Grahame Grieve</name>
- <!-- id>grahameg</id -->
- <email>grahame@healthintersections.com.au</email>
- <organization>Health Intersections</organization>
- <organizationUrl>http://www.healthintersections.com.au</organizationUrl>
- <roles>
- <role>UCUM Lead</role>
- <role>Architect</role>
- <role>Java Developer (inactive)</role>
- </roles>
- </contributor>
-
- </contributors>
- <scm>
- <url>http://git.eclipse.org/c/uomo/org.eclipse.uomo.git/</url>
- </scm>
- <organization>
- <name>Eclipse Foundation</name>
- <url>http://www.eclipse.org</url>
- </organization>
- <modules>
- <module>bundles</module>
- <module>features</module>
- <module>examples</module>
- <module>releng</module>
- </modules>
- <!-- ======================================================= -->
- <!-- Build Settings -->
- <!-- ======================================================= -->
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-resources-plugin</artifactId>
- <version>2.5</version>
- <executions>
- <execution>
- <id>copy-sitedescriptor</id>
- <!-- fetch site.xml before creating site documentation -->
- <phase>pre-site</phase>
- <goals>
- <goal>copy-resources</goal>
- </goals>
- <configuration>
- <outputDirectory>${basedir}/src/site/</outputDirectory>
- <resources>
- <resource>
- <directory>${site.basedir}/src/site/</directory>
- <includes>
- <include>**/site.xml</include>
- </includes>
- </resource>
- </resources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <!-- This sets up the target platform in PDE terms The version of Eclipse
- that the source will be built against -->
- <groupId>org.eclipse.tycho</groupId>
- <artifactId>target-platform-configuration</artifactId>
- <version>${tycho-version}</version>
- <configuration>
- <resolver>p2</resolver>
- <target>
- <artifact>
- <groupId>org.eclipse.uomo</groupId>
- <artifactId>org.eclipse.uomo.target</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- <classifier>indigo</classifier>
- </artifact>
- </target>
- <ignoreTychoRepositories>true</ignoreTychoRepositories>
- <environments>
- <environment>
- <os>win32</os>
- <ws>win32</ws>
- <arch>x86</arch>
- </environment>
- <environment>
- <os>linux</os>
- <ws>gtk</ws>
- <arch>x86</arch>
- </environment>
- </environments>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.eclipse.tycho</groupId>
- <artifactId>tycho-maven-plugin</artifactId>
- <version>${tycho-version}</version>
- <extensions>true</extensions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>2.4</version>
- </plugin>
- <!-- <plugin> <groupId>org.sonatype.tycho</groupId> <artifactId>maven-osgi-packaging-plugin</artifactId>
- <version>${tycho-version}</version> <configuration> <archive> <addMavenDescriptor>false</addMavenDescriptor>
- </archive> </configuration> </plugin> -->
- </plugins>
- </build>
-
-
- <!-- ==================================================== -->
- <!-- Repositories. This is where Maven looks for dependencies. The Maven
- repository is implicit and doesn't need to be specified. -->
- <!-- ==================================================== -->
- <repositories>
- <repository>
- <id>eclipse-public</id>
- <name>Public Eclipse.org Nexus</name>
- <url>http://maven.eclipse.org/nexus/content/groups/public/</url>
- </repository>
-
- <repository>
- <id>eclipse-central</id>
- <name>Central Eclipse.org Nexus</name>
- <url>http://maven.eclipse.org/nexus/content/groups/central/</url>
- </repository>
-
- <repository>
- <id>maven-geotoolkit.org</id>
- <name>GeoToolkit Repository for Maven</name>
- <url>http://maven.geotoolkit.org/</url>
- </repository>
- </repositories>
- <ciManagement>
- <system>Hudson</system>
- <url>https://hudson.eclipse.org/hudson/job/uomo/</url>
- </ciManagement>
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- =======================================================================
+ Maven Project Configuration File Eclipse UOMo http://www.eclipse.org/proposals/uomo/
+ ======================================================================= -->
+
+<!-- $Id: pom.xml 306 2012-10-29 20:42:27Z werner.keil $ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>eclipse-parent</artifactId>
+ <groupId>org.eclipse</groupId>
+ <version>1.0.0</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <properties>
+ <sourceEncoding>UTF-8</sourceEncoding> <!-- in Maven 3. -->
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.build.javaVersion>1.6</project.build.javaVersion>
+ <maven.compilerPlugin.version>2.3.2</maven.compilerPlugin.version>
+ <tycho-version>0.16.0</tycho-version>
+ <icu4j-version>52.1</icu4j-version>
+ <maven.compiler.source>1.6</maven.compiler.source>
+ <maven.compiler.target>1.6</maven.compiler.target>
+ <site.basedir>${project.basedir}</site.basedir>
+ </properties>
+
+ <groupId>org.eclipse.uomo</groupId>
+ <artifactId>org.eclipse.uomo</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Eclipse UOMo</name>
+
+ <!-- =========================================================== -->
+ <!-- Developers and Contributors -->
+ <!-- =========================================================== -->
+ <description>UOMo adds Units of Measurement support for IT Systems and Services both to Language and Data.</description>
+ <url>http://www.eclipse.org/uomo/</url>
+ <issueManagement>
+ <system>Bugzilla</system>
+ <url>https://bugs.eclipse.org/bugs/</url>
+ </issueManagement>
+ <inceptionYear>2010</inceptionYear>
+ <developers>
+ <developer>
+ <name>Werner Keil</name>
+ <id>wkeil</id>
+ <organization>Creative Arts & Technologies</organization>
+ <organizationUrl>http://www.catmedia.us</organizationUrl>
+ <email>werner.keil@gmx.net</email>
+ <timezone>0</timezone>
+ <roles>
+ <role>Project Lead</role>
+ <role>Architect</role>
+ <role>Java Developer</role>
+ </roles>
+ </developer>
+ <developer>
+ <name>Chris Senior</name>
+ <id>csenior</id>
+ <email>christopher.senior@gmail.com</email>
+ <organization>Private Individual</organization>
+ <roles>
+ <role>Architect</role>
+ <role>Java Developer</role>
+ </roles>
+ </developer>
+ </developers>
+ <contributors>
+ <contributor>
+ <name>Grahame Grieve</name>
+ <!-- id>grahameg</id -->
+ <email>grahame@healthintersections.com.au</email>
+ <organization>Health Intersections</organization>
+ <organizationUrl>http://www.healthintersections.com.au</organizationUrl>
+ <roles>
+ <role>UCUM Lead</role>
+ <role>Architect</role>
+ <role>Java Developer (inactive)</role>
+ </roles>
+ </contributor>
+
+ </contributors>
+ <scm>
+ <url>http://git.eclipse.org/c/uomo/org.eclipse.uomo.git/</url>
+ </scm>
+ <organization>
+ <name>Eclipse Foundation</name>
+ <url>http://www.eclipse.org</url>
+ </organization>
+ <modules>
+ <module>bundles</module>
+ <module>features</module>
+ <module>examples</module>
+ <module>releng</module>
+ </modules>
+ <!-- ======================================================= -->
+ <!-- Build Settings -->
+ <!-- ======================================================= -->
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.5</version>
+ <executions>
+ <execution>
+ <id>copy-sitedescriptor</id>
+ <!-- fetch site.xml before creating site documentation -->
+ <phase>pre-site</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${basedir}/src/site/</outputDirectory>
+ <resources>
+ <resource>
+ <directory>${site.basedir}/src/site/</directory>
+ <includes>
+ <include>**/site.xml</include>
+ </includes>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <!-- This sets up the target platform in PDE terms The version of Eclipse
+ that the source will be built against -->
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>target-platform-configuration</artifactId>
+ <version>${tycho-version}</version>
+ <configuration>
+ <resolver>p2</resolver>
+ <target>
+ <artifact>
+ <groupId>org.eclipse.uomo</groupId>
+ <artifactId>org.eclipse.uomo.target</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ <classifier>indigo</classifier>
+ </artifact>
+ </target>
+ <ignoreTychoRepositories>true</ignoreTychoRepositories>
+ <environments>
+ <environment>
+ <os>win32</os>
+ <ws>win32</ws>
+ <arch>x86</arch>
+ </environment>
+ <environment>
+ <os>linux</os>
+ <ws>gtk</ws>
+ <arch>x86</arch>
+ </environment>
+ </environments>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-maven-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <extensions>true</extensions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.4</version>
+ </plugin>
+ <!-- <plugin> <groupId>org.sonatype.tycho</groupId> <artifactId>maven-osgi-packaging-plugin</artifactId>
+ <version>${tycho-version}</version> <configuration> <archive> <addMavenDescriptor>false</addMavenDescriptor>
+ </archive> </configuration> </plugin> -->
+ </plugins>
+ </build>
+
+
+ <!-- ==================================================== -->
+ <!-- Repositories. This is where Maven looks for dependencies. The Maven
+ repository is implicit and doesn't need to be specified. -->
+ <!-- ==================================================== -->
+ <repositories>
+ <repository>
+ <id>eclipse-public</id>
+ <name>Public Eclipse.org Nexus</name>
+ <url>http://maven.eclipse.org/nexus/content/groups/public/</url>
+ </repository>
+
+ <repository>
+ <id>eclipse-central</id>
+ <name>Central Eclipse.org Nexus</name>
+ <url>http://maven.eclipse.org/nexus/content/groups/central/</url>
+ </repository>
+
+ <repository>
+ <id>maven-geotoolkit.org</id>
+ <name>GeoToolkit Repository for Maven</name>
+ <url>http://maven.geotoolkit.org/</url>
+ </repository>
+ </repositories>
+ <ciManagement>
+ <system>Hudson</system>
+ <url>https://hudson.eclipse.org/hudson/job/uomo/</url>
+ </ciManagement>
</project>
\ No newline at end of file
diff --git a/releng/.project b/releng/.project
index b6668b5..75a9c24 100644
--- a/releng/.project
+++ b/releng/.project
@@ -1,17 +1,17 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.uomo.releng</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.m2e.core.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.m2e.core.maven2Nature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.uomo.releng</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ </natures>
+</projectDescription>
diff --git a/releng/.settings/org.eclipse.m2e.core.prefs b/releng/.settings/org.eclipse.m2e.core.prefs
index 14b697b..f897a7f 100644
--- a/releng/.settings/org.eclipse.m2e.core.prefs
+++ b/releng/.settings/org.eclipse.m2e.core.prefs
@@ -1,4 +1,4 @@
-activeProfiles=
-eclipse.preferences.version=1
-resolveWorkspaceProjects=true
-version=1
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/releng/Maven Clean Package.launch b/releng/Maven Clean Package.launch
index 8d2ce84..d2a0f15 100644
--- a/releng/Maven Clean Package.launch
+++ b/releng/Maven Clean Package.launch
@@ -1,19 +1,19 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
-<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>
-<stringAttribute key="M2_GOALS" value="clean package"/>
-<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>
-<booleanAttribute key="M2_OFFLINE" value="false"/>
-<stringAttribute key="M2_PROFILES" value=""/>
-<listAttribute key="M2_PROPERTIES"/>
-<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/>
-<booleanAttribute key="M2_SKIP_TESTS" value="true"/>
-<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
-<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/>
-<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
-<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dmaven.test.skip=true"/>
-<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/org.eclipse.uomo}"/>
-</launchConfiguration>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
+<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>
+<stringAttribute key="M2_GOALS" value="clean package"/>
+<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>
+<booleanAttribute key="M2_OFFLINE" value="false"/>
+<stringAttribute key="M2_PROFILES" value=""/>
+<listAttribute key="M2_PROPERTIES"/>
+<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/>
+<booleanAttribute key="M2_SKIP_TESTS" value="true"/>
+<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
+<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/>
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
+<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dmaven.test.skip=true"/>
+<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/org.eclipse.uomo}"/>
+</launchConfiguration>
diff --git a/releng/eclipse-repository/.project b/releng/eclipse-repository/.project
new file mode 100644
index 0000000..15d302d
--- /dev/null
+++ b/releng/eclipse-repository/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>eclipse-repository</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ </natures>
+</projectDescription>
diff --git a/releng/eclipse-repository/pom.xml b/releng/eclipse-repository/pom.xml
index c2a5c5c..1a92214 100644
--- a/releng/eclipse-repository/pom.xml
+++ b/releng/eclipse-repository/pom.xml
@@ -1,12 +1,12 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>org.eclipse.uomo.releng</artifactId>
- <groupId>org.eclipse.uomo</groupId>
- <version>0.7.0-SNAPSHOT</version>
- </parent>
- <artifactId>eclipse-repository</artifactId>
- <name>Eclipse UOMo Repository</name>
- <packaging>eclipse-repository</packaging>
-
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>org.eclipse.uomo.releng</artifactId>
+ <groupId>org.eclipse.uomo</groupId>
+ <version>0.7.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>eclipse-repository</artifactId>
+ <name>Eclipse UOMo Repository</name>
+ <packaging>eclipse-repository</packaging>
+
</project>
\ No newline at end of file