org.geotools.parameter
Class ParameterGroup

java.lang.Object
  extended byorg.geotools.referencing.wkt.Formattable
      extended byorg.geotools.parameter.AbstractParameter
          extended byorg.geotools.parameter.ParameterGroup
All Implemented Interfaces:
org.opengis.util.Cloneable, java.lang.Cloneable, org.opengis.parameter.GeneralParameterValue, org.opengis.parameter.ParameterValueGroup, java.io.Serializable
Direct Known Subclasses:
MatrixParameters

public class ParameterGroup
extends AbstractParameter
implements org.opengis.parameter.ParameterValueGroup

A group of related parameter values. The same group can be repeated more than once in an operation or higher level ParameterValueGroup, if those instances contain different values of one or more ParameterValues which suitably distinquish among those groups.

Since:
2.1
Version:
$Id: ParameterGroup.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Martin Desruisseaux, Jody Garnett (Refractions Research)
See Also:
DefaultParameterDescriptorGroup, Parameter, Serialized Form

Field Summary
static org.opengis.parameter.ParameterValueGroup EMPTY
          An empty parameter value group.
 
Constructor Summary
ParameterGroup(java.util.Map properties, org.opengis.parameter.GeneralParameterValue[] values)
          Constructs a parameter group from the specified list of parameters.
ParameterGroup(org.opengis.parameter.ParameterDescriptorGroup descriptor)
          Constructs a parameter group from the specified descriptor.
ParameterGroup(org.opengis.parameter.ParameterDescriptorGroup descriptor, org.opengis.parameter.GeneralParameterValue[] values)
          Constructs a parameter group from the specified descriptor and list of parameters.
 
Method Summary
 org.opengis.parameter.ParameterValueGroup addGroup(java.lang.String name)
          Creates a new group of the specified name.
 java.lang.Object clone()
          Returns a deep copy of this group of parameter values.
 boolean equals(java.lang.Object object)
          Compares the specified object with this parameter for equality.
 java.util.List groups(java.lang.String name)
          Returns all subgroups with the specified name.
 int hashCode()
          Returns a hash value for this parameter.
 org.opengis.parameter.ParameterValue parameter(java.lang.String name)
          Returns the value in this group for the specified identifier code.
 java.util.List values()
          Returns the values in this group.
 
Methods inherited from class org.geotools.parameter.AbstractParameter
formatWKT, getDescriptor, toString, write
 
Methods inherited from class org.geotools.referencing.wkt.Formattable
toWKT, toWKT, toWKT
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.opengis.parameter.GeneralParameterValue
getDescriptor
 

Field Detail

EMPTY

public static org.opengis.parameter.ParameterValueGroup EMPTY
An empty parameter value group. This group contains no parameter value.

Constructor Detail

ParameterGroup

public ParameterGroup(org.opengis.parameter.ParameterDescriptorGroup descriptor)
Constructs a parameter group from the specified descriptor. All parameter values will be initialized to their default value.

Parameters:
descriptor - The descriptor for this group.

ParameterGroup

public ParameterGroup(org.opengis.parameter.ParameterDescriptorGroup descriptor,
                      org.opengis.parameter.GeneralParameterValue[] values)
Constructs a parameter group from the specified descriptor and list of parameters.

Parameters:
descriptor - The descriptor for this group.
values - The list of parameter values.
Throws:
java.lang.IllegalStateException - if the number of parameter occurences doesn't matches the number declared in the descriptor.

ParameterGroup

public ParameterGroup(java.util.Map properties,
                      org.opengis.parameter.GeneralParameterValue[] values)
Constructs a parameter group from the specified list of parameters.

Parameters:
properties - The properties for the operation parameter group to construct from the list of parameters.
values - The list of parameter values.
Throws:
java.lang.IllegalStateException - if the number of parameter occurences doesn't matches the number declared in the descriptor.
Method Detail

values

public java.util.List values()
Returns the values in this group. Changes in this list are reflected on this . The returned list supports the add operation.

Specified by:
values in interface org.opengis.parameter.ParameterValueGroup

parameter

public org.opengis.parameter.ParameterValue parameter(java.lang.String name)
                                               throws org.opengis.parameter.ParameterNotFoundException
Returns the value in this group for the specified identifier code. If no parameter value is found but a parameter descriptor is found (which may occurs if the parameter is optional, i.e. minimumOccurs == 0), then a parameter value is automatically created and initialized to its default value (if any).

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:

double value = parameter("false_easting").doubleValue();

This method do not search recursively in subgroups. This is because more than one subgroup may exist for the same descriptor. The user must query all subgroups and select explicitly the appropriate one to use.

Specified by:
parameter in interface org.opengis.parameter.ParameterValueGroup
Parameters:
name - The case insensitive identifier code of the parameter to search for.
Returns:
The parameter value for the given identifier code.
Throws:
org.opengis.parameter.ParameterNotFoundException - if there is no parameter value for the given identifier code.

groups

public java.util.List groups(java.lang.String name)
                      throws org.opengis.parameter.ParameterNotFoundException
Returns all subgroups with the specified name. This method do not create new groups. If the requested group is optional (i.e. minimumOccurs == 0) and no value were set, then this method returns an empty set.

Specified by:
groups in interface org.opengis.parameter.ParameterValueGroup
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:
org.opengis.parameter.ParameterNotFoundException - if no descriptor was found for the given name.

addGroup

public org.opengis.parameter.ParameterValueGroup addGroup(java.lang.String name)
                                                   throws org.opengis.parameter.ParameterNotFoundException,
                                                          org.opengis.parameter.InvalidParameterCardinalityException
Creates a new group of the specified name. The specified name must be the identifier code of a descriptor group.

Specified by:
addGroup in interface org.opengis.parameter.ParameterValueGroup
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:
org.opengis.parameter.ParameterNotFoundException - if no descriptor was found for the given name.
org.opengis.parameter.InvalidParameterCardinalityException - if this parameter group already contains the maximum number of occurences of subgroups of the given name.

equals

public boolean equals(java.lang.Object object)
Compares the specified object with this parameter for equality.

Overrides:
equals in class AbstractParameter
Parameters:
object - The object to compare to .
Returns:
if both objects are equal.

hashCode

public int hashCode()
Returns a hash value for this parameter.

Overrides:
hashCode in class AbstractParameter
Returns:
The hash code value. This value doesn't need to be the same in past or future versions of this class.

clone

public java.lang.Object clone()
Returns a deep copy of this group of parameter values. Included parameter values and subgroups are cloned recursively.

Specified by:
clone in interface org.opengis.parameter.ParameterValueGroup
Overrides:
clone in class AbstractParameter
Returns:
A copy of this group of parameter values.


Copyright © GeoTools. All Rights Reserved.