Package jsonvalues
Class JsDouble
- java.lang.Object
-
- jsonvalues.JsPrimitive
-
- jsonvalues.JsNumber
-
- jsonvalues.JsDouble
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(JsDouble o)
Compares twoJsDouble
objects numerically.boolean
equals(java.lang.Object that)
Indicates whether some other object is "equal to" this json double.int
hashCode()
Returns the hashcode of this json double.int
id()
boolean
isDouble()
JsDouble
map(java.util.function.DoubleUnaryOperator fn)
Maps this json double into another one.static JsDouble
of(double n)
Static factory method to create a JsDouble from a double primitive type.boolean
test(java.util.function.DoublePredicate predicate)
Tests the value of this json double on a predicate.java.lang.String
toString()
-
Methods inherited from class jsonvalues.JsNumber
isNumber, toJsPrimitive
-
Methods inherited from class jsonvalues.JsPrimitive
isJson, isPrimitive
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jsonvalues.JsValue
ifNothing, ifNull, isArray, isArray, isBigDec, isBigDec, isBigInt, isBigInt, isBinary, isBool, isDecimal, isDouble, isFalse, isInstant, isInstant, isInt, isInt, isIntegral, isJson, isLong, isLong, isNothing, isNotNothing, isNotNull, isNotNumber, isNull, isObj, isObj, isSameType, isStr, isStr, isTrue, toJsArray, toJsBigDec, toJsBigInt, toJsBinary, toJsBool, toJsDouble, toJsInstant, toJsInt, toJsLong, toJsNumber, toJsObj, toJson, toJsStr
-
-
-
-
Field Detail
-
TYPE_ID
public static final int TYPE_ID
- See Also:
- Constant Field Values
-
prism
public static final Prism<JsValue,java.lang.Double> prism
prism between the sum type JsValue and JsDouble
-
value
public final double value
The double value.
-
-
Method Detail
-
isDouble
public boolean isDouble()
-
compareTo
public int compareTo(JsDouble o)
Compares twoJsDouble
objects numerically.- Specified by:
compareTo
in interfacejava.lang.Comparable<JsDouble>
- See Also:
Double.compareTo(Double)
-
hashCode
public int hashCode()
Returns the hashcode of this json double.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- the hashcode of this JsDouble
-
equals
public boolean equals(java.lang.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 classjava.lang.Object
- Parameters:
that
- the reference object with which to compare.- Returns:
- true if that is a JsNumber with the same value as this JsDouble
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- Returns:
- a string representation of this object.
- See Also:
Double.toString
-
map
public JsDouble map(java.util.function.DoubleUnaryOperator fn)
Maps this json double into another one.- Parameters:
fn
- the mapping function- Returns:
- a new JsDouble
-
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
-
test
public boolean test(java.util.function.DoublePredicate predicate)
Tests the value of this json double on a predicate.- Parameters:
predicate
- the predicate- Returns:
- true if this double satisfies the predicate
-
-