org.geotoolkit.parameter
Class AbstractParameterDescriptor

Object
  extended by FormattableObject
      extended by AbstractIdentifiedObject
          extended by AbstractParameterDescriptor
All Implemented Interfaces:
Serializable, Formattable, LenientComparable, GeneralParameterDescriptor, IdentifiedObject
Direct Known Subclasses:
DefaultParameterDescriptor, DefaultParameterDescriptorGroup

@Immutable
public abstract class AbstractParameterDescriptor
extends AbstractIdentifiedObject
implements GeneralParameterDescriptor

Abstract definition of a parameter or group of parameters used by an operation method.

Since:
2.0
Version:
3.18
Author:
Martin Desruisseaux (IRD, Geomatys)
See Also:
AbstractParameter, Serialized Form
Module:
referencing/geotk-referencing (download)    View source code for this class

Field Summary
 
Fields inherited from class AbstractIdentifiedObject
EMPTY_ALIAS_ARRAY, EMPTY_IDENTIFIER_ARRAY, IDENTIFIER_COMPARATOR, NAME_COMPARATOR, REMARKS_COMPARATOR
 
Fields inherited from class FormattableObject
EPSG, GEOTIFF, INTERNAL, OGC, SINGLE_LINE
 
Fields inherited from interface IdentifiedObject
ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY
 
Constructor Summary
protected AbstractParameterDescriptor(GeneralParameterDescriptor descriptor)
          Constructs a descriptor with the same values than the specified one.
protected AbstractParameterDescriptor(Map<String,?> properties, int minimumOccurs, int maximumOccurs)
          Constructs a parameter from a set of properties.
 
Method Summary
protected  int computeHashCode()
          Computes a hash value for this identified object.
abstract  GeneralParameterValue createValue()
          Creates a new instance of parameter value or group initialized with the default value(s).
 boolean equals(Object object, ComparisonMode mode)
          Compares the specified object with this parameter for equality.
 String formatWKT(Formatter formatter)
          Formats the inner part of a Well Known Text (WKT) element.
abstract  int getMaximumOccurs()
          The maximum number of times that values for this parameter group or parameter can be included.
 int getMinimumOccurs()
          The minimum number of times that values for this parameter group or parameter are required.
 
Methods inherited from class AbstractIdentifiedObject
equals, equals, equals, equals, getAlias, getIdentifier, getIdentifier, getIdentifiers, getName, getName, getName, getProperties, getProperties, getRemarks, hashCode, nameMatches, nameMatches, nameMatches
 
Methods inherited from class FormattableObject
getDefaultIndentation, print, setDefaultIndentation, toString, toWKT, toWKT, toWKT
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface IdentifiedObject
getAlias, getIdentifiers, getName, getRemarks, toWKT
 

Constructor Detail

AbstractParameterDescriptor

protected AbstractParameterDescriptor(GeneralParameterDescriptor descriptor)
Constructs a descriptor with the same values than the specified one. This copy constructor may be used in order to wraps an arbitrary implementation into a Geotk one.

Parameters:
descriptor - The descriptor to copy.
Since:
2.2

AbstractParameterDescriptor

protected AbstractParameterDescriptor(Map<String,?> properties,
                                      int minimumOccurs,
                                      int maximumOccurs)
Constructs a parameter from a set of properties. The properties map is given unchanged to the super-class constructor.

Parameters:
properties - Set of properties. Should contains at least "name".
minimumOccurs - The minimum number of times that values for this parameter group or parameter are required.
maximumOccurs - The maximum number of times that values for this parameter group or parameter are required. This value is used in order to check the range. For ParameterValue, it should always be 1.
Method Detail

createValue

public abstract GeneralParameterValue createValue()
Creates a new instance of parameter value or group initialized with the default value(s). The parameter value descriptor for the created parameter value(s) will be this object.

Implementation example:

return new Parameter(this);

Specified by:
createValue in interface GeneralParameterDescriptor

getMinimumOccurs

public int getMinimumOccurs()
The minimum number of times that values for this parameter group or parameter are required. The default value is one. A value of 0 means an optional parameter.

Specified by:
getMinimumOccurs in interface GeneralParameterDescriptor
See Also:
getMaximumOccurs()

getMaximumOccurs

public abstract int getMaximumOccurs()
The maximum number of times that values for this parameter group or parameter can be included. For a single parameter, the value is always 1. For a parameter group, it may vary.

Specified by:
getMaximumOccurs in interface GeneralParameterDescriptor
See Also:
getMinimumOccurs()

equals

public boolean equals(Object object,
                      ComparisonMode mode)
Compares the specified object with this parameter for equality.

Specified by:
equals in interface LenientComparable
Overrides:
equals in class AbstractIdentifiedObject
Parameters:
object - The object to compare to this.
mode - STRICT for performing a strict comparison, or IGNORE_METADATA for comparing only properties relevant to transformations.
Returns:
true if both objects are equal.

computeHashCode

protected int computeHashCode()
Computes a hash value for this identified object. This method is invoked by AbstractIdentifiedObject.hashCode() when first needed.

Implementation specific feature
In the Geotk implementation, the name, identifiers and remarks are not used for hash code computation. Consequently two identified objects will return the same hash value if they are equal in the sense of equals(…, ComparisonMode.IGNORE_METADATA). This feature allows users to implement metadata-insensitive HashMap.

Overrides:
computeHashCode in class AbstractIdentifiedObject
Returns:
The hash code value. This value may change between different execution of the Geotk library.

formatWKT

public String formatWKT(Formatter formatter)
Formats the inner part of a Well Known Text (WKT) element. Note that WKT is not yet defined for parameter descriptor. Current implementation print only the name.

Specified by:
formatWKT in interface Formattable
Overrides:
formatWKT in class FormattableObject
Parameters:
formatter - The formatter to use.
Returns:
The WKT element name, which is "PARAMETER"
See Also:
FormattableObject.toWKT(), FormattableObject.toString()


Copyright © 2009-2011 Geotoolkit.org. All Rights Reserved.