In this commit:
OperationParameter
→ ParameterDescriptor
.
Reverting this changes causes compilation errors, which can be fixed only be re-applying the same change.serialVersionUID = 1L
: this change has been reverted
(replaced by computed serialVersionUID
).Command line:
svn diff --extensions "--unified --ignore-space-change --ignore-all-space --ignore-eol-style" -r7705:7846 https://svn.osgeo.org/geotools/trunk/modules/library/referencing/src/main/java/org/geotools/parameter/MatrixParameterDescriptors.java
Revision 7705 | Revision 7846 |
---|---|
// OpenGIS dependencies import org.opengis.parameter.ParameterValue; import org.opengis.parameter.OperationParameter; import org.opengis.parameter.ParameterValueGroup; import org.opengis.parameter.GeneralParameterValue; import org.opengis.parameter.GeneralOperationParameter; import org.opengis.parameter.ParameterNotFoundException; import org.opengis.parameter.InvalidParameterNameException; import org.opengis.referencing.operation.Matrix; |
// OpenGIS dependencies import org.opengis.parameter.ParameterValue; import org.opengis.parameter.ParameterDescriptor; import org.opengis.parameter.ParameterValueGroup; import org.opengis.parameter.GeneralParameterValue; import org.opengis.parameter.GeneralParameterDescriptor; import org.opengis.parameter.ParameterNotFoundException; import org.opengis.parameter.InvalidParameterNameException; import org.opengis.referencing.operation.Matrix; |
*
* @see MatrixParameterValues
*/
public class MatrixParameters extends OperationParameterGroup {
/**
* The default matrix size for the {@linkplain #MatrixParameters(Map) one-argument constructor}.
*/ |
* * @see MatrixParameterValues */ public class MatrixParameters extends ParameterGroupDescriptor { private static final long serialVersionUID = 1L; /** * The default matrix size for the {@linkplain #MatrixParameters(Map) one-argument constructor}. */ |
* on matrix element values. Concequently, the same descriptors can be reused for all * {@link MatrixParameterValues} instances. */ private final OperationParameter[] parameters = new OperationParameter[CACHE_SIZE*CACHE_SIZE]; /** * The descriptor for the <code>"num_row"</code> parameter. */ protected final OperationParameter numRow; /** * The descriptor for the <code>"num_col"</code> parameter. */ protected final OperationParameter numCol; /** * The prefix to insert in front of parameter name for each matrix elements. |
* on matrix element values. Concequently, the same descriptors can be reused for all * {@link MatrixParameterValues} instances. */ private final ParameterDescriptor[] parameters = new ParameterDescriptor[CACHE_SIZE*CACHE_SIZE]; /** * The descriptor for the <code>"num_row"</code> parameter. */ protected final ParameterDescriptor numRow; /** * The descriptor for the <code>"num_col"</code> parameter. */ protected final ParameterDescriptor numCol; /** * The prefix to insert in front of parameter name for each matrix elements. |
* used in this implementation is inefficient for large amount of matrix * elements. */ this(properties, new OperationParameter[] { new org.geotools.parameter.OperationParameter("num_row", DEFAULT_MATRIX_SIZE, 2, 50), new org.geotools.parameter.OperationParameter("num_col", DEFAULT_MATRIX_SIZE, 2, 50) }, "elt_", '_'); } |
* used in this implementation is inefficient for large amount of matrix * elements. */ this(properties, new ParameterDescriptor[] { new org.geotools.parameter.ParameterDescriptor("num_row", DEFAULT_MATRIX_SIZE, 2, 50), new org.geotools.parameter.ParameterDescriptor("num_col", DEFAULT_MATRIX_SIZE, 2, 50) }, "elt_", '_'); } |
* @param separator The separator between the row and the column index in parameter names.
*/
public MatrixParameters(final Map properties,
OperationParameter[] parameters,
final String prefix,
final char separator)
{ |
* @param separator The separator between the row and the column index in parameter names.
*/
public MatrixParameters(final Map properties,
ParameterDescriptor[] parameters,
final String prefix,
final char separator)
{ |
* @return The parameter for the given name.
* @throws ParameterNotFoundException if there is no parameter for the given name.
*/
public final OperationParameter getParameter(final String name)
throws ParameterNotFoundException
{
return getParameter(name, |
* @return The parameter for the given name.
* @throws ParameterNotFoundException if there is no parameter for the given name.
*/
public final ParameterDescriptor getParameter(final String name)
throws ParameterNotFoundException
{
return getParameter(name, |
* @return The parameter for the given name.
* @throws ParameterNotFoundException if there is no parameter for the given name.
*/
final OperationParameter getParameter(String name, final int numRow, final int numCol)
throws ParameterNotFoundException
{
ensureNonNull("name", name); |
* @return The parameter for the given name.
* @throws ParameterNotFoundException if there is no parameter for the given name.
*/
final ParameterDescriptor getParameter(String name, final int numRow, final int numCol)
throws ParameterNotFoundException
{
ensureNonNull("name", name); |
/**
* Returns the parameter in this group for a matrix element at the specified
* index. row and column indices are 0 based. Indices must be lower that the
* {@link org.geotools.parameter.OperationParameter#getMaximumValue maximum values}
* given to the {@link #numRow} and {@link #numCol} parameters.
*
* @param row The row indice. |
/**
* Returns the parameter in this group for a matrix element at the specified
* index. row and column indices are 0 based. Indices must be lower that the
* {@link org.geotools.parameter.ParameterDescriptor#getMaximumValue maximum values}
* given to the {@link #numRow} and {@link #numCol} parameters.
*
* @param row The row indice. |
* @return The parameter descriptor for the specified matrix element.
* @throws IndexOutOfBoundsException if <code>row</code> or <code>column</code> is out of bounds.
*/
public final OperationParameter getParameter(final int row, final int column)
throws IndexOutOfBoundsException
{
return getParameter(row, column, |
* @return The parameter descriptor for the specified matrix element.
* @throws IndexOutOfBoundsException if <code>row</code> or <code>column</code> is out of bounds.
*/
public final ParameterDescriptor getParameter(final int row, final int column)
throws IndexOutOfBoundsException
{
return getParameter(row, column, |
* @return The parameter descriptor for the specified matrix element.
* @throws IndexOutOfBoundsException if <code>row</code> or <code>column</code> is out of bounds.
*/
final OperationParameter getParameter(final int row, final int column,
final int numRow, final int numCol)
throws IndexOutOfBoundsException
{ |
* @return The parameter descriptor for the specified matrix element.
* @throws IndexOutOfBoundsException if <code>row</code> or <code>column</code> is out of bounds.
*/
final ParameterDescriptor getParameter(final int row, final int column,
final int numRow, final int numCol)
throws IndexOutOfBoundsException
{ |
checkIndice("row", row, numRow);
checkIndice("column", column, numCol);
int index = -1;
OperationParameter param;
if (row<CACHE_SIZE && column<CACHE_SIZE) {
index = row*CACHE_SIZE + column;
param = parameters[index]; |
checkIndice("row", row, numRow);
checkIndice("column", column, numCol);
int index = -1;
ParameterDescriptor param;
if (row<CACHE_SIZE && column<CACHE_SIZE) {
index = row*CACHE_SIZE + column;
param = parameters[index]; |
* Note that this cache is shared by all MatrixParameters instance. There is no need * to synchronize since it is not a big deal if the same parameter is constructed twice. */ param = new org.geotools.parameter.OperationParameter(prefix + row + separator + column, Double.TYPE, org.geotools.parameter.ParameterValue.wrap(row==column ? 1.0 : 0.0), null, null, Unit.ONE); if (index >= 0) { parameters[index] = param; |
* Note that this cache is shared by all MatrixParameters instance. There is no need * to synchronize since it is not a big deal if the same parameter is constructed twice. */ param = new org.geotools.parameter.ParameterDescriptor(prefix + row + separator + column, Double.TYPE, org.geotools.parameter.Parameter.wrap(row==column ? 1.0 : 0.0), null, null, Unit.ONE); if (index >= 0) { parameters[index] = param; |
/** * Returns the parameters in this group. The number or elements is inferred from the * {@link org.geotools.parameter.OperationParameter#getDefaultValue default values} * given to the {@link #numRow} and {@link #numCol} parameters. * * @return The matrix parameters, including all elements. */ public final GeneralOperationParameter[] getParameters() { return getParameters(((Number) this.numRow.getDefaultValue()).intValue(), ((Number) this.numCol.getDefaultValue()).intValue()); } |
/** * Returns the parameters in this group. The number or elements is inferred from the * {@link org.geotools.parameter.ParameterDescriptor#getDefaultValue default values} * given to the {@link #numRow} and {@link #numCol} parameters. * * @return The matrix parameters, including all elements. */ public final GeneralParameterDescriptor[] getParameters() { return getParameters(((Number) this.numRow.getDefaultValue()).intValue(), ((Number) this.numCol.getDefaultValue()).intValue()); } |
* @param numCol The number of columns. * @return The matrix parameters, including all elements. */ final GeneralOperationParameter[] getParameters(final int numRow, final int numCol) { final OperationParameter[] parameters = new OperationParameter[numRow*numCol + 2]; int k = 0; parameters[k++] = this.numRow; parameters[k++] = this.numCol; |
* @param numCol The number of columns. * @return The matrix parameters, including all elements. */ final GeneralParameterDescriptor[] getParameters(final int numRow, final int numCol) { final ParameterDescriptor[] parameters = new ParameterDescriptor[numRow*numCol + 2]; int k = 0; parameters[k++] = this.numRow; parameters[k++] = this.numCol; |
return ((MatrixParameterValues) parameters).getMatrix(); } // Fallback on the general case (others implementations) final ParameterValue numRowParam = parameters.getValue(numRow.getName(null)); final ParameterValue numColParam = parameters.getValue(numCol.getName(null)); final int numRow = numRowParam.intValue(); final int numCol = numColParam.intValue(); final GeneralMatrix matrix = new GeneralMatrix(numRow, numCol); final GeneralParameterValue[] params = parameters.getValues(); if (params != null) { for (int i=0; i<params.length; i++) { final GeneralParameterValue param = params[i]; |
return ((MatrixParameterValues) parameters).getMatrix(); } // Fallback on the general case (others implementations) final ParameterValue numRowParam = parameters.parameter(numRow.getName().toString()); final ParameterValue numColParam = parameters.parameter(numCol.getName().toString()); final int numRow = numRowParam.intValue(); final int numCol = numColParam.intValue(); final GeneralMatrix matrix = new GeneralMatrix(numRow, numCol); final GeneralParameterValue[] params = Parameters.array( parameters ); if (params != null) { for (int i=0; i<params.length; i++) { final GeneralParameterValue param = params[i]; |
continue;
}
RuntimeException cause = null;
final String name = param.getDescriptor().getName(null);
if (name.regionMatches(true, 0, prefix, 0, prefix.length())) {
final int split = name.indexOf(separator, prefix.length());
if (split >= 0) try { |
continue;
}
RuntimeException cause = null;
final String name = param.getDescriptor().getName().toString();
if (name.regionMatches(true, 0, prefix, 0, prefix.length())) {
final int split = name.indexOf(separator, prefix.length());
if (split >= 0) try { |