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:
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:
static Expression notEqual(Connection connection, Expression arg0, Expression arg1)

Inequality comparison.

Parameters:
static Expression greaterThan(Connection connection, Expression arg0, Expression arg1)

Greater than numerical comparison.

Parameters:
static Expression greaterThanOrEqual(Connection connection, Expression arg0, Expression arg1)

Greater than or equal numerical comparison.

Parameters:
static Expression lessThan(Connection connection, Expression arg0, Expression arg1)

Less than numerical comparison.

Parameters:
static Expression lessThanOrEqual(Connection connection, Expression arg0, Expression arg1)

Less than or equal numerical comparison.

Parameters:
static Expression and(Connection connection, Expression arg0, Expression arg1)

Boolean and operator.

Parameters:
static Expression or(Connection connection, Expression arg0, Expression arg1)

Boolean or operator.

Parameters:
static Expression exclusiveOr(Connection connection, Expression arg0, Expression arg1)

Boolean exclusive-or operator.

Parameters:
static Expression not(Connection connection, Expression arg)

Boolean negation operator.

Parameters:
static Expression add(Connection connection, Expression arg0, Expression arg1)

Numerical addition.

Parameters:
static Expression subtract(Connection connection, Expression arg0, Expression arg1)

Numerical subtraction.

Parameters:
static Expression multiply(Connection connection, Expression arg0, Expression arg1)

Numerical multiplication.

Parameters:
static Expression divide(Connection connection, Expression arg0, Expression arg1)

Numerical division.

Parameters:
static Expression modulo(Connection connection, Expression arg0, Expression arg1)

Numerical modulo operator.

Parameters:
Returns:

The remainder of arg0 divided by arg1

static Expression power(Connection connection, Expression arg0, Expression arg1)

Numerical power operator.

Parameters:
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:
static Expression rightShift(Connection connection, Expression arg0, Expression arg1)

Bitwise right shift.

Parameters:
static Expression cast(Connection connection, Expression arg, Type type)

Perform a cast to the given type.

Parameters:
static Expression parameter(Connection connection, String name, Type type)

A named parameter of type double.

Parameters:
  • name (String) – The name of the parameter.

  • type (Type) – The type of the parameter.

Returns:

A named parameter.

static Expression function(Connection connection, java.util.List<Expression> parameters, Expression body)

A function.

Parameters:
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:
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:
Returns:

The collection as a list.

static Expression toSet(Connection connection, Expression arg)

Convert a collection to a set.

Parameters:
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:
Returns:

The sum of the elements in the collection.

static Expression max(Connection connection, Expression arg)

Maximum of all elements in a collection.

Parameters:
Returns:

The maximum elements in the collection.

static Expression min(Connection connection, Expression arg)

Minimum of all elements in a collection.

Parameters:
Returns:

The minimum elements in the collection.

static Expression average(Connection connection, Expression arg)

Minimum of all elements in a collection.

Parameters:
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:
Returns:

The modified collection.

static Expression where(Connection connection, Expression arg, Expression func)

Run a function on every element in the collection.

Parameters:
Returns:

The modified collection.

static Expression contains(Connection connection, Expression arg, Expression value)

Determine if a collection contains a value.

Parameters:
Returns:

Whether the collection contains a value.

static Expression aggregate(Connection connection, Expression arg, Expression func)

Applies an accumulator function over a sequence.

Parameters:
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:
Returns:

The accumulated value.

static Expression concat(Connection connection, Expression arg1, Expression arg2)

Concatenate two sequences.

Parameters:
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:
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:
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.