Package jsonvalues

Class JsInt

    • Field Detail

      • x

        public final int x
        The integer value.
    • Method Detail

      • equals

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

        public int hashCode()
        Returns the hashcode of this json integer.
        Overrides:
        hashCode in class Object
        Returns:
        hashcode of this JsInt
      • of

        public static JsInt of​(int n)
        Static factory method to create a JsInt from an integer primitive type.
        Parameters:
        n - the integer primitive type
        Returns:
        a new JsInt
      • map

        public JsInt map​(IntUnaryOperator fn)
        Maps this json integer into another one.
        Parameters:
        fn - the mapping function
        Returns:
        a new JsInt
      • plus

        public JsInt plus​(JsInt that)
        adds up this integer to the specified one
        Parameters:
        that - the specified integer
        Returns:
        the sum of both integers
      • minus

        public JsInt minus​(JsInt that)
        subtract this integer from the specified one
        Parameters:
        that - the specified integer
        Returns:
        this integer minus the specified one
      • times

        public JsInt times​(JsInt that)
        multiplies this integer by the specified one
        Parameters:
        that - the specified integer
        Returns:
        this integer times the specified one
      • test

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

        public boolean equals​(JsBigInt jsBigInt)
        returns true if this integer 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​(JsBigDec jsBigDec)
        returns true if this integer 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​(JsLong jsLong)
        returns true if this integer 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​(JsDouble jsDouble)
        returns true if this integer and the specified double represent the same number
        Parameters:
        jsDouble - the specified JsDouble
        Returns:
        true if both JsElem are the same value
      • 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
      • isBigInt

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