|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectFormattableObject
AbstractParameter
AbstractParameterValue<Double>
FloatParameter
public class FloatParameter
A parameter value as a floating point (double precision) number.
This class provides the same functionalities than Parameter, except that:
double.
When those conditions are meet, FloatParameter is slightly more efficient
than Parameter since it avoid the creation of Double wrapper objects.
Implementation note for subclasses
Except for the constructors, the equals(Object) and the hashCode() methods,
all read and write operations ultimately delegates to the following methods:
doubleValue() and - if needed - getUnit(),
then performs their processing on the values returned by those methods.setValue(double, Unit) method.Consequently, the above-cited methods provide single points that subclasses can override for modifying the behavior of all getter and setter methods.
DefaultParameterDescriptor,
ParameterGroup,
Serialized Form
| referencing/geotk-referencing (download) | View source code for this class |
| Constructor Summary | |
|---|---|
FloatParameter(ParameterDescriptor<Double> descriptor)
Constructs a parameter from the specified descriptor. |
|
FloatParameter(ParameterDescriptor<Double> descriptor,
double value)
Constructs a parameter from the specified descriptor and value. |
|
| Method Summary | |
|---|---|
boolean |
booleanValue()
Returns true if the value is different from 0, or false otherwise. |
FloatParameter |
clone()
Returns a clone of this parameter. |
double |
doubleValue()
Returns the numeric value represented by this operation parameter. |
double |
doubleValue(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 0 or 1. |
double[] |
doubleValueList(Unit<?> unit)
Wraps the value in an array of length 0 or 1. |
boolean |
equals(Object object)
Compares the specified object with this parameter for equality. |
Unit<?> |
getUnit()
Returns the unit of measure of the parameter value. |
Double |
getValue()
Returns the parameter value as a Double, or null if none. |
int |
hashCode()
Returns a hash value for this parameter. |
int |
intValue()
Returns the numeric value casted to integer. |
int[] |
intValueList()
Wraps the value in an array of length 1. |
void |
setValue(boolean value)
Sets the parameter value as a boolean. |
void |
setValue(double value)
Sets the parameter value as a floating point. |
void |
setValue(double[] values,
Unit<?> unit)
If the length of the given array is 1, delegates to setValue(double, Unit). |
void |
setValue(double value,
Unit<?> unit)
Sets the parameter value as a floating point and its associated unit. |
void |
setValue(int value)
Sets the parameter value as an integer. |
void |
setValue(Object value)
Sets the parameter value as a Double object. |
String |
stringValue()
Returns the string representation of the value. |
URI |
valueFile()
Always throws an exception, since this parameter is not an URI. |
| Methods inherited from class AbstractParameterValue |
|---|
addChangeListener, getDescriptor, removeChangeListener |
| Methods inherited from class AbstractParameter |
|---|
formatWKT, toString, write |
| Methods inherited from class FormattableObject |
|---|
print, toWKT, toWKT |
| Methods inherited from class Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public FloatParameter(ParameterDescriptor<Double> descriptor)
descriptor - The abstract definition of this parameter.
IllegalArgumentException - if the value class is not Double.class.
public FloatParameter(ParameterDescriptor<Double> descriptor,
double value)
setValue(double).
descriptor - The abstract definition of this parameter.value - The parameter value.
IllegalArgumentException - if the value class is not Double.class.| Method Detail |
|---|
public Unit<?> getUnit()
ParameterDescriptor.getUnit().
Implementation note for subclasses
All getter methods which need unit information will invoke this getUnit() method.
Subclasses can override this method if they need to compute the unit dynamically.
null if none.
public double doubleValue(Unit<?> unit)
throws IllegalArgumentException
unit - The unit of measure for the value to be returned.
unit,
or Double.NaN if none.
IllegalArgumentException - if the specified unit is invalid for this parameter.public double doubleValue()
getUnit().
Implementation note for subclasses
All getter methods will invoke this doubleValue() method. Subclasses can override
this method if they need to compute the value dynamically.
Double.NaN if none.
public int intValue()
throws IllegalStateException
int.
InvalidParameterTypeException - If the value can not be casted to integer.
IllegalStateException - if the value is not defined and there is no default value.
public boolean booleanValue()
throws IllegalStateException
true if the value is different from 0, or false otherwise.
IllegalStateException - if the value is not defined and there is no default value.
public String stringValue()
throws IllegalStateException
IllegalStateException - if the value is not defined and there is no default value.
public double[] doubleValueList(Unit<?> unit)
throws IllegalArgumentException
unit - The unit of measure for the value to be returned.
double and conversion to unit.
IllegalArgumentException - if the specified unit is invalid for this parameter.public double[] doubleValueList()
public int[] intValueList()
throws InvalidParameterTypeException
InvalidParameterTypeException - If the value can not be casted to integer.
public URI valueFile()
throws InvalidParameterTypeException
InvalidParameterTypeException - The value is not a reference to a file or an URI.public Double getValue()
Double, or null if none.
null
if the current value is Double.NaN.
public void setValue(double value,
Unit<?> unit)
throws InvalidParameterValueException
Implementation note for subclasses
This method is invoked by all other setXXX(…) methods. Subclasses can override
this method if they want to perform more processing on the value before its storage,
or to be notified about value changes.
value - The parameter value.unit - The new unit of measurement.
InvalidParameterValueException - if the value is illegal for some reason
(for example a value out of range).
public void setValue(double value)
throws InvalidParameterValueException
setValue(double, Unit).
value - The parameter value.
InvalidParameterValueException - if the value is illegal for some reason
(for example a value out of range).
public void setValue(int value)
throws InvalidParameterValueException
setValue(double).
value - The parameter value.
InvalidParameterValueException - if the value is illegal for some reason
(for example a value out of range).
public void setValue(boolean value)
throws InvalidParameterValueException
setValue(double) with value 1 for true or 0 or false.
value - The parameter value.
InvalidParameterValueException - if the boolean type is inappropriate for this parameter.
public void setValue(Object value)
throws InvalidParameterValueException
Double object. The default implementation ensures
that the given value is a Number, then delegates to setValue(double).
value - The parameter value, or null for Double.NaN.
InvalidParameterValueException - if the type of value 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).
public void setValue(double[] values,
Unit<?> unit)
throws InvalidParameterValueException
setValue(double, Unit).
Otherwise throws an exception, since this parameter does not accept arbitrary arrays.
InvalidParameterValueExceptionpublic boolean equals(Object object)
equals in class AbstractParameterobject - The object to compare to this.
true if both objects are equal.public int hashCode()
hashCode in class AbstractParameterpublic FloatParameter clone()
clone in interface GeneralParameterValueclone in interface ParameterValue<Double>clone in class AbstractParameterValue<Double>Object.clone()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||