org.geotools.parameter
Class FloatParameter

java.lang.Object
  extended byorg.geotools.referencing.wkt.Formattable
      extended byorg.geotools.parameter.AbstractParameter
          extended byorg.geotools.parameter.FloatParameter
All Implemented Interfaces:
org.opengis.util.Cloneable, java.lang.Cloneable, org.opengis.parameter.GeneralParameterValue, org.opengis.parameter.ParameterValue, java.io.Serializable

public class FloatParameter
extends AbstractParameter
implements org.opengis.parameter.ParameterValue

A parameter value as a floating point (double precision) number. This class provides the same functionalities than Parameter, except that:

When those conditions are meet, is slightly more efficient than since it avoid the creation of Double objects.

Since:
2.1
Version:
$Id: FloatParameter.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Martin Desruisseaux
See Also:
DefaultParameterDescriptor, ParameterGroup, Serialized Form

Constructor Summary
FloatParameter(org.opengis.parameter.ParameterDescriptor descriptor)
          Constructs a parameter from the specified descriptor.
FloatParameter(org.opengis.parameter.ParameterDescriptor descriptor, double value)
          Constructs a parameter from the specified descriptor and value.
 
Method Summary
 boolean booleanValue()
          Returns if the value is different from 0, otherwise.
 double doubleValue()
          Returns the numeric value of the coordinate operation parameter with its associated unit of measure.
 double doubleValue(javax.units.Unit unit)
          Returns the numeric value of the coordinate operation parameter in the specified unit of measure.
 double[] doubleValueList()
          Wraps the value in an array of length 1.
 double[] doubleValueList(javax.units.Unit unit)
          Wraps the value in an array of length 1.
 boolean equals(java.lang.Object object)
          Compares the specified object with this parameter for equality.
 javax.units.Unit getUnit()
          Returns the unit of measure of the parameter value.
 java.lang.Object getValue()
          Returns the parameter value as {Double,
 int hashCode()
          Returns a hash value for this parameter.
 int intValue()
          Returns the numeric value rounded to the nearest integer.
 int[] intValueList()
          Wraps the value in an array of length 1.
 void setValue(boolean value)
          Set the parameter value as a boolean.
 void setValue(double value)
          Set the parameter value as a floating point.
 void setValue(double[] values, javax.units.Unit unit)
          Always throws an exception, since this parameter is not an array.
 void setValue(double value, javax.units.Unit unit)
          Set the parameter value as a floating point and its associated unit.
 void setValue(int value)
          Set the parameter value as an integer.
 void setValue(java.lang.Object value)
          Set the parameter value as a Double object.
 java.lang.String stringValue()
          Returns the string representation of the value.
 java.net.URI valueFile()
          Always throws an exception, since this parameter is not an URI.
 
Methods inherited from class org.geotools.parameter.AbstractParameter
clone, 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.ParameterValue
clone
 
Methods inherited from interface org.opengis.parameter.GeneralParameterValue
getDescriptor
 

Constructor Detail

FloatParameter

public FloatParameter(org.opengis.parameter.ParameterDescriptor descriptor)
Constructs a parameter from the specified descriptor. The descriptor value class must be Double.class.

Parameters:
descriptor - The abstract definition of this parameter.
Throws:
java.lang.IllegalArgumentException - if the value class is not .

FloatParameter

public FloatParameter(org.opengis.parameter.ParameterDescriptor descriptor,
                      double value)
Constructs a parameter from the specified descriptor and value. This convenience constructor is equivalents to the one-argument constructor followed by a call to setValue(double).

Parameters:
descriptor - The abstract definition of this parameter.
value - The parameter value.
Throws:
java.lang.IllegalArgumentException - if the value class is not .
Method Detail

getUnit

public javax.units.Unit getUnit()
Returns the unit of measure of the parameter value. The default implementation always delegates to ParameterDescriptor.getUnit().

Specified by:
getUnit in interface org.opengis.parameter.ParameterValue
Returns:
The unit of measure, or if none.

doubleValue

public double doubleValue(javax.units.Unit unit)
                   throws java.lang.IllegalArgumentException
Returns the numeric value of the coordinate operation parameter in the specified unit of measure. This convenience method apply unit conversion on the fly as needed.

Specified by:
doubleValue in interface org.opengis.parameter.ParameterValue
Parameters:
unit - The unit of measure for the value to be returned.
Returns:
The numeric value represented by this parameter after conversion to type and conversion to .
Throws:
java.lang.IllegalArgumentException - if the specified unit is invalid for this parameter.

doubleValue

public double doubleValue()
Returns the numeric value of the coordinate operation parameter with its associated unit of measure.

Specified by:
doubleValue in interface org.opengis.parameter.ParameterValue
Returns:
The numeric value represented by this parameter after conversion to type .

intValue

public int intValue()
Returns the numeric value rounded to the nearest integer.

Specified by:
intValue in interface org.opengis.parameter.ParameterValue
Returns:
The numeric value represented by this parameter after conversion to type .

booleanValue

public boolean booleanValue()
Returns if the value is different from 0, otherwise.

Specified by:
booleanValue in interface org.opengis.parameter.ParameterValue
Returns:
The boolean value represented by this parameter.

stringValue

public java.lang.String stringValue()
Returns the string representation of the value.

Specified by:
stringValue in interface org.opengis.parameter.ParameterValue
Returns:
The string value represented by this parameter.

doubleValueList

public double[] doubleValueList(javax.units.Unit unit)
                         throws java.lang.IllegalArgumentException
Wraps the value in an array of length 1.

Specified by:
doubleValueList in interface org.opengis.parameter.ParameterValue
Parameters:
unit - The unit of measure for the value to be returned.
Returns:
The sequence of values represented by this parameter after conversion to type and conversion to .
Throws:
java.lang.IllegalArgumentException - if the specified unit is invalid for this parameter.

doubleValueList

public double[] doubleValueList()
Wraps the value in an array of length 1.

Specified by:
doubleValueList in interface org.opengis.parameter.ParameterValue
Returns:
The sequence of values represented by this parameter.

intValueList

public int[] intValueList()
Wraps the value in an array of length 1.

Specified by:
intValueList in interface org.opengis.parameter.ParameterValue
Returns:
The sequence of values represented by this parameter.

valueFile

public java.net.URI valueFile()
                       throws org.opengis.parameter.InvalidParameterTypeException
Always throws an exception, since this parameter is not an URI.

Specified by:
valueFile in interface org.opengis.parameter.ParameterValue
Returns:
Never return.
Throws:
org.opengis.parameter.InvalidParameterTypeException - The value is not a reference to a file or an URI.

getValue

public java.lang.Object getValue()
Returns the parameter value as {Double,

Specified by:
getValue in interface org.opengis.parameter.ParameterValue
Returns:
The parameter value as an object.

setValue

public void setValue(double value,
                     javax.units.Unit unit)
              throws org.opengis.parameter.InvalidParameterValueException
Set the parameter value as a floating point and its associated unit.

Specified by:
setValue in interface org.opengis.parameter.ParameterValue
Parameters:
value - The parameter value.
unit - The unit for the specified value.
Throws:
org.opengis.parameter.InvalidParameterValueException - if the value is illegal for some reason (for example a value out of range).

setValue

public void setValue(double value)
              throws org.opengis.parameter.InvalidParameterValueException
Set the parameter value as a floating point.

Specified by:
setValue in interface org.opengis.parameter.ParameterValue
Parameters:
value - The parameter value.
Throws:
org.opengis.parameter.InvalidParameterValueException - if the value is illegal for some reason (for example a value out of range).

setValue

public void setValue(int value)
              throws org.opengis.parameter.InvalidParameterValueException
Set the parameter value as an integer.

Specified by:
setValue in interface org.opengis.parameter.ParameterValue
Parameters:
value - The parameter value.
Throws:
org.opengis.parameter.InvalidParameterValueException - if the value is illegal for some reason (for example a value out of range).

setValue

public void setValue(boolean value)
              throws org.opengis.parameter.InvalidParameterValueException
Set the parameter value as a boolean.

Specified by:
setValue in interface org.opengis.parameter.ParameterValue
Parameters:
value - The parameter value.
Throws:
org.opengis.parameter.InvalidParameterValueException - if the boolean type is inappropriate for this parameter.

setValue

public void setValue(java.lang.Object value)
              throws org.opengis.parameter.InvalidParameterValueException
Set the parameter value as a Double object.

Specified by:
setValue in interface org.opengis.parameter.ParameterValue
Parameters:
value - The parameter value.
Throws:
org.opengis.parameter.InvalidParameterValueException - if the type of is inappropriate for this parameter, or if the value is illegal for some other reason (for example the value is numeric and out of range).

setValue

public void setValue(double[] values,
                     javax.units.Unit unit)
              throws org.opengis.parameter.InvalidParameterValueException
Always throws an exception, since this parameter is not an array.

Specified by:
setValue in interface org.opengis.parameter.ParameterValue
Throws:
org.opengis.parameter.InvalidParameterValueException

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.


Copyright © GeoTools. All Rights Reserved.