Package org.iogp.gigs

Class Parameter

Object
Parameter

public class Parameter extends Object
An immutable tuple for parameter name, value and unit of measurement. This class provides a small subset of ParameterDescriptor and ParameterValue functionalities combined in a single class for simplicity. This class serves two purposes:
  1. Assign parameter values to the ParameterValueGroup instance supplied by the implementation to test.
  2. Verifies the parameter values declared by the SingleOperation instance created by the implementation to test.
This class exists because the GIGS tests need to perform those two steps. For normal use, this class would not be needed. Users should instead initialize parameters with a pattern like below:
    ParameterValueGroup pg = mtFactory.getDefaultParameters("Oblique Stereographic");
    pg.parameter("Latitude of natural origin")    .setValue(52.15616056, units.degree());
    pg.parameter("Longitude of natural origin")   .setValue(5.387638889, units.degree());
    pg.parameter("Scale factor at natural origin").setValue(0.9999079,   units.one());
    pg.parameter("False easting")                 .setValue(155000,      units.metre());
    pg.parameter("False northing")                .setValue(463000,      units.metre());
Since:
1.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final String
    The parameter name.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Parameter(String name, double value, Unit<?> unit)
    Creates a new parameter of the given name, value and units.
    Parameter(String name, String value)
    Creates a new parameter of the given name and value without unit.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals(Object object)
    Compares the given object with this parameter for equality.
    int
    Returns a hash code value for this parameter.
    void
    Locates the parameter named name in the specified group and sets its value.
    Returns a string representation of this parameter value.
    void
    Verifies that the parameter named name exists and has the expected value.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • Parameter

      public Parameter(String name, String value)
      Creates a new parameter of the given name and value without unit.
      Parameters:
      name - the parameter name.
      value - the parameter value.
    • Parameter

      public Parameter(String name, double value, Unit<?> unit)
      Creates a new parameter of the given name, value and units.
      Parameters:
      name - the parameter name.
      value - the parameter value.
      unit - the unit of measurement, or null if none.
  • Method Details

    • setValueInto

      public void setValueInto(ParameterValueGroup destination)
      Locates the parameter named name in the specified group and sets its value. This is a convenience method for GIGS tests; users normally do not need this method. The recommended pattern for setting a parameter value is simply like below:
          group.parameter("Latitude of 1st standard parallel").setValue(-18, units.degree());
      
      The code in this method is more complicated, but this is for the purpose of GIGS tests only.
      Parameters:
      destination - the parameter group where to copy the parameter value.
      Throws:
      AssertionFailedError - if this parameter is not found in the specified group.
    • verify

      public void verify(ParameterValueGroup parameters)
      Verifies that the parameter named name exists and has the expected value. Unit conversion are applied if needed.
      Parameters:
      parameters - the group of parameters to verify.
      Throws:
      AssertionFailedError - if this parameter is not found in the specified group or does not have the expected value.
    • equals

      public boolean equals(Object object)
      Compares the given object with this parameter for equality.
      Overrides:
      equals in class Object
      Parameters:
      object - the object to compare with this parameter.
      Returns:
      whether the two objects are equal.
    • hashCode

      public int hashCode()
      Returns a hash code value for this parameter.
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value for this parameter.
    • toString

      public String toString()
      Returns a string representation of this parameter value.
      Overrides:
      toString in class Object
      Returns:
      a string representation of this parameter value.