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". Had Number been an interface...
  • Method Details

    • booleanValue

      static boolean booleanValue(Comparable<?> number)
    • byteValue

      static byte byteValue(Comparable<?> number)
    • doubleValue

      static double doubleValue(Comparable<?> number)
    • floatValue

      static float floatValue(Comparable<?> number)
    • intValue

      static int intValue(Comparable<?> number)
    • longValue

      static long longValue(Comparable<?> number)
    • parseDouble

      static double parseDouble(CharSequence sequence)
      Parses a CharSequence 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 a NullPointerException 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 a CharSequence, rather than String, as input. Further more it does not create any garbage (no intermediate objects created).

    • parseFloat

      static float parseFloat(CharSequence sequence)
      Similar to parseDouble(CharSequence) but for float, and thus limited to 7 digits after the decimal point. It is almost 10 times faster than Float.parseFloat(String).
      See Also:
    • parseInt

      static int parseInt(CharSequence sequence)
      See Also:
    • parseLong

      static long parseLong(CharSequence sequence)
      Similar to parseDouble(CharSequence) but for long. Performs roughly the same as Long.parseLong(String), but takes a CharSequence, rather than String, as input.
      See Also:
    • parseShort

      static short parseShort(CharSequence sequence)
      See Also:
    • shortValue

      static short shortValue(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()