OpenAPI 1.0

com.aquafold.openapi.type
Interface AQDoubleFactory


public interface AQDoubleFactory

This interface provides manipulation and validation functionality for Double data type.

An instance of this interface is available via aqua.type.getDouble(). (For technical reasons, aqua.type.double is not available).


Method Summary
 boolean isCloseTo(Object a, Object b, Object distance)
          Checks if two values are within the specified distance.
 boolean isGreater(Object a, Object b)
          Checks if the value is greater than a specified threshold.
 boolean isGreaterOrEqual(Object a, Object b)
          Checks if the value is less than or equals to a specified threshold.
 boolean isInRange(Object value, Object min, Object max)
          Checks if the value is within a specified range, inclusive.
 boolean isLess(Object a, Object b)
          Checks if the value is less than a specified threshold.
 boolean isLessOrEqual(Object a, Object b)
          Checks if the value is less than or equals to a specified threshold.
 boolean isValid(String value)
          Interprets a specified value as a Double (using default platform locale).
 Double parse(Object value)
          Creates a Double instance assuming default platform locale.
 Double parse(String value, String pattern)
          Creates a Double instance using a specified pattern and locale.
 Double parse(String value, String pattern, String locale)
          Interprets a specified value as a Double using a specified pattern and locale.
 

Method Detail

parse

Double parse(Object value)
Creates a Double instance assuming default platform locale. Depending on the type of its argument, this method tries to make the most precise conversion.

If conversion is successful, the method returns the resulting Double object, otherwise it throws an exception.

Parameters:
value -

parse

Double parse(String value,
             String pattern)
Creates a Double instance using a specified pattern and locale.

If conversion is successful, the method returns the resulting Double object, otherwise it throws an exception.

Parameters:
value -
pattern -

parse

Double parse(String value,
             String pattern,
             String locale)
Interprets a specified value as a Double using a specified pattern and locale.

If conversion is successful, the method returns the resulting Double object, otherwise it throws an exception.

Parameters:
value -
pattern -
locale -

isInRange

boolean isInRange(Object value,
                  Object min,
                  Object max)
Checks if the value is within a specified range, inclusive.

Parameters:
value - The value in question.
min - Start of the range.
max - End of the range. * @throws Exception If any of the parameters cannot be converted to a double.
Returns:
true if value is within the range specified, inclusive of the min and max parameters.

isLess

boolean isLess(Object a,
               Object b)
Checks if the value is less than a specified threshold.

Parameters:
a - The double value to compare to.
b - The double value to compare with.
Returns:
true if the value of the parameter a is less then the value of the parameter b.
Throws:
Exception - If any of the parameters cannot be converted to double.

isLessOrEqual

boolean isLessOrEqual(Object a,
                      Object b)
Checks if the value is less than or equals to a specified threshold.

Parameters:
a - The double value to compare to.
b - The double value to compare with.
Returns:
true if the value of the parameter a is less or equal to the value of the parameter b.
Throws:
Exception - If any of the parameters cannot be converted to double.

isGreater

boolean isGreater(Object a,
                  Object b)
Checks if the value is greater than a specified threshold.

Parameters:
a - The double value to compare to.
b - The double value to compare with.
Returns:
true if the value of the parameter a is greater then the value of the parameter b.
Throws:
Exception - If any of the parameters cannot be converted to double.

isGreaterOrEqual

boolean isGreaterOrEqual(Object a,
                         Object b)
Checks if the value is less than or equals to a specified threshold.

Parameters:
a - The double value to compare to.
b - The double value to compare with.
Returns:
true if the value of the parameter a is greater or equal to the value of the parameter b.
Throws:
Exception - If any of the parameters cannot be converted to a double.

isCloseTo

boolean isCloseTo(Object a,
                  Object b,
                  Object distance)
Checks if two values are within the specified distance. Since Double is inexact, mathematical operations may produce small errors, which make exact comparison fail.

Parameters:
a - The 1st big decimal value.
b - The 2nd big decimal value.
distance - The distance, as specified by the user to compare the difference between a and b.
Returns:
true the comparison is successful.
Throws:
Exception - if any of the parameters cannot be converted to a double.

isValid

boolean isValid(String value)
Interprets a specified value as a Double (using default platform locale).

If conversion is successful, the method returns resulting Double object, otherwise it returns null.

Parameters:
value -

OpenAPI 1.0


Copyright © 2010 AquaFold, Inc. All Rights Reserved. Use is subject to license terms.