Package jsonvalues

Class JsDouble

    • Field Detail

      • value

        public final double value
        The double value.
    • Method Detail

      • id

        public int id()
        Specified by:
        id in interface JsValue
      • equals

        public boolean equals​(@Nullable Object that)
        Indicates whether some other object is "equal to" this json double. Numbers of different types are equals if the have the same value.
        Overrides:
        equals in class Object
        Parameters:
        that - the reference object with which to compare.
        Returns:
        true if that is a JsNumber with the same value as this JsDouble
      • hashCode

        public int hashCode()
        Returns the hashcode of this json double.
        Overrides:
        hashCode in class Object
        Returns:
        the hashcode of this JsDouble
      • map

        public JsDouble map​(DoubleUnaryOperator fn)
        Maps this json double into another one.
        Parameters:
        fn - the mapping function
        Returns:
        a new JsDouble
      • minus

        public JsDouble minus​(JsDouble that)
        subtract this long from the specified one
        Parameters:
        that - the specified long
        Returns:
        this long minus the specified one
      • of

        public static JsDouble of​(double n)
        Static factory method to create a JsDouble from a double primitive type.
        Parameters:
        n - the double primitive type
        Returns:
        a new JsDouble
      • plus

        public JsDouble plus​(JsDouble that)
        adds up this long to the specified one
        Parameters:
        that - the specified long
        Returns:
        the sum of both longs
      • test

        public boolean test​(DoublePredicate predicate)
        Tests the value of this json double on a predicate.
        Parameters:
        predicate - the predicate
        Returns:
        true if this double satisfies the predicate
      • times

        public JsDouble times​(JsDouble that)
        multiplies this long by the specified one
        Parameters:
        that - the specified long
        Returns:
        this long times the specified one
      • bigIntegerExact

        public Optional<BigInteger> bigIntegerExact()
        Converts this double to a BigInteger, checking for lost information. An empty optional is returned if this double has a nonzero fractional part.
        Returns:
        this double as an bigint wrapped in an Optional
      • equals

        public boolean equals​(JsBigDec jsBigDec)
        returns true if this double and the specified bigdecimal represent the same number
        Parameters:
        jsBigDec - the specified JsBigDec
        Returns:
        true if both JsElem are the same value
      • equals

        public boolean equals​(JsBigInt jsBigInt)
        returns true if this double and the specified biginteger represent the same number
        Parameters:
        jsBigInt - the specified JsBigInt
        Returns:
        true if both JsElem are the same value
      • equals

        public boolean equals​(JsLong jsLong)
        returns true if this double and the specified long represent the same number
        Parameters:
        jsLong - the specified JsLong
        Returns:
        true if both JsElem are the same value
      • equals

        public boolean equals​(JsInt jsInt)
        returns true if this double and the specified integer represent the same number
        Parameters:
        jsInt - the specified JsInt
        Returns:
        true if both JsElem are the same value
      • isDouble

        public boolean isDouble()
        Specified by:
        isDouble in interface JsValue
        Returns:
        true if this JsElem is a JsDouble
      • isNumber

        public boolean isNumber()
        Specified by:
        isNumber in interface JsValue
        Returns:
        true if this element is a number