in dnq-transient-store/src/main/kotlin/com/jetbrains/teamsys/dnq/association/PrimitiveAssociationSemantics.kt [230:269]
fun nextGreater(value: Comparable<*>, clazz: Class<*>): Comparable<*>? {
return when (clazz) {
Byte::class.javaPrimitiveType,
Byte::class.javaObjectType ->
value as Byte + 1
Short::class.javaPrimitiveType,
Short::class.javaObjectType ->
value as Short + 1
Int::class.javaPrimitiveType,
Int::class.javaObjectType ->
value as Int + 1
Long::class.javaPrimitiveType,
Long::class.javaObjectType ->
value as Long + 1
Float::class.javaPrimitiveType,
Float::class.javaObjectType -> {
var result: Float
var addend = FLOAT_PRECISION
do {
result = value as Float + addend
addend *= 2f
} while (value == result)
result
}
Double::class.javaPrimitiveType,
Double::class.javaObjectType -> {
var result: Double
var addend = DOUBLE_PRECISION
do {
result = value as Double + addend
addend *= 2.0
} while (value == result)
result
}
Boolean::class.javaPrimitiveType,
Boolean::class.javaObjectType ->
java.lang.Boolean.TRUE
else -> null
}
}