You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2014/03/12 23:52:28 UTC
svn commit: r1576977 [4/5] - in /sis/trunk: ./
core/sis-feature/src/main/java/org/apache/sis/feature/
core/sis-metadata/src/main/java/org/apache/sis/io/wkt/
core/sis-metadata/src/main/java/org/apache/sis/metadata/
core/sis-metadata/src/main/java/org/ap...
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java?rev=1576977&r1=1576976&r2=1576977&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java [UTF-8] Wed Mar 12 22:52:24 2014
@@ -22,13 +22,16 @@ import java.util.Locale;
import javax.measure.unit.SI;
import javax.measure.unit.Unit;
import org.opengis.parameter.ParameterDescriptor;
+import org.apache.sis.measure.Range;
+import org.apache.sis.measure.NumberRange;
+import org.apache.sis.measure.MeasurementRange;
import org.apache.sis.test.DependsOnMethod;
import org.apache.sis.test.DependsOn;
import org.apache.sis.test.TestCase;
import org.junit.Test;
-import static org.junit.Assert.*;
import static org.opengis.test.Validators.*;
+import static org.apache.sis.test.MetadataAssert.*;
/**
@@ -47,13 +50,9 @@ public final strictfp class DefaultParam
* @param name The parameter name.
* @return The properties to be given to descriptor constructor.
*/
- private static Map<String,Object> properties(final String name,
- final Object minimumValue, final Object maximumValue)
- {
- final Map<String,Object> properties = new HashMap<String,Object>(8);
+ private static Map<String,Object> properties(final String name) {
+ final Map<String,Object> properties = new HashMap<String,Object>(4);
assertNull(properties.put(DefaultParameterDescriptor.NAME_KEY, name));
- assertNull(properties.put(DefaultParameterDescriptor.MINIMUM_VALUE_KEY, minimumValue));
- assertNull(properties.put(DefaultParameterDescriptor.MAXIMUM_VALUE_KEY, maximumValue));
assertNull(properties.put(DefaultParameterDescriptor.LOCALE_KEY, Locale.US));
return properties;
}
@@ -66,42 +65,41 @@ public final strictfp class DefaultParam
* @return The parameter descriptor.
*/
static <T> DefaultParameterDescriptor<T> createSimpleOptional(final String name, final Class<T> type) {
- return new DefaultParameterDescriptor<T>(properties(name, null, null), type, null, null, false);
+ return new DefaultParameterDescriptor<T>(properties(name), type, null, null, null, false);
}
/**
* Creates a descriptor for a mandatory parameter in a range of integer values.
*
* @param name The parameter name.
- * @param defaultValue The default value for the parameter.
* @param minimumValue The minimum parameter value.
* @param maximumValue The maximum parameter value.
+ * @param defaultValue The default value for the parameter.
* @return The parameter descriptor for the given range of values.
*/
static DefaultParameterDescriptor<Integer> create(final String name,
- final int defaultValue, final int minimumValue, final int maximumValue)
+ final int minimumValue, final int maximumValue, final int defaultValue)
{
- return new DefaultParameterDescriptor<Integer>(properties(name, minimumValue, maximumValue),
- Integer.class, Integer.valueOf(defaultValue), null, true);
+ return new DefaultParameterDescriptor<Integer>(properties(name), Integer.class,
+ NumberRange.create(minimumValue, true, maximumValue, true), null, Integer.valueOf(defaultValue), true);
}
/**
* Creates a descriptor for a mandatory parameter in a range of floating point values.
*
* @param name The parameter name.
- * @param defaultValue The default value for the parameter, or {@link Double#NaN} if none.
- * @param minimum The minimum parameter value, or {@link minimumValue#NEGATIVE_INFINITY} if none.
+ * @param minimumValue The minimum parameter value, or {@link Double#NEGATIVE_INFINITY} if none.
* @param maximumValue The maximum parameter value, or {@link Double#POSITIVE_INFINITY} if none.
+ * @param defaultValue The default value for the parameter, or {@link Double#NaN} if none.
* @param unit The unit for default, minimum and maximum values.
* @return The parameter descriptor for the given range of values.
*/
static DefaultParameterDescriptor<Double> create(final String name,
- final double defaultValue, final double minimumValue, final double maximumValue, final Unit<?> unit)
+ final double minimumValue, final double maximumValue, final double defaultValue, final Unit<?> unit)
{
- return new DefaultParameterDescriptor<Double>(properties(name,
- minimumValue == Double.NEGATIVE_INFINITY ? null : Double.valueOf(minimumValue),
- maximumValue == Double.POSITIVE_INFINITY ? null : Double.valueOf(maximumValue)),
- Double.class, Double.isNaN(defaultValue) ? null : Double.valueOf(defaultValue), unit, true);
+ return new DefaultParameterDescriptor<Double>(properties(name), Double.class,
+ MeasurementRange.create(minimumValue, true, maximumValue, true, unit), null,
+ Double.isNaN(defaultValue) ? null : Double.valueOf(defaultValue), true);
}
/**
@@ -117,9 +115,23 @@ public final strictfp class DefaultParam
static <T> DefaultParameterDescriptor<T> create(final String name, final Class<T> type,
final T[] validValues, final T defaultValue)
{
- final Map<String,Object> properties = properties(name, null, null);
- assertNull(properties.put(DefaultParameterDescriptor.VALID_VALUES_KEY, validValues));
- return new DefaultParameterDescriptor<T>(properties, type, defaultValue, null, true);
+ return new DefaultParameterDescriptor<T>(properties(name), type, null, validValues, defaultValue, true);
+ }
+
+ /**
+ * Creates a descriptor for an array of {@code double[] values.
+ *
+ * @param name The parameter name.
+ * @param minimumValue The minimum parameter value, or {@link Double#NEGATIVE_INFINITY} if none.
+ * @param maximumValue The maximum parameter value, or {@link Double#POSITIVE_INFINITY} if none.
+ * @param unit The unit for minimum and maximum values.
+ * @return The parameter descriptor for the given range of values.
+ */
+ static DefaultParameterDescriptor<double[]> createForArray(final String name,
+ final double minimumValue, final double maximumValue, final Unit<?> unit)
+ {
+ final MeasurementRange<Double> valueDomain = MeasurementRange.create(minimumValue, true, maximumValue, true, unit);
+ return new DefaultParameterDescriptor<double[]>(properties(name), double[].class, valueDomain, null, null, true);
}
/**
@@ -146,12 +158,12 @@ public final strictfp class DefaultParam
@DependsOnMethod("testOptionalInteger")
public void testRangeValidation() {
try {
- create("Test range", 12, 20, 4);
+ create("Test range", 20, 4, 12);
fail("minimum > maximum");
} catch (IllegalArgumentException exception) {
assertEquals("Range [20 … 4] is not valid.", exception.getMessage());
}
- final ParameterDescriptor<Integer> descriptor = create("Test range", 12, 4, 20);
+ final ParameterDescriptor<Integer> descriptor = create("Test range", 4, 20, 12);
assertEquals("name", "Test range", descriptor.getName().getCode());
assertEquals("valueClass", Integer.class, descriptor.getValueClass());
assertNull ("validValues", descriptor.getValidValues());
@@ -169,10 +181,10 @@ public final strictfp class DefaultParam
@DependsOnMethod("testRangeValidation")
public void testDefaultValueValidation() {
try {
- create("Test default", 3, 4, 20);
+ create("Test default", 4, 20, 3);
fail("defaultValue < minimum");
} catch (IllegalArgumentException exception) {
- assertEquals("Value ‘Test default’=3 is invalid. Expected a value in the [4 … 20] range.", exception.getMessage());
+ assertEquals("Value ‘Test default’ = 3 is invalid. Expected a value in the [4 … 20] range.", exception.getMessage());
}
}
@@ -181,7 +193,7 @@ public final strictfp class DefaultParam
*/
@Test
public void testDoubleType() {
- final ParameterDescriptor<Double> descriptor = create("Length measure", 12, 4, 20, SI.METRE);
+ final ParameterDescriptor<Double> descriptor = create("Length measure", 4, 20, 12, SI.METRE);
assertEquals("name", "Length measure", descriptor.getName().getCode());
assertEquals("unit", SI.METRE, descriptor.getUnit());
assertEquals("class", Double.class, descriptor.getValueClass());
@@ -189,8 +201,6 @@ public final strictfp class DefaultParam
assertEquals("minimum", Double.valueOf( 4), descriptor.getMinimumValue());
assertEquals("maximum", Double.valueOf(20), descriptor.getMaximumValue());
validate(descriptor);
- assertEquals("DefaultParameterDescriptor[\"Length measure\", mandatory, class=Double, " +
- "valid=[4.0 … 20.0], default=12.0, unit=m]", descriptor.toString());
}
/**
@@ -198,26 +208,19 @@ public final strictfp class DefaultParam
*/
@Test
public void testStringType() {
- final ParameterDescriptor<String> descriptor = new DefaultParameterDescriptor<String>(
- properties("String param", "AAA", "BBB"), String.class, "ABC", null, false);
+ final Range<String> valueDomain = new Range<String>(String.class, "AAA", true, "BBB", true);
+ final DefaultParameterDescriptor<String> descriptor = new DefaultParameterDescriptor<String>(
+ properties("String param"), String.class, valueDomain, null, "ABC", false);
assertEquals("name", "String param", descriptor.getName().getCode());
assertEquals("valueClass", String.class, descriptor.getValueClass());
assertNull ("validValues", descriptor.getValidValues());
+ assertSame ("valueDomain", valueDomain, descriptor.getValueDomain());
assertEquals("defaultValue", "ABC", descriptor.getDefaultValue());
assertEquals("minimumValue", "AAA", descriptor.getMinimumValue());
assertEquals("maximumValue", "BBB", descriptor.getMaximumValue());
assertEquals("minimumOccurs", 0, descriptor.getMinimumOccurs());
assertEquals("maximumOccurs", 1, descriptor.getMaximumOccurs());
- /*
- * Same construction than above, except that we specify a unit of measurement.
- * This operation shall be invalid for non-numerical types.
- */
- try {
- new DefaultParameterDescriptor<String>(properties("Invalid param", "AAA", "BBB"),
- String.class, "ABC", SI.METRE, false);
- } catch (IllegalArgumentException e) {
- assertEquals("Unit of measurement “m” is not valid for “Invalid param” values.", e.getMessage());
- }
+ assertNull ("unit", descriptor.getUnit());
}
/**
@@ -237,6 +240,7 @@ public final strictfp class DefaultParam
assertNull ("maximumValue", descriptor.getMaximumValue());
assertEquals ("minimumOccurs", 1, descriptor.getMinimumOccurs());
assertEquals ("maximumOccurs", 1, descriptor.getMaximumOccurs());
+ assertNull ("unit", descriptor.getUnit());
/*
* Invalid operation: element not in the list of valid elements.
*/
@@ -246,4 +250,48 @@ public final strictfp class DefaultParam
assertEquals("Parameter “Enumeration param” can not take the “Pear” value.", e.getMessage());
}
}
+
+ /**
+ * Tests a descriptor for a parameter value of kind {@code double[]}.
+ */
+ @Test
+ @DependsOnMethod("testDoubleType")
+ public void testArrayType() {
+ final DefaultParameterDescriptor<double[]> descriptor = createForArray("Array param", 4, 9, SI.METRE);
+ assertEquals("name", "Array param", descriptor.getName().getCode());
+ assertEquals("valueClass", double[].class, descriptor.getValueClass());
+ assertEquals("unit", SI.METRE, descriptor.getUnit());
+ assertNull ("validValues", descriptor.getValidValues());
+ assertNull ("defaultValue", descriptor.getDefaultValue());
+ assertNull ("minimumValue", descriptor.getMinimumValue());
+ assertNull ("maximumValue", descriptor.getMaximumValue());
+ assertEquals("minimumOccurs", 1, descriptor.getMinimumOccurs());
+ assertEquals("maximumOccurs", 1, descriptor.getMaximumOccurs());
+
+ final Range<?> valueDomain = descriptor.getValueDomain();
+ assertNotNull("valueDomain", valueDomain);
+ assertEquals(Double.class, valueDomain.getElementType());
+ assertEquals(Double.valueOf(4), valueDomain.getMinValue());
+ assertEquals(Double.valueOf(9), valueDomain.getMaxValue());
+ /*
+ * Invalid operation: wrong type of range value.
+ */
+ try {
+ new DefaultParameterDescriptor<double[]>(properties("Array param"), double[].class,
+ NumberRange.create(4, true, 9, true), null, null, false);
+ } catch (IllegalArgumentException e) {
+ assertEquals("Argument ‘valueDomain’ can not be an instance of ‘Range<Integer>’.", e.getMessage());
+ }
+ }
+
+ /**
+ * Tests the WKT representation.
+ */
+ @Test
+ public void testWKT() {
+ final DefaultParameterDescriptor<Double> descriptor = create("Real number", 4, 8, 5, SI.METRE);
+ assertWktEquals("Parameter[“Integer param”, 5]", create("Integer param", 4, 8, 5));
+ assertWktEquals("Parameter[“Real number”, 5.0, LengthUnit[“metre”, 1]]", descriptor);
+ assertEquals("Parameter[\"Real number\", 5.0, Unit[\"metre\", 1]]", descriptor.toString());
+ }
}
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueTest.java?rev=1576977&r1=1576976&r2=1576977&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueTest.java [UTF-8] Wed Mar 12 22:52:24 2014
@@ -21,7 +21,6 @@ import javax.measure.unit.NonSI;
import javax.measure.unit.Unit;
import org.opengis.referencing.cs.AxisDirection;
import org.opengis.referencing.datum.VerticalDatumType;
-import org.opengis.parameter.ParameterValue;
import org.opengis.parameter.ParameterDescriptor;
import org.opengis.parameter.InvalidParameterTypeException;
import org.opengis.parameter.InvalidParameterValueException;
@@ -59,6 +58,38 @@ public final strictfp class DefaultParam
private static final double EPS = 1E-10;
/**
+ * A subclass of {@code DefaultParameterValue} which store the value converted by {@link Verifier}.
+ * This allows {@link DefaultParameterValueTest} methods to verify the conversion result.
+ */
+ @SuppressWarnings("serial")
+ private static final strictfp class Watcher<T> extends DefaultParameterValue<T> {
+ /** The value converted by {@link Verifier}. */
+ T convertedValue;
+
+ /** Creates a new parameter value for testing purpose. */
+ Watcher(final DefaultParameterDescriptor<T> descriptor) {
+ super(descriptor);
+ }
+
+ /** Automatically invoked when a new value is set. */
+ @Override protected void validate(final T value) {
+ convertedValue = value;
+ }
+
+ /** Asserts that the value and the converted value are equal to the expected one. */
+ void assertValueEquals(final Object expected) {
+ assertEquals("value", expected, getValue());
+ assertEquals("convertedValue", expected, convertedValue);
+ }
+
+ /** Asserts that the value and the converted value are equal to the expected ones. */
+ void assertValueEquals(final Object expected, final Object converted) {
+ assertEquals("value", expected, getValue());
+ assertEquals("convertedValue", converted, convertedValue);
+ }
+ }
+
+ /**
* Constructs an optional parameter initialized to the given value.
* The descriptor has no default value, no minimum and no maximum.
*
@@ -66,8 +97,8 @@ public final strictfp class DefaultParam
* @param value The parameter value.
* @return A new parameter instance for the given name and value.
*/
- private static DefaultParameterValue<Integer> createOptional(final String name, final int value) {
- final DefaultParameterValue<Integer> parameter = new DefaultParameterValue<Integer>(
+ private static Watcher<Integer> createOptional(final String name, final int value) {
+ final Watcher<Integer> parameter = new Watcher<Integer>(
DefaultParameterDescriptorTest.createSimpleOptional(name, Integer.class));
parameter.setValue(value, null);
return parameter;
@@ -81,10 +112,9 @@ public final strictfp class DefaultParam
* @param unit The unit for the parameter value.
* @return A new parameter instance for the given name and value.
*/
- private static DefaultParameterValue<Double> create(final String name, final double value, final Unit<?> unit) {
- final ParameterDescriptor<Double> descriptor = DefaultParameterDescriptorTest.create(
- name, Double.NaN, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, unit);
- final DefaultParameterValue<Double> parameter = new DefaultParameterValue<Double>(descriptor);
+ private static Watcher<Double> create(final String name, final double value, final Unit<?> unit) {
+ final Watcher<Double> parameter = new Watcher<Double>(DefaultParameterDescriptorTest.create(
+ name, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Double.NaN, unit));
parameter.setValue(value, unit);
return parameter;
}
@@ -96,7 +126,7 @@ public final strictfp class DefaultParam
*/
@Test
public void testInteger() {
- final ParameterValue<Integer> parameter = createOptional("Integer param", 14);
+ final Watcher<Integer> parameter = createOptional("Integer param", 14);
final ParameterDescriptor<Integer> descriptor = parameter.getDescriptor();
validate(parameter);
@@ -139,7 +169,7 @@ public final strictfp class DefaultParam
* the value should stay null (not substituted by the default value).
*/
parameter.setValue(-15);
- assertEquals(Integer.valueOf(-15), parameter.getValue());
+ parameter.assertValueEquals(Integer.valueOf(-15));
parameter.setValue(null);
assertNull(parameter.getValue());
validate(parameter);
@@ -153,8 +183,8 @@ public final strictfp class DefaultParam
@Test
@DependsOnMethod("testInteger")
public void testBoundedInteger() {
- final DefaultParameterValue<Integer> parameter = new DefaultParameterValue<Integer>(
- DefaultParameterDescriptorTest.create("Bounded param", 15, -30, +40));
+ final Watcher<Integer> parameter = new Watcher<Integer>(
+ DefaultParameterDescriptorTest.create("Bounded param", -30, +40, 15));
assertEquals(Integer.class, parameter.getDescriptor().getValueClass());
assertEquals( "value", Integer.valueOf(15), parameter.getValue());
assertEquals( "intValue", 15, parameter.intValue());
@@ -164,7 +194,7 @@ public final strictfp class DefaultParam
* Set a value inside the range of valid values.
*/
parameter.setValue(12);
- assertEquals( "value", Integer.valueOf(12), parameter.getValue());
+ parameter.assertValueEquals(Integer.valueOf(12));
assertEquals( "intValue", 12, parameter.intValue());
assertEquals("doubleValue", 12, parameter.doubleValue(), STRICT);
validate(parameter);
@@ -203,7 +233,7 @@ public final strictfp class DefaultParam
* the value can be converted to an integer.
*/
parameter.setValue(10.0);
- assertEquals( "value", Integer.valueOf(10), parameter.getValue());
+ parameter.assertValueEquals(Integer.valueOf(10));
assertEquals( "intValue", 10, parameter.intValue());
assertEquals("doubleValue", 10, parameter.doubleValue(), STRICT);
validate(parameter);
@@ -226,7 +256,7 @@ public final strictfp class DefaultParam
*/
@Test
public void testMeasure() {
- final DefaultParameterValue<Double> parameter = create("Numerical param", 3, SI.METRE);
+ final Watcher<Double> parameter = create("Numerical param", 3, SI.METRE);
final ParameterDescriptor<Double> descriptor = parameter.getDescriptor();
validate(parameter);
@@ -258,6 +288,7 @@ public final strictfp class DefaultParam
* Sets a value in centimetres.
*/
parameter.setValue(400, SI.CENTIMETRE);
+ parameter.assertValueEquals(Double.valueOf(400), Double.valueOf(4));
assertEquals("unit", SI.CENTIMETRE, parameter.getUnit());
assertEquals("doubleValue", 400, parameter.doubleValue(), STRICT);
assertEquals("doubleValue", 400, parameter.doubleValue(SI.CENTIMETRE), STRICT);
@@ -272,8 +303,8 @@ public final strictfp class DefaultParam
@Test
@DependsOnMethod("testMeasure")
public void testBoundedDouble() {
- final DefaultParameterValue<Double> parameter = new DefaultParameterValue<Double>(
- DefaultParameterDescriptorTest.create("Bounded param", 15.0, -30.0, +40.0, null));
+ final Watcher<Double> parameter = new Watcher<Double>(
+ DefaultParameterDescriptorTest.create("Bounded param", -30.0, +40.0, 15.0, null));
assertEquals(Double.class, parameter.getDescriptor().getValueClass());
assertEquals( "value", Double.valueOf(15), parameter.getValue());
assertEquals( "intValue", 15, parameter.intValue());
@@ -281,7 +312,7 @@ public final strictfp class DefaultParam
validate(parameter);
parameter.setValue(12.0);
- assertEquals( "value", Double.valueOf(12), parameter.getValue());
+ parameter.assertValueEquals(Double.valueOf(12));
assertEquals( "intValue", 12, parameter.intValue());
assertEquals("doubleValue", 12, parameter.doubleValue(), STRICT);
validate(parameter);
@@ -316,8 +347,8 @@ public final strictfp class DefaultParam
@Test
@DependsOnMethod({"testMeasure", "testBoundedDouble"})
public void testBoundedMeasure() {
- final DefaultParameterValue<Double> parameter = new DefaultParameterValue<Double>(
- DefaultParameterDescriptorTest.create("Length measure", 12, 4, 20, SI.METRE));
+ final Watcher<Double> parameter = new Watcher<Double>(
+ DefaultParameterDescriptorTest.create("Length measure", 4, 20, 12, SI.METRE));
assertEquals("value", Double.valueOf(12), parameter.getValue());
assertEquals("intValue", 12, parameter.intValue());
assertEquals("unit", SI.METRE, parameter.getUnit());
@@ -325,7 +356,7 @@ public final strictfp class DefaultParam
for (int i=4; i<=20; i++) {
parameter.setValue(i);
- assertEquals("value", Double.valueOf(i), parameter.getValue());
+ parameter.assertValueEquals(Double.valueOf(i));
assertEquals("unit", SI.METRE, parameter.getUnit());
assertEquals("value", i, parameter.doubleValue(SI.METRE), STRICT);
assertEquals("value", 100*i, parameter.doubleValue(SI.CENTIMETRE), STRICT);
@@ -337,16 +368,61 @@ public final strictfp class DefaultParam
assertEquals("Length measure", exception.getParameterName());
}
try {
+ parameter.setValue(10.0, SI.KILOMETRE); // Out of range only after unit conversion.
+ fail("setValue(> max)");
+ } catch (InvalidParameterValueException exception) {
+ assertEquals("Length measure", exception.getParameterName());
+ }
+ try {
parameter.setValue("12");
fail("setValue(Sring)");
} catch (InvalidParameterValueException exception) {
assertEquals("Length measure", exception.getParameterName());
}
for (int i=400; i<=2000; i+=100) {
+ final double metres = i / 100.0;
parameter.setValue(i, SI.CENTIMETRE);
- assertEquals("value", Double.valueOf(i), parameter.getValue());
- assertEquals("unit", SI.CENTIMETRE, parameter.getUnit());
- assertEquals("value", i/100, parameter.doubleValue(SI.METRE), EPS);
+ parameter.assertValueEquals(Double.valueOf(i), Double.valueOf(metres));
+ assertEquals("unit", SI.CENTIMETRE, parameter.getUnit());
+ assertEquals("value", metres, parameter.doubleValue(SI.METRE), EPS);
+ }
+ }
+
+ /**
+ * Tests a parameter for values of type {@code double[]}.
+ */
+ @Test
+ public void testArray() {
+ double[] values = {5, 10, 15};
+ final Watcher<double[]> parameter = new Watcher<double[]>(
+ DefaultParameterDescriptorTest.createForArray("myValues", 4, 4000, SI.METRE));
+ parameter.setValue(values);
+ assertArrayEquals(values, parameter.getValue(), 0);
+ assertArrayEquals(values, parameter.convertedValue, 0);
+ assertArrayEquals(values, parameter.doubleValueList(), 0);
+ assertArrayEquals(new double[] {500, 1000, 1500}, parameter.doubleValueList(SI.CENTIMETRE), 0);
+ /*
+ * New values in kilometres.
+ */
+ values = new double[] {3, 2, 4};
+ final double[] metres = new double[] {3000, 2000, 4000};
+ parameter.setValue(values, SI.KILOMETRE);
+ assertArrayEquals(values, parameter.getValue(), 0);
+ assertArrayEquals(metres, parameter.convertedValue, 0);
+ assertArrayEquals(values, parameter.doubleValueList(), 0);
+ assertArrayEquals(metres, parameter.doubleValueList(SI.METRE), 0);
+ /*
+ * Values out of range.
+ */
+ try {
+ parameter.setValue(new double[] {5, 10, -5}, SI.METRE);
+ } catch (InvalidParameterValueException e) {
+ assertTrue(e.getMessage().contains("myValues[2]"));
+ }
+ try {
+ parameter.setValue(new double[] {4, 5}, SI.KILOMETRE); // Out of range only after unit conversion.
+ } catch (InvalidParameterValueException e) {
+ assertTrue(e.getMessage().contains("myValues[1]"));
}
}
@@ -358,8 +434,8 @@ public final strictfp class DefaultParam
final AxisDirection[] directions = {
AxisDirection.NORTH,
AxisDirection.SOUTH,
- AxisDirection.DISPLAY_LEFT,
- AxisDirection.PAST
+ AxisDirection.PAST,
+ AxisDirection.DISPLAY_LEFT
};
final ParameterDescriptor<AxisDirection> descriptor = DefaultParameterDescriptorTest.create(
"Direction", AxisDirection.class, directions, AxisDirection.NORTH);
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java?rev=1576977&r1=1576976&r2=1576977&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java [UTF-8] Wed Mar 12 22:52:24 2014
@@ -109,7 +109,7 @@ public final strictfp class AbstractIden
// The message may be in any language, but shall
// contain at least the missing property name.
final String message = e.getMessage();
- assertTrue(message, message.contains("code"));
+ assertTrue(message, message.contains("name"));
}
// Try again, with error messages forced to English.
assertNull(properties.put(AbstractIdentifiedObject.LOCALE_KEY, Locale.US));
@@ -117,7 +117,7 @@ public final strictfp class AbstractIden
new AbstractIdentifiedObject(properties);
fail("Should not allow unnamed object.");
} catch (IllegalArgumentException e) {
- assertEquals("Missing value for “code” property.", e.getMessage());
+ assertEquals("Missing value for “name” property.", e.getMessage());
}
// "code" with String value is accepted as well.
assertNull(properties.put("code", "Test"));
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/NamedIdentifierTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/NamedIdentifierTest.java?rev=1576977&r1=1576976&r2=1576977&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/NamedIdentifierTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/NamedIdentifierTest.java [UTF-8] Wed Mar 12 22:52:24 2014
@@ -18,6 +18,8 @@ package org.apache.sis.referencing;
import java.util.Locale;
import org.opengis.referencing.ReferenceIdentifier;
+import org.opengis.util.InternationalString;
+import org.opengis.util.NameSpace;
import org.opengis.util.GenericName;
import org.opengis.test.Validators;
import org.apache.sis.util.iso.DefaultInternationalString;
@@ -26,6 +28,8 @@ import org.apache.sis.test.TestCase;
import org.junit.Test;
import static org.apache.sis.test.Assert.*;
+import static org.apache.sis.internal.system.DefaultFactories.SIS_NAMES;
+import static org.apache.sis.metadata.iso.citation.HardCodedCitations.OGP;
import static org.apache.sis.metadata.iso.citation.HardCodedCitations.EPSG;
@@ -39,18 +43,49 @@ import static org.apache.sis.metadata.is
*/
public final strictfp class NamedIdentifierTest extends TestCase {
/**
- * Tests the {@link NamedIdentifier#NamedIdentifier(Citation, String)} constructor.
+ * Tests the {@link NamedIdentifier#NamedIdentifier(Citation, String, String, String, InternationalString)}
+ * constructor.
*/
@Test
public void testCreateFromCode() {
- final NamedIdentifier identifier = new NamedIdentifier(EPSG, "4326");
+ final NamedIdentifier identifier = new NamedIdentifier(OGP, "EPSG", "4326", "8.3", null);
Validators.validate((ReferenceIdentifier) identifier);
Validators.validate((GenericName) identifier);
// ImmutableIdentifier properties
assertEquals("code", "4326", identifier.getCode());
assertEquals("codeSpace", "EPSG", identifier.getCodeSpace());
- assertSame ("authority", EPSG, identifier.getAuthority());
+ assertSame ("authority", OGP, identifier.getAuthority());
+ assertEquals("version", "8.3", identifier.getVersion());
+ assertNull ("remarks", identifier.getRemarks());
+ assertFalse ("isDeprecated", identifier.isDeprecated());
+
+ // NamedIdentifier properties
+ assertEquals("depth", 2, identifier.depth());
+ assertEquals("tip", "4326", identifier.tip().toString());
+ assertEquals("head", "EPSG", identifier.head().toString());
+ assertEquals("name", "EPSG:4326", identifier.toString());
+
+ // Scope (derived from the autority)
+ final NameSpace scope = identifier.scope();
+ assertFalse ("scope", scope.isGlobal());
+ assertEquals("scope", "OGP", scope.name().toString());
+ }
+
+ /**
+ * Tests the {@link NamedIdentifier#NamedIdentifier(GenericName)} constructor.
+ */
+ @Test
+ public void testCreateFromName() {
+ final NameSpace scope = SIS_NAMES.createNameSpace(SIS_NAMES.createLocalName(null, "OGP"), null);
+ final NamedIdentifier identifier = new NamedIdentifier(SIS_NAMES.createGenericName(scope, "EPSG", "4326"));
+ Validators.validate((ReferenceIdentifier) identifier);
+ Validators.validate((GenericName) identifier);
+
+ // ImmutableIdentifier properties
+ assertEquals("code", "4326", identifier.getCode());
+ assertEquals("codeSpace", "EPSG", identifier.getCodeSpace());
+ assertEquals("authority", "OGP", identifier.getAuthority().getTitle().toString());
assertNull ("version", identifier.getVersion());
assertNull ("remarks", identifier.getRemarks());
assertFalse ("isDeprecated", identifier.isDeprecated());
@@ -60,7 +95,7 @@ public final strictfp class NamedIdentif
assertEquals("tip", "4326", identifier.tip().toString());
assertEquals("head", "EPSG", identifier.head().toString());
assertEquals("name", "EPSG:4326", identifier.toString());
- assertTrue ("scope", identifier.scope().isGlobal());
+ assertSame ("scope", scope, identifier.scope());
}
/**
@@ -101,7 +136,11 @@ public final strictfp class NamedIdentif
assertEquals("name", "EPSG:name", identifier.toInternationalString().toString(Locale.ENGLISH));
assertEquals("name", "EPSG:nom", identifier.toInternationalString().toString(Locale.FRENCH));
assertEquals("name", "EPSG:名前", identifier.toInternationalString().toString(Locale.JAPANESE));
- assertTrue ("scope", identifier.scope().isGlobal());
+
+ // Scope (derived from the autority)
+ final NameSpace scope = identifier.scope();
+ assertFalse ("scope", scope.isGlobal());
+ assertEquals("scope", "EPSG", scope.name().toString());
}
/**
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1576977&r1=1576976&r2=1576977&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] Wed Mar 12 22:52:24 2014
@@ -50,8 +50,14 @@ import org.junit.BeforeClass;
org.apache.sis.referencing.NamedIdentifierTest.class,
org.apache.sis.referencing.AbstractIdentifiedObjectTest.class,
org.apache.sis.referencing.AbstractReferenceSystemTest.class,
+ org.apache.sis.referencing.BuilderTest.class,
org.apache.sis.parameter.DefaultParameterDescriptorTest.class,
+ org.apache.sis.parameter.DefaultParameterDescriptorGroupTest.class,
org.apache.sis.parameter.DefaultParameterValueTest.class,
+ org.apache.sis.parameter.DefaultParameterValueGroupTest.class,
+ org.apache.sis.parameter.ParametersTest.class,
+ org.apache.sis.parameter.ParameterBuilderTest.class,
+ org.apache.sis.parameter.ParameterFormatTest.class,
org.apache.sis.referencing.datum.BursaWolfParametersTest.class,
org.apache.sis.referencing.datum.TimeDependentBWPTest.class,
org.apache.sis.referencing.datum.DefaultEllipsoidTest.class,
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java?rev=1576977&r1=1576976&r2=1576977&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java [UTF-8] Wed Mar 12 22:52:24 2014
@@ -18,6 +18,7 @@ package org.apache.sis.internal.util;
import java.util.*;
import java.lang.reflect.Array;
+import org.opengis.util.CodeList;
import org.apache.sis.util.Static;
import org.apache.sis.util.collection.CodeListSet;
import org.apache.sis.util.resources.Errors;
@@ -202,6 +203,26 @@ public final class CollectionsExt extend
}
/**
+ * Creates an initially empty set for elements of the given type.
+ * This method will creates specialized set for code lists and enumerations.
+ *
+ * @param <E> The type of elements in the set.
+ * @param type The type of elements in the set.
+ * @param count The expected number of elements to put in the set.
+ * @return A new set for elements of the given type.
+ */
+ @SuppressWarnings({"unchecked","rawtypes"})
+ public static <E> Set<E> createSetForType(final Class<E> type, final int count) {
+ if (CodeList.class.isAssignableFrom(type)) {
+ return new CodeListSet((Class) type);
+ }
+ if (Enum.class.isAssignableFrom(type)) {
+ return EnumSet.noneOf((Class) type);
+ }
+ return new LinkedHashSet<E>(hashMapCapacity(count));
+ }
+
+ /**
* Returns the specified array as an immutable set, or {@code null} if the array is null.
* If the given array contains duplicated elements, i.e. elements that are equal in the
* sense of {@link Object#equals(Object)}, then only the last instance of the duplicated
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/X364.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/X364.java?rev=1576977&r1=1576976&r2=1576977&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/X364.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/X364.java [UTF-8] Wed Mar 12 22:52:24 2014
@@ -208,7 +208,7 @@ search: do {
return buffer.append(text, fromIndex, toIndex);
}
}
- return text;
+ return text.subSequence(fromIndex, toIndex);
}
/**
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java?rev=1576977&r1=1576976&r2=1576977&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java [UTF-8] Wed Mar 12 22:52:24 2014
@@ -29,9 +29,13 @@ import java.text.ParsePosition;
import java.text.NumberFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
+import javax.measure.unit.Unit;
+import javax.measure.unit.UnitFormat;
import org.apache.sis.measure.Angle;
import org.apache.sis.measure.AngleFormat;
+import org.apache.sis.measure.Range;
+import org.apache.sis.measure.RangeFormat;
import org.apache.sis.util.Localized;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.collection.BackingStoreException;
@@ -272,7 +276,7 @@ public abstract class CompoundFormat<T>
*
* @param object The object to format.
* @param toAppendTo Where to format the object.
- * @throws IOException If an error occurred while writing in the given appender.
+ * @throws IOException If an error occurred while writing to the given appendable.
*/
public abstract void format(T object, Appendable toAppendTo) throws IOException;
@@ -365,6 +369,9 @@ public abstract class CompoundFormat<T>
* <tr><td>{@link Angle}</td> <td>{@link AngleFormat}</td></tr>
* <tr><td>{@link Date}</td> <td>{@link DateFormat}</td></tr>
* <tr><td>{@link Number}</td> <td>{@link NumberFormat}</td></tr>
+ * <tr><td>{@link Unit}</td> <td>{@link UnitFormat}</td></tr>
+ * <tr><td>{@link Range}</td> <td>{@link RangeFormat}</td></tr>
+ * <tr><td>{@link Class}</td> <td>(internal)</td></tr>
* </table>
*
* Subclasses can override this method for adding more types, or for configuring the
@@ -404,6 +411,10 @@ public abstract class CompoundFormat<T>
return format;
} else if (valueType == Angle.class) {
return AngleFormat.getInstance(locale);
+ } else if (valueType == Unit.class) {
+ return UnitFormat.getInstance(locale);
+ } else if (valueType == Range.class) {
+ return new RangeFormat(locale);
} else if (valueType == Class.class) {
return ClassFormat.INSTANCE;
}
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java?rev=1576977&r1=1576976&r2=1576977&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java [UTF-8] Wed Mar 12 22:52:24 2014
@@ -526,6 +526,14 @@ public class TableAppender extends Appen
/**
* Writes an horizontal separator.
*/
+ public void appendHorizontalSeparator() {
+ writeHorizontalSeparator();
+ }
+
+ /**
+ * @deprecated Renamed {@link #appendHorizontalSeparator()}.
+ */
+ @Deprecated
public void writeHorizontalSeparator() {
if (currentColumn != 0 || buffer.length() != 0) {
nextLine();
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/io/TabularFormat.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/io/TabularFormat.java?rev=1576977&r1=1576976&r2=1576977&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/io/TabularFormat.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/io/TabularFormat.java [UTF-8] Wed Mar 12 22:52:24 2014
@@ -40,15 +40,13 @@ import org.apache.sis.internal.jdk7.JDK7
* <li>{@link #setColumnSeparatorPattern(String)}</li>
* </ul>
*
- * For implementors, this base class takes care of splitting a column separator pattern into
- * its components ({@link #beforeFill}, {@link #fillCharacter} and {@link #columnSeparator})
- * for easier usage in {@code format(…)} method implementations. Subclasses can use those fields
- * like below:
+ * {@section Note for subclass implementions}
+ * This base class takes care of splitting a column separator pattern into its components
+ * ({@link #beforeFill}, {@link #fillCharacter} and {@link #columnSeparator})
+ * for easier usage in {@code format(…)} method implementations.
+ * Subclasses can use those fields like below:
*
- * <table class="sis"><tr>
- * <th>Table with no border</th>
- * <th>Table with a border</th>
- * </tr><tr><td>
+ * <p><b>Formatting table without border:</b></p>
* {@preformat java
* TableAppender table = new TableAppender(out, "");
* // ... do some work, then add a column separator:
@@ -56,14 +54,14 @@ import org.apache.sis.internal.jdk7.JDK7
* table.nextColumn(fillCharacter);
* table.append(columnSeparator);
* }
- * </td><td>
+ *
+ * <p><b>Formatting table with a border:</b></p>
* {@preformat java
* TableAppender table = new TableAppender(out, columnSeparator);
* // ... do some work, then add a column separator:
* table.append(beforeFill);
* table.nextColumn(fillCharacter);
* }
- * </td></tr></table>
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3
@@ -101,7 +99,7 @@ public abstract class TabularFormat<T> e
* This is the character between the "{@code [ ]}" pair of brackets in the pattern given
* to the {@link #setColumnSeparatorPattern(String)} method.
*
- * Subclasses will typically use this value in calls to {@link TableAppender#nextColumn(char)}.
+ * <p>Subclasses will typically use this value in calls to {@link TableAppender#nextColumn(char)}.</p>
*/
protected char fillCharacter;
@@ -217,14 +215,15 @@ public abstract class TabularFormat<T> e
* <li>The repeated character (specified inside the pair of brackets) is mandatory.</li>
* <li>In the current implementation, the repeated character must be in the
* {@linkplain Character#isBmpCodePoint(int) Basic Multilanguage Plane}.</li>
- * <li>If {@code '/'} is present, anything on its right must be compliant
+ * <li>If {@code '/'} is present, anything on its right side shall be compliant
* with the {@link Pattern} syntax.</li>
* </ul>
*
- * {@section Example}
+ * <div class="note"><b>Example:</b>
* The {@code "?……[…] "} pattern means "<cite>If the next value is non-null, then insert the
* {@code "……"} string, repeat the {@code '…'} character as many time as needed (may be zero),
* then insert a space</cite>".
+ * </div>
*
* @param pattern The pattern of the new column separator.
* @throws IllegalArgumentException If the given pattern is illegal.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/math/StatisticsFormat.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/math/StatisticsFormat.java?rev=1576977&r1=1576976&r2=1576977&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/math/StatisticsFormat.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/math/StatisticsFormat.java [UTF-8] Wed Mar 12 22:52:24 2014
@@ -121,12 +121,12 @@ public class StatisticsFormat extends Ta
}
/**
- * Returns the kind of objects formatted by this class.
+ * Returns the type of objects formatted by this class.
*
* @return {@code Statistics.class}
*/
@Override
- public Class<Statistics> getValueType() {
+ public final Class<Statistics> getValueType() {
return Statistics.class;
}
@@ -229,7 +229,7 @@ public class StatisticsFormat extends Ta
*
* @param stats The statistics to format.
* @param toAppendTo Where to format the statistics.
- * @throws IOException If an error occurred while writing in the given appender.
+ * @throws IOException If an error occurred while writing to the given appendable.
*/
@Override
public void format(Statistics stats, final Appendable toAppendTo) throws IOException {
@@ -248,7 +248,7 @@ public class StatisticsFormat extends Ta
*
* @param stats The statistics to format.
* @param toAppendTo Where to format the statistics.
- * @throws IOException If an error occurred while writing in the given appender.
+ * @throws IOException If an error occurred while writing to the given appendable.
*/
public void format(final Statistics[] stats, final Appendable toAppendTo) throws IOException {
/*
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/MeasurementRange.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/MeasurementRange.java?rev=1576977&r1=1576976&r2=1576977&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/MeasurementRange.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/MeasurementRange.java [UTF-8] Wed Mar 12 22:52:24 2014
@@ -231,6 +231,8 @@ public class MeasurementRange<E extends
/**
* {@inheritDoc}
+ *
+ * @return {@inheritDoc}
*/
@Override
@SuppressWarnings("unchecked")
@@ -343,6 +345,7 @@ public class MeasurementRange<E extends
* the value of the other range to the unit of measurement of this range before to perform
* the operation.
*
+ * @return {@inheritDoc}
* @throws IllegalArgumentException is the given range is an instance of
* {@code MeasurementRange} using incommensurable unit of measurement.
*/
@@ -357,6 +360,7 @@ public class MeasurementRange<E extends
* the value of the other range to the unit of measurement of this range before to perform
* the operation.
*
+ * @return {@inheritDoc}
* @throws IllegalArgumentException is the given range is an instance of
* {@code MeasurementRange} using incommensurable unit of measurement.
*/
@@ -371,6 +375,7 @@ public class MeasurementRange<E extends
* the value of the other range to the unit of measurement of this range before to perform
* the operation.
*
+ * @return {@inheritDoc}
* @throws IllegalArgumentException is the given range is an instance of
* {@code MeasurementRange} using incommensurable unit of measurement.
*/
@@ -385,6 +390,7 @@ public class MeasurementRange<E extends
* the value of the other range to the unit of measurement of this range before to perform
* the operation.
*
+ * @return {@inheritDoc}
* @throws IllegalArgumentException is the given range is an instance of
* {@code MeasurementRange} using incommensurable unit of measurement.
*/
@@ -399,6 +405,7 @@ public class MeasurementRange<E extends
* the value of the other range to the unit of measurement of this range before to perform
* the operation.
*
+ * @return {@inheritDoc}
* @throws IllegalArgumentException is the given range is an instance of
* {@code MeasurementRange} using incommensurable unit of measurement.
*/
@@ -409,15 +416,21 @@ public class MeasurementRange<E extends
/**
* Compares this range with the specified object for equality.
+ *
+ * @return {@inheritDoc}
*/
@Override
public boolean equals(final Object object) {
- if (super.equals(object)) {
- if (object instanceof MeasurementRange<?>) {
- return Objects.equals(unit, ((MeasurementRange<?>) object).unit);
- }
- return true;
- }
- return false;
+ return super.equals(object) && Objects.equals(unit, ((MeasurementRange<?>) object).unit);
+ }
+
+ /**
+ * Returns a hash code value for this measurement range.
+ *
+ * @return {@inheritDoc}
+ */
+ @Override
+ public int hashCode() {
+ return super.hashCode() + Objects.hashCode(unit);
}
}
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Range.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Range.java?rev=1576977&r1=1576976&r2=1576977&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Range.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Range.java [UTF-8] Wed Mar 12 22:52:24 2014
@@ -126,12 +126,17 @@ public class Range<E extends Comparable<
isMinIncluded = range.isMinIncluded;
maxValue = range.maxValue;
isMaxIncluded = range.isMaxIncluded;
- assert validate();
+ assert validate() : elementType;
}
/**
* Creates a new range bounded by the given endpoint values.
*
+ * <div class="note"><b>Assertion:</b>
+ * This constructor verifies the {@code minValue} and {@code maxValue} arguments type if Java assertions
+ * are enabled. This verification is not performed in normal execution because theoretically unnecessary
+ * unless Java generic types have been tricked.</div>
+ *
* @param elementType The base type of the range elements.
* @param minValue The minimal value, or {@code null} if none.
* @param isMinIncluded {@code true} if the minimal value is inclusive, or {@code false} if exclusive.
@@ -152,7 +157,7 @@ public class Range<E extends Comparable<
this.isMinIncluded = isMinIncluded && (minValue != null);
this.maxValue = maxValue;
this.isMaxIncluded = isMaxIncluded && (maxValue != null);
- assert validate();
+ assert validate() : elementType;
}
/**
@@ -659,6 +664,8 @@ public class Range<E extends Comparable<
}
final Unit<?> unit = unit();
if (unit != null) {
+ // No need to check if we should omit the space because Unit.toString()
+ // uses UCUM format, so we will never have symbol like the ° one.
buffer.append(' ').append(unit);
}
return buffer.toString();
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/RangeFormat.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/RangeFormat.java?rev=1576977&r1=1576976&r2=1576977&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/RangeFormat.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/RangeFormat.java [UTF-8] Wed Mar 12 22:52:24 2014
@@ -16,6 +16,8 @@
*/
package org.apache.sis.measure;
+import java.util.Map;
+import java.util.HashMap;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
@@ -89,7 +91,7 @@ import org.apache.sis.util.resources.Err
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3 (derived from geotk-3.06)
- * @version 0.3
+ * @version 0.4
* @module
*
* @see Range#toString()
@@ -289,6 +291,13 @@ public class RangeFormat extends Format
protected final UnitFormat unitFormat;
/**
+ * Whether we should insert a space between the bracket and the unit symbol.
+ *
+ * @see #insertSpaceBeforeUnit(Unit)
+ */
+ private transient Map<Unit<?>,Boolean> insertSpaceBeforeUnit;
+
+ /**
* Creates a new format for parsing and formatting {@linkplain NumberRange number ranges}
* using the {@linkplain Locale#getDefault() default locale}.
*/
@@ -461,6 +470,23 @@ public class RangeFormat extends Format
}
/**
+ * Returns whether we should insert a space between the bracket and the unit symbol.
+ * We cache the result because checking for this condition forces us to format the unit symbol twice.
+ */
+ private boolean insertSpaceBeforeUnit(final Unit<?> unit) {
+ if (insertSpaceBeforeUnit == null) {
+ insertSpaceBeforeUnit = new HashMap<Unit<?>,Boolean>();
+ }
+ Boolean value = insertSpaceBeforeUnit.get(unit);
+ if (value == null) {
+ final String symbol = unitFormat.format(unit);
+ value = !symbol.isEmpty() && Character.isLetterOrDigit(symbol.codePointAt(0));
+ insertSpaceBeforeUnit.put(unit, value);
+ }
+ return value;
+ }
+
+ /**
* Returns the {@code *_FIELD} constant for the given field position, or -1 if none.
*/
private static int getField(final FieldPosition position) {
@@ -574,7 +600,9 @@ public class RangeFormat extends Format
} else {
final Format format;
if (field == UNIT_FIELD) {
- startPosition = toAppendTo.append(' ').length();
+ if (insertSpaceBeforeUnit((Unit) value)) {
+ startPosition = toAppendTo.append(' ').length();
+ }
format = unitFormat;
} else {
format = elementFormat;
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Classes.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Classes.java?rev=1576977&r1=1576976&r2=1576977&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Classes.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Classes.java [UTF-8] Wed Mar 12 22:52:24 2014
@@ -321,8 +321,7 @@ public final class Classes extends Stati
*/
private static Set<Class<?>> getInterfaceSet(final Class<?> type, Set<Class<?>> addTo) {
final Class<?>[] interfaces = type.getInterfaces();
- for (int i=0; i<interfaces.length; i++) {
- final Class<?> candidate = interfaces[i];
+ for (final Class<?> candidate : interfaces) {
if (addTo == null) {
addTo = new LinkedHashSet<Class<?>>(hashMapCapacity(interfaces.length));
}
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java?rev=1576977&r1=1576976&r2=1576977&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java [UTF-8] Wed Mar 12 22:52:24 2014
@@ -189,9 +189,9 @@ public class TreeTableFormat extends Tab
}
/**
- * Returns the type of object formatted by this class, which is {@link TreeTable}.
+ * Returns the type of objects formatted by this class.
*
- * @return {@inheritDoc}
+ * @return {@code TreeTable.class}
*/
@Override
public final Class<TreeTable> getValueType() {
@@ -593,7 +593,7 @@ public class TreeTableFormat extends Tab
private final Map<Object,Object> parentObjects;
/**
- * Creates a new instance which will write in the given appendable.
+ * Creates a new instance which will write to the given appendable.
*
* @param out Where to format the tree.
* @param column The columns of the tree table to format.
@@ -731,7 +731,7 @@ public class TreeTableFormat extends Tab
*
* @param tree The tree to format.
* @param toAppendTo Where to format the tree.
- * @throws IOException If an error occurred while writing in the given appender.
+ * @throws IOException If an error occurred while writing to the given appendable.
*
* @see TreeTables#toString(TreeTable)
*/
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java?rev=1576977&r1=1576976&r2=1576977&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java [UTF-8] Wed Mar 12 22:52:24 2014
@@ -94,7 +94,7 @@ public abstract class AbstractName imple
/**
* Returns a SIS name implementation with the values of the given arbitrary implementation.
- * This method performs the first applicable actions in the following choices:
+ * This method performs the first applicable action in the following choices:
*
* <ul>
* <li>If the given object is {@code null}, then this method returns {@code null}.</li>
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java?rev=1576977&r1=1576976&r2=1576977&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java [UTF-8] Wed Mar 12 22:52:24 2014
@@ -146,7 +146,7 @@ public class DefaultLocalName extends Ab
/**
* Returns a SIS local name implementation with the values of the given arbitrary implementation.
- * This method performs the first applicable actions in the following choices:
+ * This method performs the first applicable action in the following choices:
*
* <ul>
* <li>If the given object is {@code null}, then this method returns {@code null}.</li>
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java?rev=1576977&r1=1576976&r2=1576977&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java [UTF-8] Wed Mar 12 22:52:24 2014
@@ -244,8 +244,7 @@ public class DefaultNameFactory extends
/**
* Constructs a generic name from a qualified name.
* This method splits the given name around a separator inferred from the given scope, or the
- * {@value org.apache.sis.util.iso.DefaultNameSpace#DEFAULT_SEPARATOR} separator if the given
- * scope is null.
+ * {@link DefaultNameSpace#DEFAULT_SEPARATOR ':'} separator if the given scope is null.
*
* @param scope The {@linkplain AbstractName#scope() scope} of the generic name to
* be created, or {@code null} for a global namespace.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java?rev=1576977&r1=1576976&r2=1576977&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java [UTF-8] Wed Mar 12 22:52:24 2014
@@ -21,7 +21,6 @@ import java.util.List;
import java.util.ListIterator;
import java.util.Locale;
import java.io.Serializable;
-import java.io.ObjectStreamException;
import org.opengis.util.NameSpace;
import org.opengis.util.LocalName;
import org.opengis.util.ScopedName;
@@ -64,8 +63,8 @@ public class DefaultNameSpace implements
private static final long serialVersionUID = 8272640747799127007L;
/**
- * The default separator, which is {@value}. The separator is inserted between the
- * namespace and any {@linkplain GenericName generic name} in that namespace.
+ * The default separator, which is {@code ':'}. The separator is inserted between
+ * the namespace and any {@linkplain GenericName generic name} in that namespace.
*/
public static final char DEFAULT_SEPARATOR = ':';
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecordType.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecordType.java?rev=1576977&r1=1576976&r2=1576977&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecordType.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecordType.java [UTF-8] Wed Mar 12 22:52:24 2014
@@ -134,7 +134,7 @@ public class DefaultRecordType implement
/**
* Returns a SIS implementation with the name and members of the given arbitrary implementation.
- * This method performs the first applicable actions in the following choices:
+ * This method performs the first applicable action in the following choices:
*
* <ul>
* <li>If the given object is {@code null}, then this method returns {@code null}.</li>
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java?rev=1576977&r1=1576976&r2=1576977&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java [UTF-8] Wed Mar 12 22:52:24 2014
@@ -713,10 +713,9 @@ public final class Types extends Static
* <ul>
* <li>{@link GenericName}, to be casted and returned as-is.</li>
* <li>{@link CharSequence} (usually a {@link String} or an {@link InternationalString}),
- * to be parsed as a generic name using the
- * {@value org.apache.sis.util.iso.DefaultNameSpace#DEFAULT_SEPARATOR} separator.</li>
+ * to be parsed as a generic name using the {@link DefaultNameSpace#DEFAULT_SEPARATOR ':'} separator.</li>
* <li>{@link Identifier}, its {@linkplain Identifier#getCode() code} to be parsed as a generic name
- * using the {@value org.apache.sis.util.iso.DefaultNameSpace#DEFAULT_SEPARATOR} separator.</li>
+ * using the {@link DefaultNameSpace#DEFAULT_SEPARATOR ':'} separator.</li>
* </ul>
*
* If {@code value} is an array or a collection containing {@code null} elements,
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java?rev=1576977&r1=1576976&r2=1576977&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java [UTF-8] Wed Mar 12 22:52:24 2014
@@ -257,7 +257,7 @@ public class WarningListeners<S> impleme
}
}
}
- throw new NoSuchElementException(Errors.format(Errors.Keys.NoSuchElement_1, listener));
+ throw new NoSuchElementException(Errors.format(Errors.Keys.ElementNotFound_1, listener));
}
/**
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1576977&r1=1576976&r2=1576977&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] Wed Mar 12 22:52:24 2014
@@ -64,6 +64,11 @@ public final class Errors extends Indexe
}
/**
+ * Name “{2}” is ambiguous because it can be understood as either “{0}” or “{1}”.
+ */
+ public static final short AmbiguousName_3 = 151;
+
+ /**
* No element can be added to this set because properties ‘{0}’ and ‘{1}’ are mutually
* exclusive.
*/
@@ -165,11 +170,21 @@ public final class Errors extends Indexe
public static final short DuplicatedOption_1 = 18;
/**
+ * Name or alias for parameter “{0}” at index {1} conflict with name “{2}” at index {3}.
+ */
+ public static final short DuplicatedParameterName_4 = 150;
+
+ /**
* Element “{0}” is already present.
*/
public static final short ElementAlreadyPresent_1 = 19;
/**
+ * Element “{0}” has not been found.
+ */
+ public static final short ElementNotFound_1 = 70;
+
+ /**
* Argument ‘{0}’ shall not be empty.
*/
public static final short EmptyArgument_1 = 20;
@@ -398,6 +413,11 @@ public final class Errors extends Indexe
public static final short MismatchedMatrixSize_4 = 60;
/**
+ * Mismatched descriptor for “{0}” parameter.
+ */
+ public static final short MismatchedParameterDescriptor_1 = 146;
+
+ /**
* No authority was specified for code “{0}”. The expected syntax is “AUTHORITY:CODE”.
*/
public static final short MissingAuthority_1 = 135;
@@ -458,16 +478,6 @@ public final class Errors extends Indexe
public static final short NoSuchAuthorityCode_3 = 137;
/**
- * Element “{0}” has not been found.
- */
- public static final short NoSuchElement_1 = 70;
-
- /**
- * No property named “{0}” has been found in “{1}”.
- */
- public static final short NoSuchProperty_2 = 71;
-
- /**
* No unit of measurement has been specified.
*/
public static final short NoUnit = 72;
@@ -608,6 +618,16 @@ public final class Errors extends Indexe
public static final short OddArrayLength_1 = 98;
/**
+ * No parameter named “{1}” has been found in “{0}”.
+ */
+ public static final short ParameterNotFound_2 = 147;
+
+ /**
+ * No property named “{1}” has been found in “{0}”.
+ */
+ public static final short PropertyNotFound_2 = 71;
+
+ /**
* Recursive call while creating an object for the “{0}” key.
*/
public static final short RecursiveCreateCallForKey_1 = 99;
@@ -638,11 +658,21 @@ public final class Errors extends Indexe
public static final short TooFewArguments_2 = 104;
/**
+ * Too few occurrences of “{1}”. Expected at least {0} of them.
+ */
+ public static final short TooFewOccurrences_2 = 148;
+
+ /**
* Expected at most {0} argument{0,choice,1#|2#s}, but got {1}.
*/
public static final short TooManyArguments_2 = 105;
/**
+ * Too many occurrences of “{1}”. There is already {0} of them.
+ */
+ public static final short TooManyOccurrences_2 = 149;
+
+ /**
* Tree depth exceeds the maximum.
*/
public static final short TreeDepthExceedsMaximum = 145;
@@ -788,12 +818,12 @@ public final class Errors extends Indexe
public static final short ValueAlreadyDefined_1 = 131;
/**
- * Value ‘{0}’={1} is invalid. Expected a number greater than 0.
+ * Value ‘{0}’ = {1} is invalid. Expected a number greater than 0.
*/
public static final short ValueNotGreaterThanZero_2 = 132;
/**
- * Value ‘{0}’={3} is invalid. Expected a value in the [{1} … {2}] range.
+ * Value ‘{0}’ = {3} is invalid. Expected a value in the [{1} … {2}] range.
*/
public static final short ValueOutOfRange_4 = 133;
}
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties?rev=1576977&r1=1576976&r2=1576977&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties [ISO-8859-1] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties [ISO-8859-1] Wed Mar 12 22:52:24 2014
@@ -24,6 +24,7 @@
# programmatic parameters do not have to be last in the formatted text, since each localized message
# can reorder the parameters as they want.
#
+AmbiguousName_3 = Name \u201c{2}\u201d is ambiguous because it can be understood as either \u201c{0}\u201d or \u201c{1}\u201d.
CanNotAddToExclusiveSet_2 = No element can be added to this set because properties \u2018{0}\u2019 and \u2018{1}\u2019 are mutually exclusive.
CanNotConnectTo_1 = Can not connect to \u201c{0}\u201d.
CanNotConvertFromType_2 = Can not convert from type \u2018{0}\u2019 to type \u2018{1}\u2019.
@@ -44,7 +45,9 @@ DeadThread_1 = Thre
DuplicatedElement_1 = Element \u201c{0}\u201d is duplicated.
DuplicatedIdentifier_1 = Identifier \u201c{0}\u201d is duplicated.
DuplicatedOption_1 = Option \u201c{0}\u201d is duplicated.
+DuplicatedParameterName_4 = Name or alias for parameter \u201c{0}\u201d at index {1} conflict with name \u201c{2}\u201d at index {3}.
ElementAlreadyPresent_1 = Element \u201c{0}\u201d is already present.
+ElementNotFound_1 = Element \u201c{0}\u201d has not been found.
EmptyArgument_1 = Argument \u2018{0}\u2019 shall not be empty.
EmptyDictionary = The dictionary shall contain at least one entry.
EmptyEnvelope2D = Envelope must be at least two-dimensional and non-empty.
@@ -87,6 +90,7 @@ KeyCollision_1 = A di
MandatoryAttribute_2 = Attribute \u201c{0}\u201d is mandatory for an object of type \u2018{1}\u2019.
MismatchedArrayLengths = Mismatched array lengths.
MismatchedCRS = The coordinate reference system must be the same for all objects.
+MismatchedParameterDescriptor_1 = Mismatched descriptor for \u201c{0}\u201d parameter.
MismatchedDimension_2 = Mismatched object dimensions: {0}D and {1}D.
MismatchedDimension_3 = Argument \u2018{0}\u2019 has {2} dimension{2,choice,1#|2#s}, while {1} was expected.
MismatchedMatrixSize_4 = Mismatched matrix sizes: expected {0}\u00d7{1} but got {2}\u00d7{3}.
@@ -124,8 +128,6 @@ NotASkewSymmetricMatrix = Matr
NotAUnicodeIdentifier_1 = Text \u201c{0}\u201d is not a Unicode identifier.
NotComparableClass_1 = Class \u2018{0}\u2019 is not a comparable.
NoSuchAuthorityCode_3 = No code \u201c{2}\u201d from authority \u201c{0}\u201d found for object of type \u2018{1}\u2019.
-NoSuchElement_1 = Element \u201c{0}\u201d has not been found.
-NoSuchProperty_2 = No property named \u201c{0}\u201d has been found in \u201c{1}\u201d.
NoUnit = No unit of measurement has been specified.
NullArgument_1 = Argument \u2018{0}\u2019 shall not be null.
NullCollectionElement_1 = \u2018{0}\u2019 collection does not accept null elements.
@@ -133,13 +135,17 @@ NullCollectionElement_1 = \u20
NullMapKey = Null key is not allowed in this dictionary.
NullMapValue = Null values are not allowed in this dictionary.
OddArrayLength_1 = Array length is {0}, while we expected an even length.
+ParameterNotFound_2 = No parameter named \u201c{1}\u201d has been found in \u201c{0}\u201d.
+PropertyNotFound_2 = No property named \u201c{1}\u201d has been found in \u201c{0}\u201d.
SingularMatrix = Matrix is singular.
RecursiveCreateCallForKey_1 = Recursive call while creating an object for the \u201c{0}\u201d key.
RequireDecimalSeparator = A decimal separator is required.
StalledThread_1 = Thread \u201c{0}\u201d seems stalled.
StreamIsForwardOnly_1 = Can not move backward in the \u201c{0}\u201d stream.
TooFewArguments_2 = Expected at least {0} argument{0,choice,1#|2#s}, but got {1}.
+TooFewOccurrences_2 = Too few occurrences of \u201c{1}\u201d. Expected at least {0} of them.
TooManyArguments_2 = Expected at most {0} argument{0,choice,1#|2#s}, but got {1}.
+TooManyOccurrences_2 = Too many occurrences of \u201c{1}\u201d. There is already {0} of them.
TreeDepthExceedsMaximum = Tree depth exceeds the maximum.
UndefinedOrderingForElements_2 = Ordering between \u201c{0}\u201d and \u201c{1}\u201d elements is undefined.
UnexpectedArrayLength_2 = Expected an array of length {0}, but got {1}.
@@ -169,5 +175,5 @@ UnsupportedOperation_1 = The
UnsupportedType_1 = The \u2018{0}\u2019 type is unsupported.
UnsupportedVersion_1 = Version {0} is not supported.
ValueAlreadyDefined_1 = A value is already defined for \u201c{0}\u201d.
-ValueNotGreaterThanZero_2 = Value \u2018{0}\u2019={1} is invalid. Expected a number greater than 0.
-ValueOutOfRange_4 = Value \u2018{0}\u2019={3} is invalid. Expected a value in the [{1} \u2026 {2}] range.
+ValueNotGreaterThanZero_2 = Value \u2018{0}\u2019 = {1} is invalid. Expected a number greater than 0.
+ValueOutOfRange_4 = Value \u2018{0}\u2019 = {3} is invalid. Expected a value in the [{1} \u2026 {2}] range.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties?rev=1576977&r1=1576976&r2=1576977&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties [ISO-8859-1] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties [ISO-8859-1] Wed Mar 12 22:52:24 2014
@@ -14,6 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+AmbiguousName_3 = Le nom \u00ab\u202f{2}\u202f\u00bb est ambigu\u00eb car il peut \u00eatre interpr\u00e9t\u00e9 comme \u00ab\u202f{0}\u202f\u00bb ou \u00ab\u202f{1}\u202f\u00bb.
CanNotAddToExclusiveSet_2 = Aucun \u00e9l\u00e9ment ne peut \u00eatre ajout\u00e9 \u00e0 cet ensemble car les propri\u00e9t\u00e9s \u2018{0}\u2019 et \u2018{1}\u2019 sont mutuellement exclusives.
CanNotConnectTo_1 = Ne peut pas se connecter \u00e0 \u00ab\u202f{0}\u202f\u00bb.
CanNotConvertFromType_2 = Ne peut pas convertir du type \u2018{0}\u2019 vers le type \u2018{1}\u2019.
@@ -34,7 +35,9 @@ DeadThread_1 = La t
DuplicatedElement_1 = L\u2019\u00e9lement \u00ab\u202f{0}\u202f\u00bb est dupliqu\u00e9.
DuplicatedIdentifier_1 = L\u2019identifiant \u00ab\u202f{0}\u202f\u00bb est dupliqu\u00e9.
DuplicatedOption_1 = L\u2019option \u00ab\u202f{0}\u202f\u00bb est dupliqu\u00e9e.
+DuplicatedParameterName_4 = Le nom ou un alias pour le param\u00e8tre \u00ab\u202f{0}\u202f\u00bb \u00e0 l\u2019index {1} duplique le nom \u00ab\u202f{2}\u202f\u00bb \u00e0 l\u2019index {3}.
ElementAlreadyPresent_1 = L\u2019\u00e9lement \u00ab\u202f{0}\u202f\u00bb est d\u00e9j\u00e0 pr\u00e9sent.
+ElementNotFound_1 = L\u2019\u00e9lement \u00ab\u202f{0}\u202f\u00bb n\u2019a pas \u00e9t\u00e9 trouv\u00e9.
EmptyArgument_1 = L\u2019argument \u2018{0}\u2019 ne doit pas \u00eatre vide.
EmptyDictionary = Le dictionnaire doit contenir au moins une entr\u00e9e.
EmptyEnvelope2D = L\u2019enveloppe doit avoir au moins deux dimensions et ne pas \u00eatre vide.
@@ -77,6 +80,7 @@ KeyCollision_1 = Une
MandatoryAttribute_2 = L\u2019attribut \u00ab\u202f{0}\u202f\u00bb est obligatoire pour un objet de type \u2018{1}\u2019.
MismatchedArrayLengths = Les dimensions des tableaux ne correspondent pas.
MismatchedCRS = Le syst\u00e8me de r\u00e9f\u00e9rence des coordonn\u00e9es doit \u00eatre le m\u00eame pour tous les objets.
+MismatchedParameterDescriptor_1 = Le descripteur du param\u00e8tre \u00ab\u202f{0}\u202f\u00bb ne correspond pas.
MismatchedDimension_2 = Les dimensions des objets ({0}D et {1}D) ne concordent pas.
MismatchedDimension_3 = L\u2019argument \u2018{0}\u2019 a {2} dimension{2,choice,1#|2#s}, alors qu\u2019on en attendait {1}.
MismatchedMatrixSize_4 = Une matrice de taille de {0}\u00d7{1} \u00e9tait attendue mais la matrice donn\u00e9es est de taille {2}\u00d7{3}.
@@ -114,21 +118,23 @@ NotASkewSymmetricMatrix = La m
NotAUnicodeIdentifier_1 = Le texte \u00ab\u202f{0}\u202f\u00bb n\u2019est pas un identifiant Unicode.
NotComparableClass_1 = La classe \u2018{0}\u2019 n\u2019est pas comparable.
NoSuchAuthorityCode_3 = Aucun code \u00ab\u202f{2}\u202f\u00bb de l\u2019autorit\u00e9 \u00ab\u202f{0}\u202f\u00bb n\u2019a \u00e9t\u00e9 trouv\u00e9 pour un objet de type \u2018{1}\u2019.
-NoSuchElement_1 = L\u2019\u00e9lement \u00ab\u202f{0}\u202f\u00bb n\u2019a pas \u00e9t\u00e9 trouv\u00e9.
-NoSuchProperty_2 = Aucune propri\u00e9t\u00e9 nomm\u00e9e \u00ab\u202f{0}\u202f\u00bb n\u2019a \u00e9t\u00e9 trouv\u00e9e dans \u00ab\u202f{1}\u202f\u00bb.
NoUnit = Aucune unit\u00e9 de mesure n\u2019a \u00e9t\u00e9 sp\u00e9cifi\u00e9e.
NullArgument_1 = L\u2019argument \u2018{0}\u2019 ne doit pas \u00eatre nul.
NullCollectionElement_1 = La collection \u2018{0}\u2019 n\u2019accepte pas les valeurs nulles.
NullMapKey = La cl\u00e9 nulle n\u2019est pas autoris\u00e9e dans ce dictionnaire.
NullMapValue = Les valeurs nulles ne sont pas autoris\u00e9es dans ce dictionnaire.
OddArrayLength_1 = La longueur du tableau est {0}, alors qu\u2019on attendait une longueur paire.
+ParameterNotFound_2 = Aucun param\u00e8tre nomm\u00e9 \u00ab\u202f{1}\u202f\u00bb n\u2019a \u00e9t\u00e9 trouv\u00e9 dans \u00ab\u202f{0}\u202f\u00bb.
+PropertyNotFound_2 = Aucune propri\u00e9t\u00e9 nomm\u00e9e \u00ab\u202f{1}\u202f\u00bb n\u2019a \u00e9t\u00e9 trouv\u00e9e dans \u00ab\u202f{0}\u202f\u00bb.
RecursiveCreateCallForKey_1 = Appel r\u00e9cursif lors de la cr\u00e9ation d\u2019un objet pour la cl\u00e9 \u00ab\u202f{0}\u202f\u00bb.
RequireDecimalSeparator = Un s\u00e9parateur d\u00e9cimal est requis.
SingularMatrix = La matrice est singuli\u00e8re.
StalledThread_1 = La t\u00e2che \u00ab\u202f{0}\u202f\u00bb semble bloqu\u00e9e.
StreamIsForwardOnly_1 = Ne peut pas reculer dans le flux de donn\u00e9es \u00ab\u202f{0}\u202f\u00bb.
TooFewArguments_2 = Au moins {0} argument{0,choice,1# \u00e9tait attendu|2#s \u00e9taient attendus}, mais seulement {1} {1,choice,1#a \u00e9t\u00e9 sp\u00e9cifi\u00e9|2#ont \u00e9t\u00e9 sp\u00e9cifi\u00e9s}.
+TooFewOccurrences_2 = Trop peu d\u2019occurrences de \u00ab\u202f{1}\u202f\u00bb. Il en faut au moins {0}.
TooManyArguments_2 = Au plus {0} argument{0,choice,1# \u00e9tait attendu|2#s \u00e9taient attendus}, mais {1} {1,choice,1#a \u00e9t\u00e9 sp\u00e9cifi\u00e9|2#ont \u00e9t\u00e9 sp\u00e9cifi\u00e9s}.
+TooManyOccurrences_2 = Trop d\u2019occurrences de \u00ab\u202f{1}\u202f\u00bb. Il en existe d\u00e9j\u00e0 {0}.
TreeDepthExceedsMaximum = La profondeur de l\u2019arbre exc\u00e8de le maximum.
UndefinedOrderingForElements_2 = L\u2019ordre entre les \u00e9l\u00e9ments \u00ab\u202f{0}\u202f\u00bb et \u00ab\u202f{1}\u202f\u00bb n\u2019est pas d\u00e9fini.
UnexpectedArrayLength_2 = Un tableau de longueur {0} \u00e9tait attendu, mais le tableau re\u00e7u est de longueur {1}.
@@ -158,5 +164,5 @@ UnsupportedOperation_1 = L\u2
UnsupportedType_1 = Le type \u2018{0}\u2019 n\u2019est pas support\u00e9.
UnsupportedVersion_1 = La version {0} n\u2019est pas support\u00e9e.
ValueAlreadyDefined_1 = Une valeur est d\u00e9j\u00e0 d\u00e9finie pour \u00ab\u202f{0}\u202f\u00bb.
-ValueNotGreaterThanZero_2 = La valeur \u2018{0}\u2019={1} n\u2019est pas valide. On attendait un nombre positif non-nul.
-ValueOutOfRange_4 = La valeur \u2018{0}\u2019={3} est invalide. Une valeur dans la plage [{1} \u2026 {2}] \u00e9tait attendue.
+ValueNotGreaterThanZero_2 = La valeur \u2018{0}\u2019 = {1} n\u2019est pas valide. On attendait un nombre positif non-nul.
+ValueOutOfRange_4 = La valeur \u2018{0}\u2019 = {3} est invalide. Une valeur dans la plage [{1} \u2026 {2}] \u00e9tait attendue.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java?rev=1576977&r1=1576976&r2=1576977&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java [UTF-8] Wed Mar 12 22:52:24 2014
@@ -55,6 +55,11 @@ public final class Vocabulary extends In
}
/**
+ * Aliases
+ */
+ public static final short Aliases = 74;
+
+ /**
* Angle
*/
public static final short Angle = 0;
@@ -130,6 +135,16 @@ public final class Vocabulary extends In
public static final short DaylightTime = 13;
/**
+ * Default value
+ */
+ public static final short DefaultValue = 71;
+
+ /**
+ * Description
+ */
+ public static final short Description = 75;
+
+ /**
* Destination
*/
public static final short Destination = 14;
@@ -365,6 +380,11 @@ public final class Vocabulary extends In
public static final short UnavailableContent = 57;
/**
+ * Units
+ */
+ public static final short Units = 72;
+
+ /**
* Unnamed
*/
public static final short Unnamed = 65;
@@ -385,6 +405,11 @@ public final class Vocabulary extends In
public static final short Value = 60;
/**
+ * Value domain
+ */
+ public static final short ValueDomain = 73;
+
+ /**
* Variables
*/
public static final short Variables = 61;