|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.geotools.resources.XMath
public final class XMath
Simple mathematical functions.
Field Summary | |
---|---|
static double |
LN10
Deprecated. Was for log10(double) internal usage only. |
Method Summary | ||
---|---|---|
static int |
countFractionDigits(double value)
Deprecated. Moved to XMath . |
|
static double |
fixRoundingError(double value,
int n)
Deprecated. Moved to XMath . |
|
static int |
getBitCount(java.lang.Class<?> type)
Deprecated. Moved to Classes . |
|
static double |
hypot(double x,
double y)
Deprecated. Replaced by Math.hypot(double, double) . |
|
static boolean |
isInteger(java.lang.Class<?> type)
Deprecated. Moved to Classes . |
|
static boolean |
isReal(java.lang.Class<?> type)
Deprecated. Moved to Classes . |
|
static double |
log10(double x)
Deprecated. Replaced by Math.log10(double) . |
|
static double |
next(double f)
Finds the least double greater than f. |
|
static float |
next(float f)
Finds the least float greater than f. |
|
static double |
pow10(double x)
Deprecated. Moved to XMath . |
|
static double |
pow10(int x)
Deprecated. Moved to XMath . |
|
static double |
previous(double f)
Finds the greatest double less than f. |
|
static float |
previous(float f)
Finds the greatest float less than f. |
|
static java.lang.Class<?> |
primitiveToWrapper(java.lang.Class<?> type)
Deprecated. Moved to Classes . |
|
static double |
rool(java.lang.Class type,
double value,
int amount)
Returns the next or previous representable number. |
|
static double |
round(double value,
int flu)
Deprecated. Moved to XMath . |
|
static byte |
sgn(byte x)
Deprecated. Moved to XMath . |
|
static int |
sgn(double x)
Deprecated. Moved to XMath . |
|
static int |
sgn(float x)
Deprecated. Moved to XMath . |
|
static int |
sgn(int x)
Deprecated. Moved to XMath . |
|
static int |
sgn(long x)
Deprecated. Moved to XMath . |
|
static short |
sgn(short x)
Deprecated. Moved to XMath . |
|
static float |
toNaN(int index)
Deprecated. Moved to XMath . |
|
static
|
valueOf(java.lang.Class<T> type,
java.lang.String value)
Deprecated. Moved to Classes . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final double LN10
log10(double)
internal usage only.
Method Detail |
---|
@Deprecated public static double hypot(double x, double y)
Math.hypot(double, double)
.
sqrt(x²+y²)
).
@Deprecated public static double log10(double x)
Math.log10(double)
.
@Deprecated public static double pow10(double x)
XMath
.
@Deprecated public static double pow10(int x)
XMath
.
@Deprecated public static int sgn(double x)
XMath
.
NaN
and
+1 if x is positive.
Math.signum(double)
@Deprecated public static int sgn(float x)
XMath
.
NaN
and
+1 if x is positive.
Math.signum(float)
@Deprecated public static int sgn(long x)
XMath
.
@Deprecated public static int sgn(int x)
XMath
.
@Deprecated public static short sgn(short x)
XMath
.
@Deprecated public static byte sgn(byte x)
XMath
.
@Deprecated public static double round(double value, int flu)
XMath
.
value
- The value to round.flu
- The amount of floating point units.
value
if it was not close enough to an integer.@Deprecated public static double fixRoundingError(double value, int n)
XMath
.
n
fraction digits in the string representation of
the specified value. This method try small changes to value
, by adding or
substracting a maximum of 4 ulps. If there is no small change that remove at least
n
fraction digits, then the value is returned unchanged. This method is
used for hiding rounding errors, like in conversions from radians to degrees.
Example: XMath.fixRoundingError(-61.500000000000014, 12)
returns
-61.5
.
value
- The value to fix.n
- The minimum amount of fraction digits.
value
if there is no small change
that remove at least n
fraction digits.@Deprecated public static int countFractionDigits(double value)
XMath
.
Double#toString(value)
and counting the number of digits after the decimal separator.
public static float next(float f)
NaN
, returns same value.
public static float previous(float f)
NaN
, returns same value.
public static double next(double f)
NaN
, returns same value.
ChoiceFormat.nextDouble(double)
public static double previous(double f)
NaN
, returns same value.
ChoiceFormat.previousDouble(double)
public static double rool(java.lang.Class type, double value, int amount) throws java.lang.IllegalArgumentException
amount
is equals to
0
, then this method returns the value
unchanged. Otherwise,
The operation performed depends on the specified type
:
If the type
is Double
, then this method is
equivalent to invoking previous(double)
if amount
is equals to
-1
, or invoking next(double)
if amount
is equals to
+1
. If amount
is smaller than -1
or greater
than +1
, then this method invokes previous(double)
or
next(double)
in a loop for abs(amount)
times.
If the type
is Float
, then this method is
equivalent to invoking previous(float)
if amount
is equals to
-1
, or invoking next(float)
if amount
is equals to
+1
. If amount
is smaller than -1
or greater
than +1
, then this method invokes previous(float)
or
next(float)
in a loop for abs(amount)
times.
If the type
is an integer, then invoking
this method is equivalent to computing value + amount
.
type
- The type. Should be the class of Double
, Float
,
Long
, Integer
, Short
or Byte
.value
- The number to rool.amount
- -1 to return the previous representable number,
+1 to return the next representable number, or
0 to return the number with no change.
double
.
java.lang.IllegalArgumentException
- if type
is not one of supported types.@Deprecated public static float toNaN(int index) throws java.lang.IndexOutOfBoundsException
XMath
.
NaN
number for the specified index. Valid NaN numbers have
bit fields ranging from 0x7f800001
through 0x7fffffff
or 0xff800001
through 0xffffffff
. The standard Float.NaN
has bit fields 0x7fc00000
.
index
- The index, from -2097152 to 2097151 inclusive.
NaN
values as a float.
java.lang.IndexOutOfBoundsException
- if the specified index is out of bounds.@Deprecated public static boolean isReal(java.lang.Class<?> type)
Classes
.
true
if the specified type
is one of real
number types. Real number types includes Float
and Double
.
type
- The type to test (may be null
).
true
if type
is the class Float
or Double
.@Deprecated public static boolean isInteger(java.lang.Class<?> type)
Classes
.
true
if the specified type
is one of integer types.
Integer types includes Long
, Integer
, Short
and Byte
.
type
- The type to test (may be null
).
true
if type
is the class Long
, Integer
,
Short
or Byte
.@Deprecated public static int getBitCount(java.lang.Class<?> type)
Classes
.
type
- The type (may be null
).
@Deprecated public static java.lang.Class<?> primitiveToWrapper(java.lang.Class<?> type)
Classes
.
double
to Double
).
If the specified class is not a primitive type, then it is returned unchanged.
type
- The primitive type (may be null
).
@Deprecated public static <T> T valueOf(java.lang.Class<T> type, java.lang.String value) throws java.lang.IllegalArgumentException, java.lang.NumberFormatException
Classes
.
Boolean
, Integer
, Double
, etc. according the
specified type.
type
- The requested type.value
- the value to parse.
null
if value
was null.
java.lang.IllegalArgumentException
- if type
is not a recognized type.
java.lang.NumberFormatException
- if the string value is not parseable as a number
of the specified type.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |