public final class Function extends Object
Constructor and Description |
---|
Function() |
Modifier and Type | Method and Description |
---|---|
static Expression |
abs(Expression operand)
Creates an ABS(expr) function that returns the absolute value of the given numeric
expression.
|
static Expression |
acos(Expression operand)
Creates an ACOS(expr) function that returns the inverse cosine of the given numeric
expression.
|
static Expression |
asin(Expression operand)
Creates an ASIN(expr) function that returns the inverse sin of the given numeric
expression.
|
static Expression |
atan(Expression operand)
Creates an ATAN(expr) function that returns the inverse tangent of the numeric
expression.
|
static Expression |
atan2(Expression y,
Expression x)
Returns the angle theta from the conversion of rectangular coordinates (x, y)
to polar coordinates (r, theta).
|
static Expression |
avg(Expression operand)
Creates an AVG(expr) function expression that returns the average of all the number values
in the group of the values expressed by the given expression.
|
static Expression |
ceil(Expression operand)
Creates a CEIL(expr) function that returns the ceiling value of the given numeric
expression.
|
static Expression |
contains(Expression operand,
Expression substring)
Creates a CONTAINS(expr, substr) function that evaluates whether the given string
expression conatins the given substring expression or not.
|
static Expression |
cos(Expression operand)
Creates a COS(expr) function that returns the cosine of the given numeric expression.
|
static Expression |
cosineDistance(Expression expression1,
Expression expression2)
ENTERPRISE EDITION API
|
static Expression |
count(Expression operand)
Creates a COUNT(expr) function expression that returns the count of all values
in the group of the values expressed by the given expression.
|
static Expression |
degrees(Expression operand)
Creates a DEGREES(expr) function that returns the degrees value of the given radiants
value expression.
|
static Expression |
e()
Creates a E() function that return the value of the mathematical constant 'e'.
|
static Expression |
euclideanDistance(Expression expression1,
Expression expression2)
ENTERPRISE EDITION API
|
static Expression |
exp(Expression operand)
Creates a EXP(expr) function that returns the value of 'e' power by the given numeric
expression.
|
static Expression |
floor(Expression operand)
Creates a FLOOR(expr) function that returns the floor value of the given
numeric expression.
|
static Expression |
length(Expression operand)
Creates a LENGTH(expr) function that returns the length of the given string expression.
|
static Expression |
ln(Expression operand)
Creates a LN(expr) function that returns the natural log of the given numeric expression.
|
static Expression |
log(Expression operand)
Creates a LOG(expr) function that returns the base 10 log of the given numeric expression.
|
static Expression |
lower(Expression operand)
Creates a LOWER(expr) function that returns the lowercase string of the given string
expression.
|
static Expression |
ltrim(Expression operand)
Creates a LTRIM(expr) function that removes the whitespace from the beginning of the
given string expression.
|
static Expression |
max(Expression operand)
Creates a MAX(expr) function expression that returns the maximum value
in the group of the values expressed by the given expression.
|
static Expression |
millisToString(Expression operand)
Creates a MILLIS_TO_STR(expr) function that will convert a numeric input representing
milliseconds since the Unix epoch into a full ISO8601 date and time
string in the device local time zone.
|
static Expression |
millisToUTC(Expression operand)
Creates a MILLIS_TO_UTC(expr) function that will convert a numeric input representing
milliseconds since the Unix epoch into a full ISO8601 date and time
string in UTC time.
|
static Expression |
min(Expression operand)
Creates a MIN(expr) function expression that returns the minimum value
in the group of the values expressed by the given expression.
|
static Expression |
pi()
Creates a PI() function that returns the mathematical constant Pi.
|
static Expression |
power(Expression base,
Expression exp)
Creates a POWER(base, exponent) function that returns the value of the given base
expression power the given exponent expression.
|
static PredictionFunction |
prediction(String model,
Expression input)
ENTERPRISE EDITION API
|
static Expression |
radians(Expression operand)
Creates a RADIANS(expr) function that returns the radians value of the given degrees
value expression.
|
static Expression |
round(Expression operand)
Creates a ROUND(expr) function that returns the rounded value of the given numeric
expression.
|
static Expression |
round(Expression operand,
Expression digits)
Creates a ROUND(expr, digits) function that returns the rounded value to the given
number of digits of the given numeric expression.
|
static Expression |
rtrim(Expression operand)
Creates a RTRIM(expr) function that removes the whitespace from the end of the
given string expression.
|
static Expression |
sign(Expression operand)
Creates a SIGN(expr) function that returns the sign (1: positive, -1: negative, 0: zero)
of the given numeric expression.
|
static Expression |
sin(Expression operand)
Creates a SIN(expr) function that returns the sin of the given numeric expression.
|
static Expression |
sqrt(Expression operand)
Creates a SQRT(expr) function that returns the square root of the given numeric expression.
|
static Expression |
squaredEuclideanDistance(Expression expression1,
Expression expression2)
ENTERPRISE EDITION API
|
static Expression |
stringToMillis(Expression operand)
Creates a STR_TO_MILLIS(expr) that will convert an ISO8601 datetime string
into the number of milliseconds since the unix epoch.
|
static Expression |
stringToUTC(Expression operand)
Creates a STR_TO_UTC(expr) that will convert an ISO8601 datetime string
into a full ISO8601 UTC datetime string.
|
static Expression |
sum(Expression operand)
Creates a SUM(expr) function expression that return the sum of all number values
in the group of the values expressed by the given expression.
|
static Expression |
tan(Expression operand)
Creates a TAN(expr) function that returns the tangent of the given numeric expression.
|
static Expression |
trim(Expression operand)
Creates a TRIM(expr) function that removes the whitespace from the beginning and
the end of the given string expression.
|
static Expression |
trunc(Expression operand)
Creates a TRUNC(expr) function that truncates all of the digits after the decimal place
of the given numeric expression.
|
static Expression |
trunc(Expression operand,
Expression digits)
Creates a TRUNC(expr, digits) function that truncates the number of the digits after
the decimal place of the given numeric expression.
|
static Expression |
upper(Expression operand)
Creates a UPPER(expr) function that returns the uppercase string of the given string expression.
|
@NonNull public static PredictionFunction prediction(@NonNull String model, @NonNull Expression input)
Creates prediction function with the given model name and input. When running a query with the prediction function, the corresponding predictive model registered to CouchbaseLite Database class will be called with the given input to predict the result.
The prediction result returned by the predictive model will be in a form dictionary object. To create an expression that refers to a property in the prediction result, the propertyPath(path) method of the created PredictionFunction object can be used.
model
- The predictive model name registered to the CouchbaseLite Database.input
- The expression evaluated to a dictionary.@NonNull public static Expression euclideanDistance(@NonNull Expression expression1, @NonNull Expression expression2)
Creates a function that returns the euclidean distance between the two input vectors. The result is a non-negative floating-point number. The expression1 and expression2 must be arrays of numbers, and must be the same length.
expression1
- The expression evaluated to an arrays of numbers.expression2
- The expression evaluated to an arrays of numbers.@NonNull public static Expression squaredEuclideanDistance(@NonNull Expression expression1, @NonNull Expression expression2)
Creates a function that returns the squared euclidean distance between the two input vectors. The result is a non-negative floating-point number. The expression1 and expression2 must be arrays of numbers, and must be the same length.
expression1
- The expression evaluated to an arrays of numbers.expression2
- The expression evaluated to an arrays of numbers.@NonNull public static Expression cosineDistance(@NonNull Expression expression1, @NonNull Expression expression2)
Creates a function that returns the cosine distance which one minus the cosine similarity between the two input vectors. The result is a floating-point number ranges from −1.0 to 1.0. The expression1 and expression2 must be arrays of numbers, and must be the same length.
expression1
- The expression evaluated to an arrays of numbers.expression2
- The expression evaluated to an arrays of numbers.@NonNull public static Expression avg(@NonNull Expression operand)
The expression.
@NonNull public static Expression count(@Nullable Expression operand)
operand
- The expression.@NonNull public static Expression min(@NonNull Expression operand)
operand
- The expression.@NonNull public static Expression max(@NonNull Expression operand)
operand
- The expression.@NonNull public static Expression sum(@NonNull Expression operand)
operand
- The expression.@NonNull public static Expression abs(@NonNull Expression operand)
operand
- The expression.@NonNull public static Expression acos(@NonNull Expression operand)
operand
- The expression.@NonNull public static Expression asin(@NonNull Expression operand)
operand
- The expression.@NonNull public static Expression atan(@NonNull Expression operand)
operand
- The expression.@NonNull public static Expression atan2(@NonNull Expression y, @NonNull Expression x)
x
- the abscissa coordinatey
- the ordinate coordinate@NonNull public static Expression ceil(@NonNull Expression operand)
operand
- The expression.@NonNull public static Expression cos(@NonNull Expression operand)
operand
- The expression.@NonNull public static Expression degrees(@NonNull Expression operand)
operand
- The expression.@NonNull public static Expression e()
@NonNull public static Expression exp(@NonNull Expression operand)
operand
- The expression.@NonNull public static Expression floor(@NonNull Expression operand)
operand
- The expression.@NonNull public static Expression ln(@NonNull Expression operand)
operand
- The expression.@NonNull public static Expression log(@NonNull Expression operand)
operand
- The expression.@NonNull public static Expression pi()
@NonNull public static Expression power(@NonNull Expression base, @NonNull Expression exp)
base
- The base expression.exp
- The exponent expression.@NonNull public static Expression radians(@NonNull Expression operand)
operand
- The expression.@NonNull public static Expression round(@NonNull Expression operand)
operand
- The expression.@NonNull public static Expression round(@NonNull Expression operand, @NonNull Expression digits)
operand
- The numeric expression.digits
- The number of digits.@NonNull public static Expression sign(@NonNull Expression operand)
operand
- The expression.@NonNull public static Expression sin(@NonNull Expression operand)
operand
- The numeric expression.@NonNull public static Expression sqrt(@NonNull Expression operand)
operand
- The numeric expression.@NonNull public static Expression tan(@NonNull Expression operand)
operand
- The numeric expression.@NonNull public static Expression trunc(@NonNull Expression operand)
operand
- The numeric expression.@NonNull public static Expression trunc(@NonNull Expression operand, @NonNull Expression digits)
operand
- The numeric expression.digits
- The number of digits to truncate.@NonNull public static Expression contains(@NonNull Expression operand, @NonNull Expression substring)
operand
- The string expression.substring
- The substring expression.@NonNull public static Expression length(@NonNull Expression operand)
operand
- The string expression.@NonNull public static Expression lower(@NonNull Expression operand)
operand
- The string expression.@NonNull public static Expression ltrim(@NonNull Expression operand)
operand
- The string expression.@NonNull public static Expression rtrim(@NonNull Expression operand)
operand
- The string expression.@NonNull public static Expression trim(@NonNull Expression operand)
operand
- The string expression.@NonNull public static Expression upper(@NonNull Expression operand)
operand
- The string expression.@NonNull public static Expression millisToString(@NonNull Expression operand)
operand
- The string expression.@NonNull public static Expression millisToUTC(@NonNull Expression operand)
operand
- The string expression.@NonNull public static Expression stringToMillis(@NonNull Expression operand)
Times can be of the form HH:MM, HH:MM:SS, or HH:MM:SS.FFF. Leading zero is not optional (i.e. 02 is ok, 2 is not). Hours are in 24-hour format. FFF represents milliseconds, and *trailing* zeros are optional (i.e. 5 == 500).
Time zones can be in one of three forms: (+/-)HH:MM (+/-)HHMM Z (which represents UTC)
operand
- The string expression.@NonNull public static Expression stringToUTC(@NonNull Expression operand)
Times can be of the form HH:MM, HH:MM:SS, or HH:MM:SS.FFF. Leading zero is not optional (i.e. 02 is ok, 2 is not). Hours are in 24-hour format. FFF represents milliseconds, and *trailing* zeros are optional (i.e. 5 == 500).
Time zones can be in one of three forms: (+/-)HH:MM (+/-)HHMM Z (which represents UTC)
operand
- The string expression.