Eclipse Platform
Release 3.6

org.eclipse.equinox.p2.metadata.expression
Interface IExpressionFactory

All Known Subinterfaces:
IQLFactory

public interface IExpressionFactory

This interface provides all the factory methods needed to create the nodes of the expression tree.

Since:
2.0

Field Summary
static String FUNC_BOOLEAN
           
static String FUNC_CLASS
           
static String FUNC_FILTER
           
static String FUNC_RANGE
           
static String FUNC_VERSION
           
static IExpression[] NO_ARGS
           
 
Method Summary
 IExpression all(IExpression collection, IExpression lambda)
          Create a collection filter that yields true if the lambda yields true for all of the elements of the collection
 IExpression and(IExpression... operands)
          Create a logical and of its operands.
 IExpression at(IExpression target, IExpression key)
          Create an lookup of key in the target.
 IExpression constant(Object value)
          Creates an expression that evaluates to the constant value.
<T> IContextExpression<T>
contextExpression(IExpression expr, Object... parameters)
          Creates a top level expression that represents a full query.
 IEvaluationContext createContext(IExpression[] variables, Object... params)
          Create an evaluation context with one single variable
 IEvaluationContext createContext(Object... params)
          Create an evaluation context with one single variable
 IExpression equals(IExpression lhs, IExpression rhs)
          Create an expression that tests if lhs is equal to rhs.
 IExpression exists(IExpression collection, IExpression lambda)
          Create a collection filter that yields true if the lambda yields true for at least one of the elements of the collection
 IFilterExpression filterExpression(IExpression expression)
          Creates a top level expression suitable for predicate matching
 IExpression greater(IExpression lhs, IExpression rhs)
          Create an expression that tests if lhs is greater than rhs.
 IExpression greaterEqual(IExpression lhs, IExpression rhs)
          Create an expression that tests if lhs is greater than or equal to rhs.
 IExpression indexedParameter(int index)
          Creates an indexed parameter expression
 IExpression intersect(IExpression c1, IExpression c2)
          Create an intersection of c1 and c2
 IExpression lambda(IExpression variable, IExpression body)
          Creates a lambda expression that takes exactly one variable.
 IExpression latest(IExpression collection)
          Create an expression that yields a new collection consisting of the latest version of the elements of the collection.
 IExpression less(IExpression lhs, IExpression rhs)
          Create an expression that tests if lhs is less than rhs.
 IExpression lessEqual(IExpression lhs, IExpression rhs)
          Create an expression that tests if lhs is less than or equal to rhs.
 IExpression limit(IExpression collection, IExpression limit)
          Create an expression that yields a new collection consisting of the n first elements of the source collection where n is determined by limit.
 IExpression limit(IExpression collection, int count)
          Create an expression that yields a new collection consisting of the count first elements of the source collection.
 IExpression matches(IExpression lhs, IExpression rhs)
          Create an expression that tests if lhs matches rhs.
<T> IMatchExpression<T>
matchExpression(IExpression expression, Object... parameters)
          Creates a parameterized top level expression suitable for predicate matching
 IExpression member(IExpression target, String name)
          Creates a member accessor expression.
 IExpression normalize(List<? extends IExpression> operands, int expressionType)
          Performs boolean normalization on the expression to create a canonical form.
 IExpression not(IExpression operand)
          Creates an expression that negates the result of evaluating its operand.
 IExpression or(IExpression... operands)
          Create a logical or of its operands.
 IExpression pipe(IExpression... expressions)
          Create a pipe of expressions.
 IExpression select(IExpression collection, IExpression lambda)
          Create an expression that yields a new collection consisting of all elements of the collection for which the lambda yields true.
 IExpression thisVariable()
          Returns the variable that represents this in an expression
 IExpression toExpression(IQuery<?> query)
          Wrap an IQuery as an expression.
 IExpression union(IExpression c1, IExpression c2)
          Create a union of c1 and c2
 IExpression variable(String name)
          Creates an expression that represents a variable
 

Field Detail

FUNC_BOOLEAN

static final String FUNC_BOOLEAN
See Also:
Constant Field Values

FUNC_VERSION

static final String FUNC_VERSION
See Also:
Constant Field Values

FUNC_CLASS

static final String FUNC_CLASS
See Also:
Constant Field Values

FUNC_RANGE

static final String FUNC_RANGE
See Also:
Constant Field Values

FUNC_FILTER

static final String FUNC_FILTER
See Also:
Constant Field Values

NO_ARGS

static final IExpression[] NO_ARGS
Method Detail

all

IExpression all(IExpression collection,
                IExpression lambda)
Create a collection filter that yields true if the lambda yields true for all of the elements of the collection

Parameters:
collection - The collection providing the elements to test
lambda - The lambda that performs the test
Returns:
A boolean expression

and

IExpression and(IExpression... operands)
Create a logical and of its operands.

Parameters:
operands - The boolean operands
Returns:
A boolean expression

at

IExpression at(IExpression target,
               IExpression key)
Create an lookup of key in the target. The key expression should evaluate to a string or an integer.

Parameters:
target - The target for the lookup
key - The key to use for the lookup
Returns:
A lookup expression

createContext

IEvaluationContext createContext(Object... params)
Create an evaluation context with one single variable

Parameters:
params - Indexed parameters to use in the expression
Returns:
the context

createContext

IEvaluationContext createContext(IExpression[] variables,
                                 Object... params)
Create an evaluation context with one single variable

Parameters:
params - Indexed parameters to use in the expression
variables - The variables that will be maintained by the context
Returns:
the context

constant

IExpression constant(Object value)
Creates an expression that evaluates to the constant value.

