| Package | Description |
|---|---|
| io.rapidpro.expressions | |
| io.rapidpro.expressions.evaluator | |
| io.rapidpro.expressions.functions |
| Modifier and Type | Method and Description |
|---|---|
EvaluationContext |
EvaluationContext.Deserializer.deserialize(com.google.gson.JsonElement node,
Type type,
com.google.gson.JsonDeserializationContext context) |
static EvaluationContext |
EvaluationContext.fromJson(String json) |
| Modifier and Type | Method and Description |
|---|---|
Object |
Evaluator.evaluateExpression(String expression,
EvaluationContext context)
Evaluates a single expression, e.g.
|
Object |
Evaluator.evaluateExpression(String expression,
EvaluationContext context,
Evaluator.EvaluationStrategy strategy)
Evaluates a single expression, e.g.
|
EvaluatedTemplate |
Evaluator.evaluateTemplate(String template,
EvaluationContext context)
Evaluates a template string, e.g.
|
EvaluatedTemplate |
Evaluator.evaluateTemplate(String template,
EvaluationContext context,
boolean urlEncode)
Evaluates a template string, e.g.
|
EvaluatedTemplate |
Evaluator.evaluateTemplate(String template,
EvaluationContext context,
boolean urlEncode,
Evaluator.EvaluationStrategy strategy)
Evaluates a template string, e.g.
|
protected String |
Evaluator.resolveAvailable(org.antlr.v4.runtime.CommonTokenStream tokens,
EvaluationContext context)
Checks the token stream for context references and if there are missing references - substitutes available
references and returns a partially evaluated expression.
|
protected String |
Evaluator.resolveExpressionBlock(String expression,
EvaluationContext context,
boolean urlEncode,
Evaluator.EvaluationStrategy strategy,
List<String> errors)
Resolves an expression block found in the template, e.g. @(...).
|
static boolean |
Conversions.toBoolean(Object value,
EvaluationContext ctx)
Tries conversion of any value to a boolean (called a 'Logical Value' in Excel lingo)
|
static org.threeten.bp.LocalDate |
Conversions.toDate(Object value,
EvaluationContext ctx)
Tries conversion of any value to a date
|
static org.threeten.bp.temporal.Temporal |
Conversions.toDateOrDateTime(Object value,
EvaluationContext ctx)
Tries conversion of any value to a date or a datetime
|
static org.threeten.bp.ZonedDateTime |
Conversions.toDateTime(Object value,
EvaluationContext ctx)
Tries conversion of any value to a date
|
static BigDecimal |
Conversions.toDecimal(Object value,
EvaluationContext ctx)
Tries conversion of any value to a decimal
|
static int |
Conversions.toInteger(Object value,
EvaluationContext ctx)
Tries conversion of any value to an integer
|
static String |
Conversions.toRepr(Object value,
EvaluationContext ctx)
Converts a value back to its representation form, e.g. x -> "x"
|
static org.apache.commons.lang3.tuple.Pair<Object,Object> |
Conversions.toSame(Object value1,
Object value2,
EvaluationContext ctx)
Converts a pair of arguments to their most-likely types.
|
static String |
Conversions.toString(Object value,
EvaluationContext ctx)
Tries conversion of any value to a string
|
static org.threeten.bp.OffsetTime |
Conversions.toTime(Object value,
EvaluationContext ctx)
Tries conversion of any value to a time
|
| Constructor and Description |
|---|
ExpressionVisitorImpl(FunctionManager functions,
EvaluationContext context) |
| Modifier and Type | Method and Description |
|---|---|
static String |
ExcelFunctions._char(EvaluationContext ctx,
Object number)
Returns the character specified by a number
|
static Object |
ExcelFunctions._if(EvaluationContext ctx,
Object logicalTest,
Object valueIfTrue,
Object valueIfFalse)
Returns one value if the condition evaluates to TRUE, and another value if it evaluates to FALSE
|
static int |
ExcelFunctions._int(EvaluationContext ctx,
Object number)
Rounds a number down to the nearest integer
|
static BigDecimal |
ExcelFunctions.abs(EvaluationContext ctx,
Object number)
Returns the absolute value of a number
|
static boolean |
ExcelFunctions.and(EvaluationContext ctx,
Object... args)
Returns TRUE if and only if all its arguments evaluate to TRUE
|
static BigDecimal |
ExcelFunctions.average(EvaluationContext ctx,
Object... args)
Returns the average (arithmetic mean) of the arguments
|
static String |
ExcelFunctions.clean(EvaluationContext ctx,
Object text)
Removes all non-printable characters from a text string
|
static int |
ExcelFunctions.code(EvaluationContext ctx,
Object text)
Returns a numeric code for the first character in a text string
|
static String |
ExcelFunctions.concatenate(EvaluationContext ctx,
Object... args)
Joins text strings into one text string
|
static org.threeten.bp.LocalDate |
ExcelFunctions.date(EvaluationContext ctx,
Object year,
Object month,
Object day)
Defines a date value
|
static int |
ExcelFunctions.datedif(EvaluationContext ctx,
Object startDate,
Object endDate,
Object unit)
Calculates the number of days, months, or years between two dates.
|
static org.threeten.bp.LocalDate |
ExcelFunctions.datevalue(EvaluationContext ctx,
Object text)
Converts date stored in text to an actual date
|
static int |
ExcelFunctions.day(EvaluationContext ctx,
Object date)
Returns only the day of the month of a date (1 to 31)
|
static int |
ExcelFunctions.days(EvaluationContext ctx,
Object endDate,
Object startDate)
Returns the number of days between two dates.
|
static org.threeten.bp.temporal.Temporal |
ExcelFunctions.edate(EvaluationContext ctx,
Object date,
Object months)
Moves a date by the given number of months
|
static BigDecimal |
ExcelFunctions.exp(EvaluationContext ctx,
Object number)
Returns e raised to the power of number
|
static String |
CustomFunctions.field(EvaluationContext ctx,
Object text,
Object index,
Object delimiter)
Reference a field in string separated by a delimiter
|
static String |
CustomFunctions.first_word(EvaluationContext ctx,
Object text)
Returns the first word in the given text string
|
static String |
ExcelFunctions.fixed(EvaluationContext ctx,
Object number,
Object decimals,
Object noCommas)
Formats the given number in decimal format using a period and commas
|
static String |
CustomFunctions.format_date(EvaluationContext ctx,
Object text)
Formats a date according to the default org format
|
static String |
CustomFunctions.format_location(EvaluationContext ctx,
Object text)
Takes a single parameter (administrative boundary as a string) and returns the name of the leaf boundary
|
static int |
ExcelFunctions.hour(EvaluationContext ctx,
Object datetime)
Returns only the hour of a datetime (0 to 23)
|
Object |
FunctionManager.invokeFunction(EvaluationContext ctx,
String name,
List<Object> args)
Invokes a function
|
static String |
ExcelFunctions.left(EvaluationContext ctx,
Object text,
Object numChars)
Returns the first characters in a text string
|
static int |
ExcelFunctions.len(EvaluationContext ctx,
Object text)
Returns the number of characters in a text string
|
static String |
ExcelFunctions.lower(EvaluationContext ctx,
Object text)
Converts a text string to lowercase
|
static BigDecimal |
ExcelFunctions.max(EvaluationContext ctx,
Object... args)
Returns the maximum of all arguments
|
static BigDecimal |
ExcelFunctions.min(EvaluationContext ctx,
Object... args)
Returns the minimum of all arguments
|
static int |
ExcelFunctions.minute(EvaluationContext ctx,
Object datetime)
Returns only the minute of a datetime (0 to 59)
|
static BigDecimal |
ExcelFunctions.mod(EvaluationContext ctx,
Object number,
Object divisor)
Returns the remainder after number is divided by divisor
|
static int |
ExcelFunctions.month(EvaluationContext ctx,
Object date)
Returns only the month of a date (1 to 12)
|
static org.threeten.bp.ZonedDateTime |
ExcelFunctions.now(EvaluationContext ctx)
Returns the current date and time
|
static boolean |
ExcelFunctions.or(EvaluationContext ctx,
Object... args)
Returns TRUE if any argument is TRUE
|
static String |
CustomFunctions.percent(EvaluationContext ctx,
Object number)
Formats a number as a percentage
|
static BigDecimal |
ExcelFunctions.power(EvaluationContext ctx,
Object number,
Object power)
Returns the result of a number raised to a power
|
static String |
ExcelFunctions.proper(EvaluationContext ctx,
Object text)
Capitalizes the first letter of every word in a text string
|
static int |
ExcelFunctions.randbetween(EvaluationContext ctx,
Object bottom,
Object top)
Returns a random integer number between the numbers you specify
|
static String |
CustomFunctions.read_digits(EvaluationContext ctx,
Object text)
Formats digits in text for reading in TTS
|
static String |
CustomFunctions.regex_group(EvaluationContext ctx,
Object text,
Object pattern,
Object groupNum)
Tries to match the text with the given pattern and returns the value of matching group
|
static String |
CustomFunctions.remove_first_word(EvaluationContext ctx,
Object text)
Removes the first word from the given text string
|
static String |
ExcelFunctions.rept(EvaluationContext ctx,
Object text,
Object numberTimes)
Repeats text a given number of times
|
static String |
ExcelFunctions.right(EvaluationContext ctx,
Object text,
Object numChars)
Returns the last characters in a text string
|
static BigDecimal |
ExcelFunctions.round(EvaluationContext ctx,
Object number,
Object numDigits)
Rounds a number to a specified number of digits
|
static BigDecimal |
ExcelFunctions.rounddown(EvaluationContext ctx,
Object number,
Object numDigits)
Rounds a number down, toward zero
|
static BigDecimal |
ExcelFunctions.roundup(EvaluationContext ctx,
Object number,
Object numDigits)
Rounds a number up, away from zero
|
static int |
ExcelFunctions.second(EvaluationContext ctx,
Object datetime)
Returns only the second of a datetime (0 to 59)
|
static String |
ExcelFunctions.substitute(EvaluationContext ctx,
Object text,
Object oldText,
Object newText,
Object instanceNum)
Substitutes new_text for old_text in a text string
|
static BigDecimal |
ExcelFunctions.sum(EvaluationContext ctx,
Object... args)
Returns the sum of all arguments
|
static org.threeten.bp.OffsetTime |
ExcelFunctions.time(EvaluationContext ctx,
Object hours,
Object minutes,
Object seconds)
Defines a time value
|
static org.threeten.bp.OffsetTime |
ExcelFunctions.timevalue(EvaluationContext ctx,
Object text)
Converts time stored in text to an actual time
|
static org.threeten.bp.LocalDate |
ExcelFunctions.today(EvaluationContext ctx)
Returns the current date
|
static int |
ExcelFunctions.trunc(EvaluationContext ctx,
Object number)
Truncates a number to an integer by removing the fractional part of the number
|
static String |
ExcelFunctions.unichar(EvaluationContext ctx,
Object number)
Returns the unicode character specified by a number
|
static int |
ExcelFunctions.unicode(EvaluationContext ctx,
Object text)
Returns a numeric code for the first character in a text string
|
static String |
ExcelFunctions.upper(EvaluationContext ctx,
Object text)
Converts a text string to uppercase
|
static int |
ExcelFunctions.weekday(EvaluationContext ctx,
Object date)
Returns the day of the week of a date (1 for Sunday to 7 for Saturday)
|
static int |
CustomFunctions.word_count(EvaluationContext ctx,
Object text,
Object bySpaces)
Returns the number of words in the given text string
|
static String |
CustomFunctions.word_slice(EvaluationContext ctx,
Object text,
Object start,
Object stop,
Object bySpaces)
Extracts a substring spanning from start up to but not-including stop
|
static String |
CustomFunctions.word(EvaluationContext ctx,
Object text,
Object number,
Object bySpaces)
Extracts the nth word from the given text string
|
static int |
ExcelFunctions.year(EvaluationContext ctx,
Object date)
Returns only the year of a date
|
Copyright © 2018. All rights reserved.