Class ConstantArgumentTexts
java.lang.Object
dev.frostlake.functions.aggregate.ConstantArgumentTexts
Reads the constant integer an aggregate call wrote as one of its arguments — the k and the counter
limit of the APPROX_TOP_K family — from the argument's text. The compile-time rules have already
refused what is not an integral constant, so what remains is the spelling: a bare integer, a
parenthesised or plus-signed one, an integral decimal or exponent form (
2.0, 1e1),
or a quoted number ('2'); anything else falls back to the caller's default.-
Method Summary
Modifier and TypeMethodDescriptionstatic intThe integral value of an argument text, or the fallback.static BigDecimalintegralConstant(String text) The integral value a constant text spells, or null when it spells none — a fraction, a non-numeric string, a column or an expression.static booleanisStringLiteral(String text) Whether a constant text is a string literal, which live converts through TO_NUMBER.static BigDecimalnumericConstant(String text) The numeric value a constant text spells, quoted or not, or null when it is not a numeric or string literal that reads as a number.static StringThe text without its enclosing parentheses and a leading plus sign —(2)and+2are the constant 2 (live-verified).
-
Method Details
-
integer
The integral value of an argument text, or the fallback.- Parameters:
argumentTexts- the call's argument texts, or nullindex- which argumentfallback- the value when the argument is absent or not an integral constant- Returns:
- the integer
-
integralConstant
The integral value a constant text spells, or null when it spells none — a fraction, a non-numeric string, a column or an expression.- Parameters:
text- the argument text- Returns:
- the value, or null
-
numericConstant
The numeric value a constant text spells, quoted or not, or null when it is not a numeric or string literal that reads as a number.- Parameters:
text- the argument text- Returns:
- the value, or null
-
isStringLiteral
Whether a constant text is a string literal, which live converts through TO_NUMBER.- Parameters:
text- the argument text- Returns:
- true for a single-quoted literal
-
unwrap
The text without its enclosing parentheses and a leading plus sign —(2)and+2are the constant 2 (live-verified).- Parameters:
text- the argument text, or null- Returns:
- the bare text, trimmed, or null
-