Object
SimpleIdentifiedObject
SimpleParameterGroup
- All Implemented Interfaces:
Cloneable
,Identifier
,GeneralParameterDescriptor
,GeneralParameterValue
,ParameterDescriptorGroup
,ParameterValueGroup
,IdentifiedObject
,ReferenceIdentifier
public class SimpleParameterGroup
extends SimpleIdentifiedObject
implements ParameterValueGroup, ParameterDescriptorGroup, Cloneable
A
ParameterValueGroup
implementation for SimpleParameter
instances.
In order to keep the conceptual model simpler, this parameter group is also its own
descriptor. This is not quite a recommended practice (such descriptors are less suitable
for use in HashMap
), but allow us to keep the amount of classes smaller
and closely related interfaces together.
The most interesting methods in this class are:
SimpleIdentifiedObject.getName()
, for the name of this parameter groupparameter(String)
, for getting a parameter of the given name.
- Since:
- 3.1
-
Field Summary
Modifier and TypeFieldDescriptionprotected final List<SimpleParameter>
The list of parameters included in this group.Fields inherited from class SimpleIdentifiedObject
authority, code
Fields inherited from interface IdentifiedObject
ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY
Fields inherited from interface Identifier
AUTHORITY_KEY, CODE_KEY, CODESPACE_KEY, DESCRIPTION_KEY, VERSION_KEY
-
Constructor Summary
ConstructorDescriptionSimpleParameterGroup
(Citation authority, String name, SimpleParameter... param) Creates a new parameter group of the given authority and name. -
Method Summary
Modifier and TypeMethodDescriptionCreates a new group of the specified name.clone()
Returns a copy of this parameter group.descriptor
(String name) Returns the parameter descriptor in this group for the specified identifier code.Returns the parameter descriptors in this group.boolean
Compares the given object with this parameter group for equality.Returns a natural language description of this object.Returns the descriptor of the parameter group.Returns all subgroups with the specified name.int
hashCode()
Returns a hash code value for this parameter group.Returns the value in this group for the specified identifier code.toString()
Returns a string representation of all parameters in this group.values()
Returns the parameter values in this group.Methods inherited from class SimpleIdentifiedObject
getAuthority, getCode, getCodeSpace, getDomainOfValidity, getName, getScope, toWKT
Methods inherited from interface GeneralParameterDescriptor
getDirection, getMaximumOccurs, getMinimumOccurs, getName
Methods inherited from interface IdentifiedObject
getAlias, getIdentifiers, getRemarks, toWKT
Methods inherited from interface Identifier
getVersion
-
Field Details
-
parameters
The list of parameters included in this group. This simple group implementation supports onlySimpleParameter
instances, which are used both as parameter descriptor and parameter values for thedouble
value type.This list is live: changes to this list will be reflected immediately in the
descriptors()
andvalues()
views.
-
-
Constructor Details
-
SimpleParameterGroup
Creates a new parameter group of the given authority and name.- Parameters:
authority
- organization responsible for definition of the parameters, ornull
.name
- the parameter group name.param
- the parameters to be included in this group.
-
-
Method Details
-
getDescriptor
Returns the descriptor of the parameter group. Since this simple class implements both the value and descriptor interfaces, this method returnsthis
. However, more sophisticated libraries are likely to return a different object.- Specified by:
getDescriptor
in interfaceGeneralParameterValue
- Specified by:
getDescriptor
in interfaceParameterValueGroup
- Returns:
this
descriptor.
-
getDescription
Returns a natural language description of this object. The default implementation returnsnull
.- Specified by:
getDescription
in interfaceGeneralParameterDescriptor
- Specified by:
getDescription
in interfaceIdentifier
- Returns:
- the natural language description, or
null
if none. - See Also:
-
descriptors
Returns the parameter descriptors in this group. The list returned by this method is unmodifiable.Implementation note: since the simple classes in this package implement both the value and the descriptor interfaces, this method returns the same list than thevalues()
methods. However, more sophisticated libraries are likely to return a distinct list.- Specified by:
descriptors
in interfaceParameterDescriptorGroup
- Returns:
- the parameter descriptors in this group as an unmodifiable list.
-
values
Returns the parameter values in this group. The list returned by this method is unmodifiable.Implementation note: since the simple classes in this package implement both the value and the descriptor interfaces, this method returns the same list than thedescriptors()
methods. However, more sophisticated libraries are likely to return a distinct list.- Specified by:
values
in interfaceParameterValueGroup
- Returns:
- the parameter values in this group as an unmodifiable list.
-
descriptor
Returns the parameter descriptor in this group for the specified identifier code.Implementation note: since the simple classes in this package implement both the value and the descriptor interfaces, this method is synonymous toparameter(String)
. However, more sophisticated libraries are likely to return a distinct object.- Specified by:
descriptor
in interfaceParameterDescriptorGroup
- Parameters:
name
- the case insensitive identifier code of the parameter to search for.- Returns:
- the parameter for the given identifier code.
- Throws:
ParameterNotFoundException
- if there is no parameter for the given identifier code.
-
parameter
Returns the value in this group for the specified identifier code. This convenience method provides a way to get and set parameter values by name. For example, the following idiom fetches a floating point value for the"false_easting"
parameter:
The following idiom sets a floating point value for thedouble value = parameter("false_easting").doubleValue();
"false_easting"
parameter:parameter("false_easting").setValue(500000.0);
Implementation note: since the simple classes in this package implement both the value and the descriptor interfaces, this method is essentially synonymous todescriptor(String)
. However, more sophisticated libraries are likely to return a distinct object.- Specified by:
parameter
in interfaceParameterValueGroup
- Parameters:
name
- the case insensitive identifier code of the parameter to search for.- Returns:
- the parameter value for the given identifier code.
- Throws:
ParameterNotFoundException
- if there is no parameter value for the given identifier code.
-
groups
Returns all subgroups with the specified name. The default implementation always throws an exception, since this simple parameter group does not support subgroups.- Specified by:
groups
in interfaceParameterValueGroup
- Parameters:
name
- the case insensitive identifier code of the parameter group to search for.- Returns:
- the set of all parameter group for the given identifier code.
- Throws:
ParameterNotFoundException
- if no descriptor was found for the given name.
-
addGroup
Creates a new group of the specified name. The default implementation always throws an exception, since this simple parameter group does not support subgroups.- Specified by:
addGroup
in interfaceParameterValueGroup
- Parameters:
name
- the case insensitive identifier code of the parameter group to create.- Returns:
- a newly created parameter group for the given identifier code.
- Throws:
ParameterNotFoundException
- if no descriptor was found for the given name.
-
createValue
Returns a new group with the same authority, code and parameters than this group. The value of each parameter is left to their default value.Implementation note: since this simple class implements both the value and the descriptor interfaces, this method is very similar to theclone()
method. However, in more sophisticated libraries, theParameterDescriptorGroup.createValue()
andParameterValueGroup.clone()
methods are likely to be defined in different objects.- Specified by:
createValue
in interfaceGeneralParameterDescriptor
- Specified by:
createValue
in interfaceParameterDescriptorGroup
- Returns:
- a new parameter instance initialized to the default value.
- See Also:
-
clone
Returns a copy of this parameter group. This method is similar tocreateValue()
except for the following:- This method returns an instance of the same class.
- The values() are initialized to the same values than the cloned group.
- Specified by:
clone
in interfaceGeneralParameterValue
- Specified by:
clone
in interfaceParameterValueGroup
- Overrides:
clone
in classObject
- Returns:
- a copy of this group of parameter values.
- See Also:
-
equals
Compares the given object with this parameter group for equality.- Overrides:
equals
in classSimpleIdentifiedObject
- Parameters:
object
- the object to compare with thisSimpleIdentifiedObject
.- Returns:
true
if the given object is equal to this object.
-
hashCode
public int hashCode()Returns a hash code value for this parameter group.- Overrides:
hashCode
in classSimpleIdentifiedObject
-
toString
Returns a string representation of all parameters in this group.- Overrides:
toString
in classSimpleIdentifiedObject
-