|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface FloatingPointType<T extends java.lang.Number & java.lang.Comparable<T>>
Title: Floating Point Type
Description: Interface to provide a common set of methods for Float and Double types
Copyright: Copyright (c) 2009
Company: Clark & Parsia, LLC.
Method Summary | |
---|---|
T |
cast(java.lang.Object o)
Casts an object to the class described by this FloatingPointType object. |
T |
decrement(T n)
Return the next floating point value in the direction of -Inf |
T |
getNaN()
Gets the Not-a-Number constant for the type. |
T |
getNegativeInfinity()
Gets the negative infinity constant for the type. |
T |
getPositiveInfinity()
Gets the positive infinity constant for the type. |
T |
increment(T n)
Return the next floating point value in the direction of +Inf |
java.lang.Number |
intervalSize(T lower,
T upper)
Count the number of floating point values in an inclusive interval |
boolean |
isInstance(java.lang.Object o)
Determine if the specified Object is assignment compatible
with the object represented by this FloatingPointType . |
boolean |
isNaN(T f)
Returns true if this floating point value is a Not-a-Number
(NaN) value, false otherwise. |
Method Detail |
---|
T cast(java.lang.Object o)
FloatingPointType
object.
o
- the object to cast
o
in the appropriate type
java.lang.ClassCastException
- if the object is not null and is no assignable to the type
T
.T decrement(T n)
-Inf.
- Parameters:
n
- The value to decrement
- Returns:
- If
n > -Inf
, the next floating point value in the
direction of -Inf. If n == -Inf
,
-Inf
.
- Throws:
java.lang.IllegalArgumentException
- if n.isNaN()
T getNaN()
T.NaN
T getNegativeInfinity()
T.NEGATIVE_INFINITY
T getPositiveInfinity()
T.POSITIVE_INFINITY
T increment(T n)
+Inf.
- Parameters:
n
- The value to increment
- Returns:
- If
n < +Inf
, the next floating point value in the
direction of +Inf. If n == +Inf
,
+Inf
.
- Throws:
java.lang.IllegalArgumentException
- if n.isNaN()
java.lang.Number intervalSize(T lower, T upper)
lower
- The lower bound of the intervalupper
- The upper bound of the interval
lower.equals(upper)
, 1
. Else, the
number of floating point values between lower
and
upper
plus 2
boolean isInstance(java.lang.Object o)
Object
is assignment compatible
with the object represented by this FloatingPointType
.
Typically implemented as a wrapper for
T.class.isInstance(Object)
.
o
- the object to check
true
if o
is an instance of
T
, false
else.boolean isNaN(T f)
true
if this floating point value is a Not-a-Number
(NaN) value, false
otherwise.
f
- the value to be tested
true
if the argument is NaN, else false
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |