ParametersTest changes for revisions 7709:7848

This commit contains only class name changes. Reverting this commit causes compilation errors, which can be fixed only by fixing the class names in this file. Note that Apache SIS class names are different than the ones in this commit, (e.g. ParameterDefaultParameterValue), so the Apache SIS patch reproducing this commit is different.

Command line:

svn diff --extensions "--unified --ignore-space-change --ignore-all-space --ignore-eol-style" -r7709:7848 https://svn.osgeo.org/geotools/trunk/modules/library/referencing/src/test/java/org/geotools/parameter/ParametersTest.java
Revision 7709Revision 7848
 */
public void testSequence() {
    for (int i=-1000; i<=1000; i++) {
        assertEquals("Integer", i, new ParameterValue("Integer", i)          .intValue());
        assertEquals("Double",  i, new ParameterValue("Double",  i, null    ).doubleValue(), 0.0);
        assertEquals("Double",  i, new ParameterValue("Double",  i, Unit.ONE).doubleValue(), 0.0);
        assertEquals("Double",  Math.toRadians(i),
                     new ParameterValue("Double",  i, NonSI.DEGREE_ANGLE).doubleValue(SI.RADIAN), 1E-6);
    }
}
 */
public void testSequence() {
    for (int i=-1000; i<=1000; i++) {
        assertEquals("Integer", i, new Parameter("Integer", i)          .intValue());
        assertEquals("Double",  i, new Parameter("Double",  i, null    ).doubleValue(), 0.0);
        assertEquals("Double",  i, new Parameter("Double",  i, Unit.ONE).doubleValue(), 0.0);
        assertEquals("Double",  Math.toRadians(i),
                     new Parameter("Double",  i, NonSI.DEGREE_ANGLE).doubleValue(SI.RADIAN), 1E-6);
    }
}
 * inside and outside this range. Tests also the uses of values of the wrong type.
 */
public void testRangeIntegers() {
    ParameterValue param;
    param = new ParameterValue(new OperationParameter("Range", 15, -30, +40));
    assertEquals("Range", 15, param.intValue());
    assertEquals("Range", 15, param.doubleValue(), 0.0);
    param.setValue(12);
 * inside and outside this range. Tests also the uses of values of the wrong type.
 */
public void testRangeIntegers() {
    Parameter param;
    param = new Parameter(new ParameterDescriptor("Range", 15, -30, +40));
    assertEquals("Range", 15, param.intValue());
    assertEquals("Range", 15, param.doubleValue(), 0.0);
    param.setValue(12);
 * inside and outside this range. Tests also the uses of values of the wrong types.
 */
public void testRangeDoubles() {
    ParameterValue param;
    param = new ParameterValue(new OperationParameter("Range", 15.0, -30.0, +40.0, null));
    assertEquals("Range", 15, param.intValue());
    assertEquals("Range", 15, param.doubleValue(), 0.0);
    param.setValue(12.0);
 * inside and outside this range. Tests also the uses of values of the wrong types.
 */
public void testRangeDoubles() {
    Parameter param;
    param = new Parameter(new ParameterDescriptor("Range", 15.0, -30.0, +40.0, null));
    assertEquals("Range", 15, param.intValue());
    assertEquals("Range", 15, param.doubleValue(), 0.0);
    param.setValue(12.0);
 */
public void testGroup() {
    final Integer ONE = new Integer(1);
    final OperationParameter p1, p2, p3;
    p1 = new OperationParameter(Collections.singletonMap("name", "1"), 1, 1, Integer.class, null, ONE, null, null, null);
    p2 = new OperationParameter(Collections.singletonMap("name", "2"), 1, 2, Integer.class, null, ONE, null, null, null);
    p3 = new OperationParameter(Collections.singletonMap("name", "3"), 0, 1, Integer.class, null, ONE, null, null, null);
    final ParameterValue v1, v2, v3, v1b, v2b, v3b, v1t, v2t, v3t;
    v1  = new ParameterValue(p1); v1.setValue( 10);
    v2  = new ParameterValue(p2); v2.setValue( 20);
    v3  = new ParameterValue(p3); v3.setValue( 30);
    v1b = new ParameterValue(p1); v1.setValue(-10);
    v2b = new ParameterValue(p2); v2.setValue(-20);
    v3b = new ParameterValue(p3); v3.setValue(-30);
    /*
     * Test creation without pre-defined parameter group.
     */
    final Map properties = Collections.singletonMap("name", "group");
    new ParameterValueGroup(properties, new ParameterValue[] {v1, v2, v3});
    new ParameterValueGroup(properties, new ParameterValue[] {v1, v2});
    new ParameterValueGroup(properties, new ParameterValue[] {v1, v3});
    new ParameterValueGroup(properties, new ParameterValue[] {v1, v2, v3, v2b});
    try {
        new ParameterValueGroup(properties, new ParameterValue[] {v1, v2, v3, v3b});
        fail("Parameter 3 was not allowed to be inserted twice.");
    } catch (IllegalArgumentException exception) {
        // This is the expected exception.
    }
    try {
        new ParameterValueGroup(properties, new ParameterValue[] {v1, v3, v1b});
        fail("Parameter 1 was not allowed to be inserted twice.");
    } catch (IllegalArgumentException exception) {
        // This is the expected exception.
 */
public void testGroup() {
    final Integer ONE = new Integer(1);
    final ParameterDescriptor p1, p2, p3;
    p1 = new ParameterDescriptor(Collections.singletonMap("name", "1"), 1, 1, Integer.class, null, ONE, null, null, null);
    p2 = new ParameterDescriptor(Collections.singletonMap("name", "2"), 1, 2, Integer.class, null, ONE, null, null, null);
    p3 = new ParameterDescriptor(Collections.singletonMap("name", "3"), 0, 1, Integer.class, null, ONE, null, null, null);
    final Parameter v1, v2, v3, v1b, v2b, v3b, v1t, v2t, v3t;
    v1  = new Parameter(p1); v1.setValue( 10);
    v2  = new Parameter(p2); v2.setValue( 20);
    v3  = new Parameter(p3); v3.setValue( 30);
    v1b = new Parameter(p1); v1.setValue(-10);
    v2b = new Parameter(p2); v2.setValue(-20);
    v3b = new Parameter(p3); v3.setValue(-30);
    /*
     * Test creation without pre-defined parameter group.
     */
    final Map properties = Collections.singletonMap("name", "group");
    new ParameterGroup(properties, new Parameter[] {v1, v2, v3});
    new ParameterGroup(properties, new Parameter[] {v1, v2});
    new ParameterGroup(properties, new Parameter[] {v1, v3});
    new ParameterGroup(properties, new Parameter[] {v1, v2, v3, v2b});
    try {
        new ParameterGroup(properties, new Parameter[] {v1, v2, v3, v3b});
        fail("Parameter 3 was not allowed to be inserted twice.");
    } catch (IllegalArgumentException exception) {
        // This is the expected exception.
    }
    try {
        new ParameterGroup(properties, new Parameter[] {v1, v3, v1b});
        fail("Parameter 1 was not allowed to be inserted twice.");
    } catch (IllegalArgumentException exception) {
        // This is the expected exception.
/*
 * Test creation with a pre-defined parameter group.
 */
final OperationParameterGroup group =
      new OperationParameterGroup(properties, new OperationParameter[] {p1, p2, p3});
new ParameterValueGroup(group, new ParameterValue[] {v1, v2, v3});
new ParameterValueGroup(group, new ParameterValue[] {v1, v2});
new ParameterValueGroup(group, new ParameterValue[] {v1, v2, v3, v2b});
try {
    new ParameterValueGroup(group, new ParameterValue[] {v1, v3});
    fail("Parameter 2 was mandatory.");
} catch (IllegalArgumentException exception) {
    // This is the expected exception.
}
try {
    new ParameterValueGroup(group, new ParameterValue[] {v1, v2, v3, v3b});
    fail("Parameter 3 was not allowed to be inserted twice.");
} catch (IllegalArgumentException exception) {
    // This is the expected exception.
}
try {
    new ParameterValueGroup(group, new ParameterValue[] {v1, v3, v1b});
    fail("Parameter 1 was not allowed to be inserted twice.");
} catch (IllegalArgumentException exception) {
    // This is the expected exception.
/*
 * Test creation with a pre-defined parameter group.
 */
final ParameterGroupDescriptor group =
      new ParameterGroupDescriptor(properties, new ParameterDescriptor[] {p1, p2, p3});
new ParameterGroup(group, new Parameter[] {v1, v2, v3});
new ParameterGroup(group, new Parameter[] {v1, v2});
new ParameterGroup(group, new Parameter[] {v1, v2, v3, v2b});
try {
    new ParameterGroup(group, new Parameter[] {v1, v3});
    fail("Parameter 2 was mandatory.");
} catch (IllegalArgumentException exception) {
    // This is the expected exception.
}
try {
    new ParameterGroup(group, new Parameter[] {v1, v2, v3, v3b});
    fail("Parameter 3 was not allowed to be inserted twice.");
} catch (IllegalArgumentException exception) {
    // This is the expected exception.
}
try {
    new ParameterGroup(group, new Parameter[] {v1, v3, v1b});
    fail("Parameter 1 was not allowed to be inserted twice.");
} catch (IllegalArgumentException exception) {
    // This is the expected exception.
 * parameter.
 */
public void testCodeList() {
    ParameterValue param = new ParameterValue("Test", AxisDirection.TOP);
    OperationParameter op = (OperationParameter) param.getDescriptor();
    assertEquals("CodeList", new HashSet(Arrays.asList(AxisDirection.values())), op.getValidValues());
    assertEquals("Default", AxisDirection.TOP, op.getDefaultValue());
    param.setValue(AxisDirection.DOWN);
 * parameter.
 */
public void testCodeList() {
    Parameter param = new Parameter("Test", AxisDirection.TOP);
    ParameterDescriptor op = (ParameterDescriptor) param.getDescriptor();
    assertEquals("CodeList", new HashSet(Arrays.asList(AxisDirection.values())), op.getValidValues());
    assertEquals("Default", AxisDirection.TOP, op.getDefaultValue());
    param.setValue(AxisDirection.DOWN);
    } catch (InvalidParameterValueException exception) {
        // This is the expected exception.
    }
    param = new ParameterValue("Test", AxisDirection.TOP);
    param.setValue(dummy); // Should not fails.
    assertEquals("Equals", param, param.clone());
}
    } catch (InvalidParameterValueException exception) {
        // This is the expected exception.
    }
    param = new Parameter("Test", AxisDirection.TOP);
    param.setValue(dummy); // Should not fails.
    assertEquals("Equals", param, param.clone());
}
    GeneralMatrix copy = (GeneralMatrix) matrix.clone();
    copy.setSize(height, width);
    parameters.setMatrix(copy);
    assertEquals("height", height, ((ParameterValue) parameters.getValue("num_row")).intValue());
    assertEquals("width",  width,  ((ParameterValue) parameters.getValue("num_col")).intValue());
    assertEquals("equals", copy,   parameters.getMatrix());
    assertEquals("Equals", parameters, parameters.clone());
}
    GeneralMatrix copy = (GeneralMatrix) matrix.clone();
    copy.setSize(height, width);
    parameters.setMatrix(copy);
    assertEquals("height", height, ((Parameter) parameters.getValue("num_row")).intValue());
    assertEquals("width",  width,  ((Parameter) parameters.getValue("num_col")).intValue());
    assertEquals("equals", copy,   parameters.getMatrix());
    assertEquals("Equals", parameters, parameters.clone());
}