![]() |
API
0.9.6
|
CPExpression is used to represent expressions in a predicate. More...
#import <CPExpression.h>
Additional Inherited Members | |
![]() | |
Class | isa |
CPExpression is used to represent expressions in a predicate.
Comparison operations in an CPPredicate are based on two expressions, as represented by instances of the CPExpression class. Expressions are created for constant values, key paths, and so on.
Generally, anywhere in the CPExpression class hierarchy where there is composite API and subtypes that may only reasonably respond to a subset of that API, invoking a method that does not make sense for that subtype will cause an exception to be thrown.
Definition at line 2 of file CPExpression.h.
|
implementation |
Returns the arguments for the receiver.
Definition at line 317 of file CPExpression.j.
|
implementation |
Returns the collection of expressions in an aggregate expression, or the collection element of a subquery expression.
Definition at line 328 of file CPExpression.j.
|
implementation |
Returns the constant value of the receiver.
Definition at line 273 of file CPExpression.j.
|
implementation |
Returns a new aggregate expression for a given collection.
collection | A collection object (an instance of CPArray, CPSet, or CPDictionary) that contains further expressions. |
Definition at line 140 of file CPExpression.j.
|
implementation |
Returns a new expression that represents a given constant value.
value | The constant value the new expression is to represent. |
Definition at line 101 of file CPExpression.j.
|
implementation |
Returns a new expression that represents the object being evaluated.
Definition at line 110 of file CPExpression.j.
|
implementation |
Returns a new expression that will invoke one of the predefined functions.
function_name | The name of the function to invoke. |
parameters | An array containing CPExpression objects that will be used as parameters during the invocation of selector. |
For a selector taking no parameters, the array should be empty. For a selector taking one or more parameters, the array should contain one CPExpression object which will evaluate to an instance of the appropriate type for each parameter.
If there is a mismatch between the number of parameters expected and the number you provide during evaluation, an exception may be raised or missing parameters may simply be replaced by nil (which occurs depends on how many parameters are provided, and whether you have over- or underflow).
The name parameter can be one of the following predefined functions:
name parameter array contents returns ------------------------------------------------------------------------------------------------------------------------------------- sum: CPExpression instances representing numbers CPNumber count: CPExpression instances representing numbers CPNumber min: CPExpression instances representing numbers CPNumber max: CPExpression instances representing numbers CPNumber average: CPExpression instances representing numbers CPNumber median: CPExpression instances representing numbers CPNumber mode: CPExpression instances representing numbers CPArray (returned array will contain all occurrences of the mode) stddev: CPExpression instances representing numbers CPNumber add:to: CPExpression instances representing numbers CPNumber from:subtract: two CPExpression instances representing numbers CPNumber multiply:by: two CPExpression instances representing numbers CPNumber divide:by: two CPExpression instances representing numbers CPNumber modulus:by: two CPExpression instances representing numbers CPNumber sqrt: one CPExpression instance representing numbers CPNumber log: one CPExpression instance representing a number CPNumber ln: one CPExpression instance representing a number CPNumber raise:toPower: one CPExpression instance representing a number CPNumber exp: one CPExpression instance representing a number CPNumber floor: one CPExpression instance representing a number CPNumber ceiling: one CPExpression instance representing a number CPNumber abs: one CPExpression instance representing a number CPNumber trunc: one CPExpression instance representing a number CPNumber uppercase: one CPExpression instance representing a string CPString lowercase: one CPExpression instance representing a string CPString random: one CPExpression instance representing a number CPNumber (integer) such that 0 <= rand < param now: none [CPDate now] This method raises an exception immediately if the selector is invalid; it raises an exception at runtime if the parameters are incorrect.
Definition at line 226 of file CPExpression.j.
|
implementation |
Returns an expression which will return the result of invoking on a given target a selector with a given name using given arguments.
target | A CPExpression object which will evaluate an object on which the selector identified by name may be invoked. |
selectorName | The name of the method to be invoked. |
parameters | An array containing CPExpression objects which can be evaluated to provide parameters for the method specified by name. |
See the description of expressionForFunction:arguments:
for examples of how to construct the parameter array.
Definition at line 240 of file CPExpression.j.
|
implementation |
Returns a new CPExpression object that represent the intersection of a given set and collection.
left | An expression that evaluates to a CPSet object. |
right | An expression that evaluates to a collection object (an instance of CPArray, CPSet, or CPDictionary). |
Definition at line 162 of file CPExpression.j.
|
implementation |
Returns a new expression that invokes valueForKeyPath: with a given key path.
keyPath | The key path that the new expression should evaluate. |
Definition at line 130 of file CPExpression.j.
|
implementation |
Returns a new CPExpression object that represent the subtraction of a given collection from a given set.
left | An expression that evaluates to a CPSet object. |
left | An expression that evaluates to a collection object (an instance of CPArray, CPSet, or CPDictionary). |
Definition at line 173 of file CPExpression.j.
|
implementation |
Returns an expression that filters a collection by storing elements in the collection in a given variable and keeping the elements for which qualifier returns true.
expression | A CPExpression that evaluates to a collection. |
variable | Used as a local variable, and will shadow any instances of variable in the bindings dictionary. The variable is removed or the old value replaced once evaluation completes. |
predicate | The predicate used to determine whether the element belongs in the result collection. |
Definition at line 252 of file CPExpression.j.
|
implementation |
Returns a new CPExpression object that represent the union of a given set and collection.
left | An expression that evaluates to a CPSet object. |
right | An expression that evaluates to a collection object (an instance of CPArray, CPSet, or CPDictionary). |
Definition at line 151 of file CPExpression.j.
|
implementation |
Returns a new expression that extracts a value from the variable bindings dictionary for a given key.
string | The key for the variable to extract from the variable bindings dictionary. |
Definition at line 120 of file CPExpression.j.
|
implementation |
Returns the expression type for the receiver.
Definition at line 263 of file CPExpression.j.
|
implementation |
Returns the function for the receiver.
Definition at line 306 of file CPExpression.j.
|
implementation |
Initializes the receiver with the specified expression type.
type | The type of the new expression, as defined by CPExpressionType. |
Definition at line 88 of file CPExpression.j.
|
implementation |
Returns the key path for the receiver.
Definition at line 295 of file CPExpression.j.
|
implementation |
Returns the left expression of a set expression.
Definition at line 361 of file CPExpression.j.
|
implementation |
Returns the operand for the receiver.
Definition at line 350 of file CPExpression.j.
|
implementation |
Returns the predicate in a subquery expression.
Definition at line 339 of file CPExpression.j.
|
implementation |
Returns the right expression of a set expression.
Definition at line 372 of file CPExpression.j.
|
implementation |
Returns the variable for the receiver.
Definition at line 284 of file CPExpression.j.