Package org.meeuw.math.numbers
Interface Scalar<SELF extends Scalar<SELF>>
-
- Type Parameters:
SELF
- self reference
- All Superinterfaces:
Comparable<SELF>
,SignedNumber
,Sizeable<SELF>
- All Known Subinterfaces:
CompleteFieldElement<E>
,ScalarFieldElement<E>
,UncertainDouble<D>
,UncertainReal
- All Known Implementing Classes:
AbstractUncertainDouble
,UncertainDoubleElement
public interface Scalar<SELF extends Scalar<SELF>> extends Comparable<SELF>, SignedNumber, Sizeable<SELF>
A scalar is the closest thing to aNumber
interface- Since:
- 0.4
- Author:
- Michiel Meeuwissen
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description BigDecimal
bigDecimalValue()
default byte
byteValue()
Returns the value of the specified number as abyte
, which may involve rounding or truncation.double
doubleValue()
Returns the value of the specified number as adouble
, which may involve rounding.default float
floatValue()
Returns the value of the specified number as afloat
, which may involve rounding.default boolean
gt(SELF other)
default boolean
gte(SELF other)
default int
intValue()
Returns the value of the specified number as anint
, which may involve rounding or truncation.default boolean
isFinite()
default boolean
isNaN()
long
longValue()
Returns the value of the specified number as along
, which may involve rounding or truncation.default boolean
lt(SELF other)
default boolean
lte(SELF other)
default short
shortValue()
Returns the value of the specified number as ashort
, which may involve rounding or truncation.-
Methods inherited from interface java.lang.Comparable
compareTo
-
Methods inherited from interface org.meeuw.math.numbers.SignedNumber
isNegative, isPositive, isZero, signum
-
-
-
-
Method Detail
-
intValue
default int intValue()
Returns the value of the specified number as anint
, which may involve rounding or truncation.- Returns:
- the numeric value represented by this object after conversion
to type
int
.
-
longValue
long longValue()
Returns the value of the specified number as along
, which may involve rounding or truncation.- Returns:
- the numeric value represented by this object after conversion
to type
long
.
-
floatValue
default float floatValue()
Returns the value of the specified number as afloat
, which may involve rounding.- Returns:
- the numeric value represented by this object after conversion
to type
float
.
-
doubleValue
double doubleValue()
Returns the value of the specified number as adouble
, which may involve rounding.- Returns:
- the numeric value represented by this object after conversion
to type
double
.
-
byteValue
default byte byteValue()
Returns the value of the specified number as abyte
, which may involve rounding or truncation.This implementation returns the result of
intValue()
cast to abyte
.- Returns:
- the numeric value represented by this object after conversion
to type
byte
.
-
shortValue
default short shortValue()
Returns the value of the specified number as ashort
, which may involve rounding or truncation.This implementation returns the result of
intValue()
cast to ashort
.- Returns:
- the numeric value represented by this object after conversion
to type
short
.
-
bigDecimalValue
BigDecimal bigDecimalValue()
-
isFinite
default boolean isFinite()
-
isNaN
default boolean isNaN()
-
lt
default boolean lt(SELF other)
-
gt
default boolean gt(SELF other)
-
lte
default boolean lte(SELF other)
-
gte
default boolean gte(SELF other)
-
-