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
public interface NumberDefinition
An interface defining a "Number". HadNumber
been an interface...
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default boolean
booleanValue()
static boolean
booleanValue(java.lang.Comparable<?> number)
default byte
byteValue()
static byte
byteValue(java.lang.Comparable<?> number)
double
doubleValue()
static double
doubleValue(java.lang.Comparable<?> number)
default float
floatValue()
static float
floatValue(java.lang.Comparable<?> number)
default int
intValue()
static int
intValue(java.lang.Comparable<?> number)
default long
longValue()
static long
longValue(java.lang.Comparable<?> number)
static double
parseDouble(java.lang.CharSequence sequence)
Parses aCharSequence
into a double.static float
parseFloat(java.lang.CharSequence sequence)
Similar toparseDouble(CharSequence)
but for float, and thus limited to 7 digits after the decimal point.static int
parseInt(java.lang.CharSequence sequence)
Similar toparseDouble(CharSequence)
andparseLong(CharSequence)
but for int.static long
parseLong(java.lang.CharSequence sequence)
Similar toparseDouble(CharSequence)
but for long.static short
parseShort(java.lang.CharSequence sequence)
Similar toparseDouble(CharSequence)
andparseLong(CharSequence)
but for short.default short
shortValue()
static short
shortValue(java.lang.Comparable<?> number)
static boolean
toBoolean(int value)
static int
toInt(double value)
static int
toInt(float value)
static long
toLong(double value)
-
-
-
Method Detail
-
booleanValue
static boolean booleanValue(java.lang.Comparable<?> number)
-
byteValue
static byte byteValue(java.lang.Comparable<?> number)
-
doubleValue
static double doubleValue(java.lang.Comparable<?> number)
-
floatValue
static float floatValue(java.lang.Comparable<?> number)
-
intValue
static int intValue(java.lang.Comparable<?> number)
-
longValue
static long longValue(java.lang.Comparable<?> number)
-
parseDouble
static double parseDouble(java.lang.CharSequence sequence)
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
static float parseFloat(java.lang.CharSequence sequence)
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:
parseDouble(CharSequence)
-
parseInt
static int parseInt(java.lang.CharSequence sequence)
Similar toparseDouble(CharSequence)
andparseLong(CharSequence)
but for int.- See Also:
parseDouble(CharSequence)
,parseLong(CharSequence)
-
parseLong
static long parseLong(java.lang.CharSequence sequence)
Similar toparseDouble(CharSequence)
but for long. Performs roughly the same asLong.parseLong(String)
, but takes aCharSequence
, rather thanString
, as input.- See Also:
parseDouble(CharSequence)
-
parseShort
static short parseShort(java.lang.CharSequence sequence)
Similar toparseDouble(CharSequence)
andparseLong(CharSequence)
but for short.- See Also:
parseDouble(CharSequence)
,parseLong(CharSequence)
-
shortValue
static short shortValue(java.lang.Comparable<?> number)
-
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()
-
-