Parameters:
value - The constant
Returns:
A constant expression

contextExpression

<T> IContextExpression<T> contextExpression(IExpression expr,
                                            Object... parameters)
Creates a top level expression that represents a full query.

Parameters:
expr - The query
parameters - The parameters of the query
Returns:
A top level query expression

equals

IExpression equals(IExpression lhs,
                   IExpression rhs)
Create an expression that tests if lhs is equal to rhs.

Parameters:
lhs - The left hand side value.
rhs - The right hand side value.
Returns:
A boolean expression

exists

IExpression exists(IExpression collection,
                   IExpression lambda)
Create a collection filter that yields true if the lambda yields true for at least one of the elements of the collection

Parameters:
collection - The collection providing the elements to test
lambda - The lambda that performs the test
Returns:
A boolean expression

filterExpression

IFilterExpression filterExpression(IExpression expression)
Creates a top level expression suitable for predicate matching

Parameters:
expression - The boolean expression
Returns:
A top level predicate expression

greater

IExpression greater(IExpression lhs,
                    IExpression rhs)
Create an expression that tests if lhs is greater than rhs.

Parameters:
lhs - The left hand side value.
rhs - The right hand side value.
Returns:
A boolean expression

greaterEqual

IExpression greaterEqual(IExpression lhs,
                         IExpression rhs)
Create an expression that tests if lhs is greater than or equal to rhs.

Parameters:
lhs - The left hand side value.
rhs - The right hand side value.
Returns:
A boolean expression

indexedParameter

IExpression indexedParameter(int index)
Creates an indexed parameter expression

Parameters:
index - The index to use
Returns:
a parameter expression

intersect

IExpression intersect(IExpression c1,
                      IExpression c2)
Create an intersection of c1 and c2

Parameters:
c1 - first collection
c2 - second collection
Returns:
An intersect expression

lambda

IExpression lambda(IExpression variable,
                   IExpression body)
Creates a lambda expression that takes exactly one variable. Suitable for use in most collection expressions.

Parameters:
variable - The element variable that the lambda uses
body - The body of the lambda
Returns:
A lambda expression

latest

IExpression latest(IExpression collection)
Create an expression that yields a new collection consisting of the latest version of the elements of the collection. Each element in collection must implement the IVersionedId interface.

Parameters:
collection - The collection providing the versioned elements
Returns:
A collection expression

less

IExpression less(IExpression lhs,
                 IExpression rhs)
Create an expression that tests if lhs is less than rhs.

Parameters:
lhs - The left hand side value.
rhs - The right hand side value.
Returns:
A boolean expression

lessEqual

IExpression lessEqual(IExpression lhs,
                      IExpression rhs)
Create an expression that tests if lhs is less than or equal to rhs.

Parameters:
lhs - The left hand side value.
rhs - The right hand side value.
Returns:
A boolean expression

limit

IExpression limit(IExpression collection,
                  int count)
Create an expression that yields a new collection consisting of the count first elements of the source collection.

Parameters:
collection - The source collection
count - The element count limit
Returns:
A collection expression

limit

IExpression limit(IExpression collection,
                  IExpression limit)
Create an expression that yields a new collection consisting of the n first elements of the source collection where n is determined by limit.

Parameters:
collection - The source collection
limit - The expression that evaluates to the element count limit
Returns:
A collection expression

normalize

IExpression normalize(List<? extends IExpression> operands,
                      int expressionType)
Performs boolean normalization on the expression to create a canonical form.

Parameters:
operands - The operands to normalize
expressionType - The type (must be either IExpression.TYPE_AND or IExpression.TYPE_OR.
Returns:
The normalized expression

matches

IExpression matches(IExpression lhs,
                    IExpression rhs)
Create an expression that tests if lhs matches rhs.

Parameters:
lhs - The left hand side value.
rhs - The right hand side value.
Returns:
A boolean expression

matchExpression

<T> IMatchExpression<T> matchExpression(IExpression expression,
                                        Object... parameters)
Creates a parameterized top level expression suitable for predicate matching

Parameters:
expression - The boolean expression
parameters - The parameters to use in the call
Returns:
A top level predicate expression

member

IExpression member(IExpression target,
                   String name)
Creates a member accessor expression.

Parameters:
target - The target for the member access
name - The name of the member
Returns:
A member expression

not

IExpression not(IExpression operand)
Creates an expression that negates the result of evaluating its operand.

Parameters:
operand - The boolean expression to negate
Returns:
A boolean expression

or

IExpression or(IExpression... operands)
Create a logical or of its operands.

Parameters:
operands - The boolean operands
Returns:
A boolean expression

pipe

IExpression pipe(IExpression... expressions)
Create a pipe of expressions.

Parameters:
expressions - The expressions that make out the pipe
Returns:
A pipe expression

select

IExpression select(IExpression collection,
                   IExpression lambda)
Create an expression that yields a new collection consisting of all elements of the collection for which the lambda yields true.

Parameters:
collection - The collection providing the elements to test
lambda - The lambda that performs the test
Returns:
A collection expression

thisVariable

IExpression thisVariable()
Returns the variable that represents this in an expression

Returns:
The this variable.

toExpression

IExpression toExpression(IQuery<?> query)
Wrap an IQuery as an expression.

Parameters:
query -
Returns:
An expression that wraps the query

union

IExpression union(IExpression c1,
                  IExpression c2)
Create a union of c1 and c2

Parameters:
c1 - first collection
c2 - second collection
Returns:
A union expression

variable

IExpression variable(String name)
Creates an expression that represents a variable

Parameters:
name - The name of the variable
Returns:
A variable expression

Eclipse Platform
Release 3.6

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2010. All rights reserved.