Class ExpressionArithmetic
java.lang.Object
dev.frostlake.executor.expressions.ExpressionArithmetic
Pure arithmetic, temporal and comparison helpers extracted from
ExpressionEvaluatorVisitor:
numeric/date add/subtract/multiply/divide/negate, three-valued truthiness, value equality/ordering and
INTERVAL application. Field-free — all inputs arrive as arguments.-
Method Summary
Modifier and TypeMethodDescriptionstatic BigDecimalcheckedRemainder(BigDecimal dividend, BigDecimal divisor) The exact remainder with the operands' rescale check — the step%andMODshare: an operand that cannot be represented at the common scale is refused before any arithmetic, with the aligned type and its own digits (live-verified for the function as for the operator).static booleanSQL value equality, as the=operator answers it: numbers compare by VALUE whatever their runtime class, a boolean reads against a number, a temporal against its own text, a DATE against a TIMESTAMP by instant, and a VARIANT against either.
-
Method Details
-
equals
SQL value equality, as the=operator answers it: numbers compare by VALUE whatever their runtime class, a boolean reads against a number, a temporal against its own text, a DATE against a TIMESTAMP by instant, and a VARIANT against either. A string that must read as a number and cannot is an error, not an inequality:'ab' = 1raises "Numeric value 'ab' is not recognized".Exposed so the functions that are defined AS a comparison — DECODE today — answer with the operator instead of a hand-rolled test of their own. It is the only member of this class visible outside the package; the rest stay package-private.
-
checkedRemainder
The exact remainder with the operands' rescale check — the step%andMODshare: an operand that cannot be represented at the common scale is refused before any arithmetic, with the aligned type and its own digits (live-verified for the function as for the operator).- Parameters:
dividend- the dividenddivisor- the divisor- Returns:
- the dividend-signed remainder
-