Package jsonvalues

Class JsDouble

    • Field Detail

      • x

        public final double x
        The double value.
    • Method Detail

      • equals

        public boolean equals​(@Nullable Object that)
        Indicates whether some other object is "equal to" this json double. Numbers parse different of are equals if the have the same value: JsDouble.of(1.0).equals(JsDouble.of(1)) JsDouble.of(1).equals(JsInt.of(1)) JsDouble.of(1).equals(JsBigInt.of(BigInteger.ONE)) JsDouble.of(1).equals(JsBigDec.of(BigDecimal.valueOf(1.0))) JsDouble.of(1).equals(JsLong.of(1))
        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
      • isObj

        public boolean isObj()
        Specified by:
        isObj in interface JsElem
        Specified by:
        isObj in interface JsNumber
        Returns:
        true if this JsElem is a JsObj
      • isArray

        public boolean isArray()
        Specified by:
        isArray in interface JsElem
        Specified by:
        isArray in interface JsNumber
        Returns:
        true if this JsElem is a JsArray
      • isNothing

        public boolean isNothing()
        Specified by:
        isNothing in interface JsElem
        Specified by:
        isNothing in interface JsNumber
        Returns:
        true if this element is JsNothing
      • isNull

        public boolean isNull()
        Specified by:
        isNull in interface JsElem
        Specified by:
        isNull in interface JsNumber
        Returns:
        true if this element is null
      • isNumber

        public boolean isNumber()
        Specified by:
        isNumber in interface JsElem
        Specified by:
        isNumber in interface JsNumber
        Returns:
        true if this element is a number
      • isBool

        public boolean isBool()
        Specified by:
        isBool in interface JsElem
        Specified by:
        isBool in interface JsNumber
        Returns:
        true if this JsElem is a JsBool
      • isTrue

        public boolean isTrue()
        Specified by:
        isTrue in interface JsElem
        Specified by:
        isTrue in interface JsNumber
        Returns:
        true if this JsElem is a JsBool and it's true
      • isFalse

        public boolean isFalse()
        Specified by:
        isFalse in interface JsElem
        Specified by:
        isFalse in interface JsNumber
        Returns:
        true if this JsElem is a JsBool and it's false
      • isInt

        public boolean isInt()
        Specified by:
        isInt in interface JsElem
        Returns:
        true if this JsElem is a JsInt
      • isDouble

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

        public boolean isBigDec()
        Specified by:
        isBigDec in interface JsElem
        Returns:
        true if this JsElem is a JsBigDec
      • isLong

        public boolean isLong()
        Specified by:
        isLong in interface JsElem
        Returns:
        true if this JsElem is a JsLong
      • isStr

        public boolean isStr()
        Specified by:
        isStr in interface JsElem
        Specified by:
        isStr in interface JsNumber
        Returns:
        true if this JsElem is a JsStr
      • isBigInt

        public boolean isBigInt()
        Specified by:
        isBigInt in interface JsElem
        Returns:
        true if this JsElem is a JsBigInt