Expressions¶
- public class Expression¶
A server side expression.
- static Expression constantDouble(Connection connection, double value)¶
A constant value of double precision floating point type.
- Parameters:
value (
double
) –
- static Expression constantFloat(Connection connection, float value)¶
A constant value of single precision floating point type.
- Parameters:
value (
float
) –
- static Expression constantInt(Connection connection, int value)¶
A constant value of integer type.
- Parameters:
value (
int
) –
- static Expression constantBool(Connection connection, boolean value)¶
A constant value of boolean type.
- Parameters:
value (
boolean
) –
- static Expression constantString(Connection connection, String value)¶
A constant value of string type.
- Parameters:
value (
String
) –
- static Expression call(Connection connection, krpc.schema.KRPC.ProcedureCall call)¶
An RPC call.
- Parameters:
call (
krpc.schema.KRPC.ProcedureCall
) –
- static Expression equal(Connection connection, Expression arg0, Expression arg1)¶
Equality comparison.
- Parameters:
arg0 (
Expression
) –arg1 (
Expression
) –
- static Expression notEqual(Connection connection, Expression arg0, Expression arg1)¶
Inequality comparison.
- Parameters:
arg0 (
Expression
) –arg1 (
Expression
) –
- static Expression greaterThan(Connection connection, Expression arg0, Expression arg1)¶
Greater than numerical comparison.
- Parameters:
arg0 (
Expression
) –arg1 (
Expression
) –
- static Expression greaterThanOrEqual(Connection connection, Expression arg0, Expression arg1)¶
Greater than or equal numerical comparison.
- Parameters:
arg0 (
Expression
) –arg1 (
Expression
) –
- static Expression lessThan(Connection connection, Expression arg0, Expression arg1)¶
Less than numerical comparison.
- Parameters:
arg0 (
Expression
) –arg1 (
Expression
) –
- static Expression lessThanOrEqual(Connection connection, Expression arg0, Expression arg1)¶
Less than or equal numerical comparison.
- Parameters:
arg0 (
Expression
) –arg1 (
Expression
) –
- static Expression and(Connection connection, Expression arg0, Expression arg1)¶
Boolean and operator.
- Parameters:
arg0 (
Expression
) –arg1 (
Expression
) –
- static Expression or(Connection connection, Expression arg0, Expression arg1)¶
Boolean or operator.
- Parameters:
arg0 (
Expression
) –arg1 (
Expression
) –
- static Expression exclusiveOr(Connection connection, Expression arg0, Expression arg1)¶
Boolean exclusive-or operator.
- Parameters:
arg0 (
Expression
) –arg1 (
Expression
) –
- static Expression not(Connection connection, Expression arg)¶
Boolean negation operator.
- Parameters:
arg (
Expression
) –
- static Expression add(Connection connection, Expression arg0, Expression arg1)¶
Numerical addition.
- Parameters:
arg0 (
Expression
) –arg1 (
Expression
) –
- static Expression subtract(Connection connection, Expression arg0, Expression arg1)¶
Numerical subtraction.
- Parameters:
arg0 (
Expression
) –arg1 (
Expression
) –
- static Expression multiply(Connection connection, Expression arg0, Expression arg1)¶
Numerical multiplication.
- Parameters:
arg0 (
Expression
) –arg1 (
Expression
) –
- static Expression divide(Connection connection, Expression arg0, Expression arg1)¶
Numerical division.
- Parameters:
arg0 (
Expression
) –arg1 (
Expression
) –
- static Expression modulo(Connection connection, Expression arg0, Expression arg1)¶
Numerical modulo operator.
- Parameters:
arg0 (
Expression
) –arg1 (
Expression
) –
- Returns:
The remainder of arg0 divided by arg1
- static Expression power(Connection connection, Expression arg0, Expression arg1)¶
Numerical power operator.
- Parameters:
arg0 (
Expression
) –arg1 (
Expression
) –
- Returns:
arg0 raised to the power of arg1, with type of arg0
- static Expression leftShift(Connection connection, Expression arg0, Expression arg1)¶
Bitwise left shift.
- Parameters:
arg0 (
Expression
) –arg1 (
Expression
) –
- static Expression rightShift(Connection connection, Expression arg0, Expression arg1)¶
Bitwise right shift.
- Parameters:
arg0 (
Expression
) –arg1 (
Expression
) –
- static Expression cast(Connection connection, Expression arg, Type type)¶
Perform a cast to the given type.
- Parameters:
arg (
Expression
) –type (
Type
) – Type to cast the argument to.
- static Expression parameter(Connection connection, String name, Type type)¶
A named parameter of type double.
- static Expression function(Connection connection, java.util.List<Expression> parameters, Expression body)¶
A function.
- Parameters:
parameters (
java.util.List
) – The parameters of the function.body (
Expression
) – The body of the function.
- Returns:
A function.
- static Expression invoke(Connection connection, Expression function, java.util.Map<String, Expression> args)¶
A function call.
- Parameters:
function (
Expression
) – The function to call.args (
java.util.Map
) – The arguments to call the function with.
- Returns:
A function call.
- static Expression createTuple(Connection connection, java.util.List<Expression> elements)¶
Construct a tuple.
- Parameters:
elements (
java.util.List
) – The elements.
- Returns:
The tuple.
- static Expression createList(Connection connection, java.util.List<Expression> values)¶
Construct a list.
- Parameters:
values (
java.util.List
) – The value. Should all be of the same type.
- Returns:
The list.
- static Expression createSet(Connection connection, java.util.Set<Expression> values)¶
Construct a set.
- Parameters:
values (
java.util.Set
) – The values. Should all be of the same type.
- Returns:
The set.
- static Expression createDictionary(Connection connection, java.util.List<Expression> keys, java.util.List<Expression> values)¶
Construct a dictionary, from a list of corresponding keys and values.
- Parameters:
keys (
java.util.List
) – The keys. Should all be of the same type.values (
java.util.List
) – The values. Should all be of the same type.
- Returns:
The dictionary.
- static Expression toList(Connection connection, Expression arg)¶
Convert a collection to a list.
- Parameters:
arg (
Expression
) – The collection.
- Returns:
The collection as a list.
- static Expression toSet(Connection connection, Expression arg)¶
Convert a collection to a set.
- Parameters:
arg (
Expression
) – The collection.
- Returns:
The collection as a set.
- static Expression get(Connection connection, Expression arg, Expression index)¶
Access an element in a tuple, list or dictionary.
- Parameters:
arg (
Expression
) – The tuple, list or dictionary.index (
Expression
) – The index of the element to access. A zero indexed integer for a tuple or list, or a key for a dictionary.
- Returns:
The element.
- static Expression count(Connection connection, Expression arg)¶
Number of elements in a collection.
- Parameters:
arg (
Expression
) – The list, set or dictionary.
- Returns:
The number of elements in the collection.
- static Expression sum(Connection connection, Expression arg)¶
Sum all elements of a collection.
- Parameters:
arg (
Expression
) – The list or set.
- Returns:
The sum of the elements in the collection.
- static Expression max(Connection connection, Expression arg)¶
Maximum of all elements in a collection.
- Parameters:
arg (
Expression
) – The list or set.
- Returns:
The maximum elements in the collection.
- static Expression min(Connection connection, Expression arg)¶
Minimum of all elements in a collection.
- Parameters:
arg (
Expression
) – The list or set.
- Returns:
The minimum elements in the collection.
- static Expression average(Connection connection, Expression arg)¶
Minimum of all elements in a collection.
- Parameters:
arg (
Expression
) – The list or set.
- Returns:
The minimum elements in the collection.
- static Expression select(Connection connection, Expression arg, Expression func)¶
Run a function on every element in the collection.
- Parameters:
arg (
Expression
) – The list or set.func (
Expression
) – The function.
- Returns:
The modified collection.
- static Expression where(Connection connection, Expression arg, Expression func)¶
Run a function on every element in the collection.
- Parameters:
arg (
Expression
) – The list or set.func (
Expression
) – The function.
- Returns:
The modified collection.
- static Expression contains(Connection connection, Expression arg, Expression value)¶
Determine if a collection contains a value.
- Parameters:
arg (
Expression
) – The collection.value (
Expression
) – The value to look for.
- Returns:
Whether the collection contains a value.
- static Expression aggregate(Connection connection, Expression arg, Expression func)¶
Applies an accumulator function over a sequence.
- Parameters:
arg (
Expression
) – The collection.func (
Expression
) – The accumulator function.
- Returns:
The accumulated value.
- static Expression aggregateWithSeed(Connection connection, Expression arg, Expression seed, Expression func)¶
Applies an accumulator function over a sequence, with a given seed.
- Parameters:
arg (
Expression
) – The collection.seed (
Expression
) – The seed value.func (
Expression
) – The accumulator function.
- Returns:
The accumulated value.
- static Expression concat(Connection connection, Expression arg1, Expression arg2)¶
Concatenate two sequences.
- Parameters:
arg1 (
Expression
) – The first sequence.arg2 (
Expression
) – The second sequence.
- Returns:
The first sequence followed by the second sequence.
- static Expression orderBy(Connection connection, Expression arg, Expression key)¶
Order a collection using a key function.
- Parameters:
arg (
Expression
) – The collection to order.key (
Expression
) – A function that takes a value from the collection and generates a key to sort on.
- Returns:
The ordered collection.
- static Expression all(Connection connection, Expression arg, Expression predicate)¶
Determine whether all items in a collection satisfy a boolean predicate.
- Parameters:
arg (
Expression
) – The collection.predicate (
Expression
) – The predicate function.
- Returns:
Whether all items satisfy the predicate.
- static Expression any(Connection connection, Expression arg, Expression predicate)¶
Determine whether any item in a collection satisfies a boolean predicate.
- Parameters:
arg (
Expression
) – The collection.predicate (
Expression
) – The predicate function.
- Returns:
Whether any item satisfies the predicate.
- public class Type¶
A server side expression.
- static Type double_(Connection connection)¶
Double type.
- static Type float_(Connection connection)¶
Float type.
- static Type int_(Connection connection)¶
Int type.
- static Type bool(Connection connection)¶
Bool type.
- static Type string(Connection connection)¶
String type.