Interface NumberDefinition
- All Known Subinterfaces:
AccessScalar<N>
,AggregatorFunction<N>
,BigFunction.Nullary
,ComparableNumber<N>
,ComplexFunction.Nullary
,ElementView1D<N,
,V> ElementView2D<N,
,V> ElementViewAnyD<N,
,V> EntryPair.KeyedPrimitive<K>
,NullaryFunction<N>
,PrimitiveFunction.Nullary
,PrimitiveNumber
,QuadrupleFunction.Nullary
,QuaternionFunction.Nullary
,RationalFunction.Nullary
,Scalar<N>
,SelfDeclaringScalar<S>
- All Known Implementing Classes:
AbstractContinuous
,AbstractDiscrete
,Access1D.ElementView
,Access2D.ElementView
,AccessAnyD.ElementView
,AggregatorFunction.PredicateWrapper
,AlphaVantageParser.Data
,Amount
,BigAggregator.BigAggregatorFunction
,BigScalar
,BinaryFunction.FixedFirst
,BinaryFunction.FixedSecond
,Binomial
,CalendarDateDuration
,Cauchy
,ChiSquareDistribution
,ChiSquareDistribution.Degree2
,ChiSquareDistribution.NormalApproximation
,ComplexAggregator.ComplexAggregatorFunction
,ComplexNumber
,DatePrice
,DatePrice.DefaultDP
,Deterministic
,EntryPair.ObjectByte
,EntryPair.ObjectDouble
,EntryPair.ObjectFloat
,EntryPair.ObjectInt
,EntryPair.ObjectLong
,EntryPair.ObjectShort
,Erlang
,ExactDecimal
,Exponential
,Gamma
,Geometric
,IEXTradingParser.Data
,LogNormal
,Money
,Normal
,Poisson
,Price
,PrimitiveAggregator.PrimitiveAggregatorFunction
,PrimitiveNumber.BoxedByte
,PrimitiveNumber.BoxedDouble
,PrimitiveNumber.BoxedFloat
,PrimitiveNumber.BoxedInt
,PrimitiveNumber.BoxedLong
,PrimitiveNumber.BoxedShort
,PrimitiveScalar
,Quadruple
,QuadrupleAggregator.QuadrupleAggregatorFunction
,Quantity
,Quaternion
,QuaternionAggregator.QuaternionAggregatorFunction
,RandomNumber
,RationalAggregator.RationalAggregatorFunction
,RationalNumber
,SparseArray.NonzeroView
,TDistribution
,TDistribution.Degree1
,TDistribution.Degree2
,TDistribution.Degree3
,TDistribution.Degree4
,TDistribution.Degree5
,TDistribution.DegreeInfinity
,Uniform
,Weibull
,YahooParser.Data
Number
been an interface...-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
static boolean
booleanValue
(Comparable<?> number) default byte
static byte
byteValue
(Comparable<?> number) double
static double
doubleValue
(Comparable<?> number) default float
static float
floatValue
(Comparable<?> number) default int
intValue()
static int
intValue
(Comparable<?> number) default long
static long
longValue
(Comparable<?> number) static double
parseDouble
(CharSequence sequence) Parses aCharSequence
into a double.static float
parseFloat
(CharSequence sequence) Similar toparseDouble(CharSequence)
but for float, and thus limited to 7 digits after the decimal point.static int
parseInt
(CharSequence sequence) Similar toparseDouble(CharSequence)
andparseLong(CharSequence)
but for int.static long
parseLong
(CharSequence sequence) Similar toparseDouble(CharSequence)
but for long.static short
parseShort
(CharSequence sequence) Similar toparseDouble(CharSequence)
andparseLong(CharSequence)
but for short.default short
static short
shortValue
(Comparable<?> number) static boolean
toBoolean
(int value) static int
toInt
(double value) static int
toInt
(float value) static long
toLong
(double value)
-
Method Details
-
booleanValue
-
byteValue
-
doubleValue
-
floatValue
-
intValue
-
longValue
-
parseDouble
Parses aCharSequence
into a double. Only plain and simple numbers are supported – no scientific notation, no hexadecimal notation, no octal notation, no binary notation, no fractions, no exponents, no grouping, no leading or trailing whitespace, no commas, no underscores, no currency symbols, no NaN, no positive or negative infinity or anything else fancy – just plain and simple numbers.If the
CharSequence
is null aNullPointerException
is thrown.If it's empty, length zero, zero is returned.
If it contains any characters other than '+', '-', '.', '0', '1', '2', '3', '4', '5', '6', '7', '8' or '9' the return value is undefined.
If any of the characters '+', '-' or '.' appears more than once the return value is undefined.
If both '+' and '-' appear the return value is undefined.
If there are more than 16 digits after the decimal point the return value is undefined.
This method does not throw any exceptions (other than that eventual
NullPointerException
). Nor does it do any error checking.This method is more than 10 times faster than
Double.parseDouble(String)
. It takes aCharSequence
, rather thanString
, as input. Further more it does not create any garbage (no intermediate objects created). -
parseFloat
Similar toparseDouble(CharSequence)
but for float, and thus limited to 7 digits after the decimal point. It is almost 10 times faster thanFloat.parseFloat(String)
.- See Also:
-
parseInt
Similar toparseDouble(CharSequence)
andparseLong(CharSequence)
but for int.- See Also:
-
parseLong
Similar toparseDouble(CharSequence)
but for long. Performs roughly the same asLong.parseLong(String)
, but takes aCharSequence
, rather thanString
, as input.- See Also:
-
parseShort
Similar toparseDouble(CharSequence)
andparseLong(CharSequence)
but for short.- See Also:
-
shortValue
-
toBoolean
static boolean toBoolean(int value) -
toInt
static int toInt(double value) -
toInt
static int toInt(float value) -
toLong
static long toLong(double value) -
booleanValue
default boolean booleanValue() -
byteValue
default byte byteValue() -
doubleValue
double doubleValue() -
floatValue
default float floatValue() -
intValue
default int intValue() -
longValue
default long longValue() -
shortValue
default short shortValue()
-