FINERACT-1981: EMI calculator rework

This commit is contained in:
Janos Meszaros
2024-10-16 14:35:58 +02:00
committed by Adam Saghy
parent d4190ede90
commit bb072709b5
17 changed files with 1082 additions and 1146 deletions
@@ -481,4 +481,14 @@ public final class MathUtil {
public static BigDecimal stripTrailingZeros(final BigDecimal value) {
return value == null ? null : new BigDecimal(value.stripTrailingZeros().toPlainString());
}
/**
* @return calculates maximum of the two values considering null values
* @param notNull
* if true then null parameter is omitted, otherwise returns null
*/
public static Money max(Money first, Money second, boolean notNull) {
return notNull ? first == null ? second : second == null ? first : max(first, second, false)
: isGreaterThan(first, second) ? first : second;
}
}