Package org.geotools.parameter
Class MatrixParameters
- Object
-
- Formattable
-
- AbstractParameter
-
- ParameterGroup
-
- MatrixParameters
-
- All Implemented Interfaces:
Serializable
,Cloneable
,GeneralParameterDescriptor
,GeneralParameterValue
,ParameterDescriptorGroup
,ParameterValueGroup
,IdentifiedObject
,Cloneable
public class MatrixParameters extends ParameterGroup implements ParameterDescriptorGroup
The values for a group of matrix parameters. This value group is extensible, i.e. the number of"elt_row_col"
parameters depends on the"num_row"
and"num_col"
parameter values. Consequently, this parameter value group is also its own mutable operation parameter group.- Since:
- 2.1
- Author:
- Martin Desruisseaux (IRD)
- See Also:
MatrixParameterDescriptors
, Serialized Form
-
-
Field Summary
-
Fields inherited from class ParameterGroup
EMPTY
-
Fields inherited from class Formattable
SINGLE_LINE
-
Fields inherited from interface IdentifiedObject
ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY
-
-
Constructor Summary
Constructors Constructor Description MatrixParameters(MatrixParameterDescriptors descriptor)
Constructs default values for the specified matrix parameter descriptors.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MatrixParameters
clone()
Returns a clone of this parameter group.ParameterValueGroup
createValue()
Forwards the call to the matrix parameter descriptors specified at construction time.GeneralParameterDescriptor
descriptor(String name)
Returns the parameter in this group for the specified name.List<GeneralParameterDescriptor>
descriptors()
Returns the parameters descriptors in this group.boolean
equals(Object object)
Compare this object with the specified one for equality.Collection<GenericName>
getAlias()
Forward the call to the matrix parameter descriptors specified at construction time.ParameterDescriptorGroup
getDescriptor()
Returns a description of this parameter value group.Set<ReferenceIdentifier>
getIdentifiers()
Forward the call to the matrix parameter descriptors specified at construction time.Matrix
getMatrix()
Creates a matrix from this group of parameters.int
getMaximumOccurs()
Forward the call to the matrix parameter descriptors specified at construction time.int
getMinimumOccurs()
Forward the call to the matrix parameter descriptors specified at construction time.ReferenceIdentifier
getName()
Forward the call to the matrix parameter descriptors specified at construction time.InternationalString
getRemarks()
Forward the call to the matrix parameter descriptors specified at construction time.int
hashCode()
Returns a hash value for this parameter.ParameterValue<Double>
parameter(int row, int column)
Returns the value in this group for a matrix element at the specified index.ParameterValue<?>
parameter(String name)
Returns the value in this group for the specified name.void
setMatrix(Matrix matrix)
Sets all parameter values to the element value in the specified matrix.List<GeneralParameterValue>
values()
Returns the parameters values in this group.protected void
write(TableWriter table)
Writes the content of this parameter to the specified table.-
Methods inherited from class ParameterGroup
addGroup, groups
-
Methods inherited from class AbstractParameter
formatWKT, toString
-
Methods inherited from class Formattable
cleanupThreadLocals, toWKT, toWKT, toWKT, toWKT
-
Methods inherited from interface IdentifiedObject
toWKT
-
-
-
-
Constructor Detail
-
MatrixParameters
public MatrixParameters(MatrixParameterDescriptors descriptor)
Constructs default values for the specified matrix parameter descriptors.- Parameters:
descriptor
- The descriptor for this group of parameters.
-
-
Method Detail
-
getDescriptor
public ParameterDescriptorGroup getDescriptor()
Returns a description of this parameter value group. Returns alwaysthis
, since the description depends on"num_row"
and"num_col"
parameter values.- Specified by:
getDescriptor
in interfaceGeneralParameterValue
- Specified by:
getDescriptor
in interfaceParameterValueGroup
- Overrides:
getDescriptor
in classParameterGroup
- Returns:
- The abstract definition of this parameter or group of parameters.
-
getName
public ReferenceIdentifier getName()
Forward the call to the matrix parameter descriptors specified at construction time.- Specified by:
getName
in interfaceIdentifiedObject
- Returns:
- The primary name.
-
getAlias
public Collection<GenericName> getAlias()
Forward the call to the matrix parameter descriptors specified at construction time.- Specified by:
getAlias
in interfaceIdentifiedObject
- Returns:
- The aliases, or an empty collection if there is none.
-
getIdentifiers
public Set<ReferenceIdentifier> getIdentifiers()
Forward the call to the matrix parameter descriptors specified at construction time.- Specified by:
getIdentifiers
in interfaceIdentifiedObject
- Returns:
- This object identifiers, or an empty set if there is none.
-
getRemarks
public InternationalString getRemarks()
Forward the call to the matrix parameter descriptors specified at construction time.- Specified by:
getRemarks
in interfaceIdentifiedObject
- Returns:
- The remarks, or
null
if none.
-
getMinimumOccurs
public int getMinimumOccurs()
Forward the call to the matrix parameter descriptors specified at construction time.- Specified by:
getMinimumOccurs
in interfaceGeneralParameterDescriptor
- Returns:
- The minimum occurence.
- See Also:
GeneralParameterDescriptor.getMaximumOccurs()
-
getMaximumOccurs
public int getMaximumOccurs()
Forward the call to the matrix parameter descriptors specified at construction time.- Specified by:
getMaximumOccurs
in interfaceGeneralParameterDescriptor
- Returns:
- The maximum occurence.
- See Also:
GeneralParameterDescriptor.getMinimumOccurs()
-
descriptor
public GeneralParameterDescriptor descriptor(String name) throws ParameterNotFoundException
Returns the parameter in this group for the specified name. The name can be a matrix element if it uses the following syntax:"elt_row_col"
where"elt_"
is the prefix for all matrix elements, and row and col are row and column indices respectively. For example"elt_2_1"
is the element name for the value at line 2 and row 1. The row and column index are 0 based.- Specified by:
descriptor
in interfaceParameterDescriptorGroup
- Parameters:
name
- The case insensitive name of the parameter to search for.- Returns:
- The parameter for the given name.
- Throws:
ParameterNotFoundException
- if there is no parameter for the given name.
-
parameter
public ParameterValue<?> parameter(String name) throws ParameterNotFoundException
Returns the value in this group for the specified name. The name can be a matrix element if it uses the following syntax:"elt_row_col"
where"elt_"
is the prefix for all matrix elements, and row and col are row and column indices respectively. For example"elt_2_1"
is the element name for the value at line 2 and row 1. The row and column index are 0 based.- Specified by:
parameter
in interfaceParameterValueGroup
- Overrides:
parameter
in classParameterGroup
- Parameters:
name
- The case insensitive name of the parameter to search for.- Returns:
- The parameter value for the given name.
- Throws:
ParameterNotFoundException
- if there is no parameter for the given name.
-
parameter
public final ParameterValue<Double> parameter(int row, int column) throws IndexOutOfBoundsException
Returns the value in this group for a matrix element at the specified index. Row and column index are 0 based.- Parameters:
row
- The row indice.column
- The column indice- Returns:
- The parameter value for the specified matrix element (never
null
). - Throws:
IndexOutOfBoundsException
- ifrow
orcolumn
is out of bounds.
-
descriptors
public List<GeneralParameterDescriptor> descriptors()
Returns the parameters descriptors in this group. The amount of parameters depends on the value of"num_row"
and"num_col"
parameters.- Specified by:
descriptors
in interfaceParameterDescriptorGroup
- Returns:
- The descriptor of this group.
-
values
public List<GeneralParameterValue> values()
Returns the parameters values in this group. The amount of parameters depends on the value of"num_row"
and"num_col"
parameters. The parameter array will contains only matrix elements which have been requested at least once by one ofparameter(...)
methods. Never requested elements are left to their default value and omitted from the returned array.- Specified by:
values
in interfaceParameterValueGroup
- Overrides:
values
in classParameterGroup
- Returns:
- The values in this group.
-
createValue
public ParameterValueGroup createValue()
Forwards the call to the matrix parameter descriptors specified at construction time.- Specified by:
createValue
in interfaceGeneralParameterDescriptor
- Specified by:
createValue
in interfaceParameterDescriptorGroup
- Returns:
- A new parameter instance initialized to the default value.
-
getMatrix
public Matrix getMatrix()
Creates a matrix from this group of parameters.- Returns:
- A matrix created from this group of parameters.
-
setMatrix
public void setMatrix(Matrix matrix)
Sets all parameter values to the element value in the specified matrix. After this method call,values()
will returns only the elements different from the default value.- Parameters:
matrix
- The matrix to copy in this group of parameters.
-
equals
public boolean equals(Object object)
Compare this object with the specified one for equality.- Overrides:
equals
in classParameterGroup
- Parameters:
object
- The object to compare tothis
.- Returns:
true
if both objects are equal.
-
hashCode
public int hashCode()
Description copied from class:ParameterGroup
Returns a hash value for this parameter.- Overrides:
hashCode
in classParameterGroup
- Returns:
- The hash code value. This value doesn't need to be the same in past or future versions of this class.
-
clone
public MatrixParameters clone()
Returns a clone of this parameter group.- Specified by:
clone
in interfaceCloneable
- Specified by:
clone
in interfaceGeneralParameterValue
- Specified by:
clone
in interfaceParameterValueGroup
- Overrides:
clone
in classParameterGroup
- Returns:
- A copy of this group of parameter values.
- See Also:
Object.clone()
-
write
protected void write(TableWriter table) throws IOException
Writes the content of this parameter to the specified table.- Overrides:
write
in classAbstractParameter
- Parameters:
table
- The table where to format the parameter value.- Throws:
IOException
- if an error occurs during output operation.
-
-