Updated central classes to be ICU neutral
Signed-off-by: Werner Keil <werner.keil@gmx.net>
diff --git a/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/AbstractUnit.java b/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/AbstractUnit.java
index 862a5b5..368068e 100644
--- a/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/AbstractUnit.java
+++ b/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/AbstractUnit.java
@@ -87,7 +87,7 @@
* @see <a href="http://en.wikipedia.org/wiki/Units_of_measurement"> Wikipedia:
* Units of measurement</a>
*/
-public abstract class AbstractUnit<Q extends Quantity<Q>> extends MeasureUnit
+public abstract class AbstractUnit<Q extends Quantity<Q>>
implements Unit<Q>, IName, ISymbol {
/**
diff --git a/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/QuantityAmount.java b/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/QuantityAmount.java
index d2155d4..5f33c11 100644
--- a/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/QuantityAmount.java
+++ b/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/QuantityAmount.java
@@ -36,6 +36,7 @@
implements IMeasure<Q> {
private final Measure measure;
+ private final Unit<Q> unit;
/**
* Holds a dimensionless measure of one (exact).
@@ -97,8 +98,13 @@
*/
// private double _maximum;
- protected QuantityAmount(Number number, MeasureUnit unit) {
- measure = MeasureAmount.of(number, unit);
+ protected QuantityAmount(Number number, Unit unit, MeasureUnit mUnit) {
+ this.unit = unit;
+ measure = MeasureAmount.of(number, mUnit);
+ }
+
+ protected QuantityAmount(Number number, Unit unit) {
+ this(number, unit, null);
}
/**
@@ -118,7 +124,7 @@
*/
@Override
public double doubleValue(Unit<Q> unit) {
- return (internalUnit().equals(unit)) ? value().doubleValue() : internalUnit().getConverterTo(unit).convert(value().doubleValue());
+ return (internalUnit().equals(unit)) ? value().doubleValue() : unit().getConverterTo(unit).convert(value().doubleValue());
}
/*
@@ -144,7 +150,7 @@
*/
@Override
public Unit<Q> unit() {
- return internalUnit();
+ return unit;
}
/*
@@ -175,7 +181,7 @@
}
public Unit<Q> getUnit() {
- return internalUnit();
+ return unit();
}
/**
@@ -183,9 +189,8 @@
*
* @provisional This API might change or be removed in a future release.
*/
- @SuppressWarnings("unchecked")
- private final AbstractUnit<Q> internalUnit() {
- return (AbstractUnit<Q>) measure.getUnit();
+ private final MeasureUnit internalUnit() {
+ return measure.getUnit();
}
protected final Number getNumber() {
diff --git a/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/BaseAmount.java b/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/BaseAmount.java
index a254035..3e299e9 100644
--- a/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/BaseAmount.java
+++ b/bundles/org.eclipse.uomo.units/src/main/java/org/eclipse/uomo/units/impl/BaseAmount.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2005, 2013, Werner Keil and others.
+ * Copyright (c) 2005, 2017, 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
@@ -34,13 +34,14 @@
* Represents a generic quantity amount.
*
* @author <a href="mailto:uomo@catmedia.us">Werner Keil</a>
- * @version 1.3.3, $Date: 2013-05-21 $
+ * @version 1.4, $Date: 2017-03-23 $
* @deprecated use BaseQuantity
*/
public class BaseAmount<Q extends Quantity<Q>> extends AbstractQuantity<Q>
implements Comparable<BaseAmount<Q>> {
private final Measure measure;
+ private final Number value;
/**
* @param number
@@ -48,7 +49,8 @@
*/
public BaseAmount(Number number, Unit<Q> unit) {
super(unit);
- measure = MeasureAmount.of(number, (MeasureUnit)unit);
+ value = number;
+ measure = null; //MeasureAmount.of(number, (MeasureUnit)unit);
//super(number, (MeasureUnit) unit);
}
@@ -296,12 +298,12 @@
@Override
public Number value() {
- return measure.getNumber();
+ return getValue();
}
@Override
public Number getValue() {
- return value();
+ return value;
}
@Override
diff --git a/examples/business/org.eclipse.uomo.examples.business.console/.classpath b/examples/business/org.eclipse.uomo.examples.business.console/.classpath
index 63cc387..baf96d0 100644
--- a/examples/business/org.eclipse.uomo.examples.business.console/.classpath
+++ b/examples/business/org.eclipse.uomo.examples.business.console/.classpath
@@ -22,7 +22,7 @@
<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">
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
diff --git a/examples/ucum/org.eclipse.uomo.examples.ucum.console/.classpath b/examples/ucum/org.eclipse.uomo.examples.ucum.console/.classpath
index f32149e..2acbce5 100644
--- a/examples/ucum/org.eclipse.uomo.examples.ucum.console/.classpath
+++ b/examples/ucum/org.eclipse.uomo.examples.ucum.console/.classpath
@@ -17,7 +17,7 @@
<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">
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
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 fa05dac..dd1a15d 100644
--- a/examples/units/org.eclipse.uomo.examples.units.android/web/.classpath
+++ b/examples/units/org.eclipse.uomo.examples.units.android/web/.classpath
@@ -16,10 +16,9 @@
<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">
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
diff --git a/examples/units/org.eclipse.uomo.examples.units.android/web/.settings/org.eclipse.jdt.core.prefs b/examples/units/org.eclipse.uomo.examples.units.android/web/.settings/org.eclipse.jdt.core.prefs
index 62a317c..c788ee3 100644
--- a/examples/units/org.eclipse.uomo.examples.units.android/web/.settings/org.eclipse.jdt.core.prefs
+++ b/examples/units/org.eclipse.uomo.examples.units.android/web/.settings/org.eclipse.jdt.core.prefs
@@ -1,8 +1,8 @@
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.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/examples/units/org.eclipse.uomo.examples.units.console/.classpath b/examples/units/org.eclipse.uomo.examples.units.console/.classpath
index ab2b25d..4fdb27d 100644
--- a/examples/units/org.eclipse.uomo.examples.units.console/.classpath
+++ b/examples/units/org.eclipse.uomo.examples.units.console/.classpath
@@ -28,7 +28,7 @@
<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">
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
diff --git a/pom.xml b/pom.xml
index 8f355a5..b335225 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,11 +21,11 @@
<properties>
<sourceEncoding>UTF-8</sourceEncoding> <!-- in Maven 3. -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.build.javaVersion>1.6</project.build.javaVersion>
+ <project.build.javaVersion>1.7</project.build.javaVersion>
<maven.compilerPlugin.version>2.3.2</maven.compilerPlugin.version>
<uomo-version>0.7.0-SNAPSHOT</uomo-version>
<tycho-version>0.16.0</tycho-version>
- <icu4j-version>50.1.1</icu4j-version>
+ <icu4j-version>56.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>
@@ -176,34 +176,116 @@
<version>${tycho-version}</version> <configuration> <archive> <addMavenDescriptor>false</addMavenDescriptor>
</archive> </configuration> </plugin> -->
</plugins>
+ <pluginManagement>
+ <plugins>
+ <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>
+ org.eclipse.tycho
+ </groupId>
+ <artifactId>
+ tycho-compiler-plugin
+ </artifactId>
+ <versionRange>
+ [0.16.0,)
+ </versionRange>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore></ignore>
+ </action>
+ </pluginExecution>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>
+ org.eclipse.tycho
+ </groupId>
+ <artifactId>
+ tycho-packaging-plugin
+ </artifactId>
+ <versionRange>
+ [0.16.0,)
+ </versionRange>
+ <goals>
+ <goal>
+ build-qualifier-aggregator
+ </goal>
+ <goal>build-qualifier</goal>
+ <goal>validate-id</goal>
+ <goal>
+ validate-version
+ </goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore></ignore>
+ </action>
+ </pluginExecution>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>
+ org.apache.maven.plugins
+ </groupId>
+ <artifactId>
+ maven-clean-plugin
+ </artifactId>
+ <versionRange>
+ [2.5,)
+ </versionRange>
+ <goals>
+ <goal>clean</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore></ignore>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
</build>
-
- <!-- ==================================================== -->
- <!-- Repositories. This is where Maven looks for dependencies. The Maven
- repository is implicit and doesn't need to be specified. -->
- <!-- ==================================================== -->
- <!-- repositories>
+ <!-- Additional repositories -->
+ <!-- Helps to resolve Parent POM and Snapshot artifacts -->
+ <repositories>
<repository>
- <id>eclipse-public</id>
- <name>Public Eclipse.org Nexus</name>
- <url>http://maven.eclipse.org/nexus/content/groups/public/</url>
+ <id>jcenter</id>
+ <name>JCenter</name>
+ <url>http://jcenter.bintray.com</url>
</repository>
-
<repository>
- <id>eclipse-central</id>
- <name>Central Eclipse.org Nexus</name>
- <url>http://maven.eclipse.org/nexus/content/groups/central/</url>
- </repository> -->
- <repositories>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <id>bintray-release</id>
+ <name>libs-release</name>
+ <url>http://oss.jfrog.org/artifactory/libs-release</url>
+ </repository>
<repository>
- <id>maven-geotoolkit.org</id>
- <name>GeoToolkit Repository for Maven</name>
- <url>http://maven.geotoolkit.org/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>bintray-snapshot</id>
+ <name>libs-snapshot</name>
+ <url>http://oss.jfrog.org/artifactory/libs-snapshot</url>
</repository>
</repositories>
+
<ciManagement>
<system>Hudson</system>
- <url>https://hudson.eclipse.org/hudson/job/uomo/</url>
+ <url>https://hudson.eclipse.org/uomo/</url>
</ciManagement>
</project>
\ No newline at end of file