API 0.9.5
CPComparisonPredicate Class Reference

CPComparisonPredicate is a subclass of CPPredicate used to compare expressions. More...

#import <CPComparisonPredicate.h>

Inheritance diagram for CPComparisonPredicate:

List of all members.

Instance Methods

(CPComparisonPredicateModifier- comparisonPredicateModifier
(SEL) - customSelector
(void) - encodeWithCoder:
(BOOL) - evaluateWithObject:
(BOOL) - evaluateWithObject:substitutionVariables:
(id) - initWithCoder:
(id) - initWithLeftExpression:rightExpression:customSelector:
(id) - initWithLeftExpression:rightExpression:modifier:type:options:
(CPExpression- leftExpression
(unsigned) - options
(CPString- predicateFormat
(CPPredicateOperatorType- predicateOperatorType
(CPPredicate- predicateWithSubstitutionVariables:
(CPExpression- rightExpression

Class Methods

(CPPredicate+ predicateWithLeftExpression:rightExpression:customSelector:
(CPPredicate+ predicateWithLeftExpression:rightExpression:modifier:type:options:

Detailed Description

CPComparisonPredicate is a subclass of CPPredicate used to compare expressions.

A predicate to directly compare the left and right hand sides.

A predicate to compare all entries in the destination of a to-many relationship.

The left hand side must be a collection. The corresponding predicate compares each value in the left hand side with the right hand side, and returns NO when it finds the first mismatch—or YES if all match.

A predicate to match with any entry in the destination of a to-many relationship.

The left hand side must be a collection. The corresponding predicate compares each value in the left hand side against the right hand side and returns YES when it finds the first match—or NO if no match is found.

A case-insensitive predicate.

A diacritic-insensitive predicate.

A less-than predicate.

A less-than-or-equal-to predicate.

A greater-than predicate.

A greater-than-or-equal-to predicate.

An equal-to predicate.

A not-equal-to predicate.

A full regular expression matching predicate.

A simple subset of the matches predicate, similar in behavior to SQL LIKE.

A begins-with predicate.

An ends-with predicate.

A predicate to determine if the left hand side is in the right hand side.

For strings, returns YES if the left hand side is a substring of the right hand side. For collections, returns YES if the left hand side is in the right hand side.

Predicate that uses a custom selector that takes a single argument and returns a BOOL value.

The selector is invoked on the left hand side with the right hand side.

A predicate to determine if the left hand side contains the right hand side.

Returns YES if [lhs contains rhs]; the left hand side must be a CPExpression object that evaluates to a collection

A predicate to determine if the right hand side lies between bounds specified by the left hand side.

Returns YES if [lhs between rhs]; the right hand side must be an array in which the first element sets the lower bound and the second element the upper, inclusive. Comparison is performed using compare: or the class-appropriate equivalent.

Comparison predicates are predicates used to compare the results of two expressions. Comparison predicates take an operator, a left expression, and a right expression, and return as a BOOL the result of invoking the operator with the results of evaluating the expressions. Expressions are represented by instances of the CPExpression class.

Definition at line 2 of file CPComparisonPredicate.h.


Method Documentation

- (CPComparisonPredicateModifier) comparisonPredicateModifier

Returns the comparison predicate modifier for the receiver.

Returns:
The comparison predicate modifier for the receiver.

Definition at line 265 of file CPComparisonPredicate.j.

- (SEL) customSelector

Returns the selector for the receiver.

Returns:
The selector for the receiver, or NULL if there is none.

Definition at line 274 of file CPComparisonPredicate.j.

- (void) encodeWithCoder: (CPCoder coder

Definition at line 530 of file CPComparisonPredicate.j.

- (BOOL) evaluateWithObject: (id)  object

Returns a Boolean value that indicates whether a given object matches the conditions specified by the receiver.

Parameters:
objectThe object against which to evaluate the receiver.
Returns:
YES if object matches the conditions specified by the receiver, otherwise NO.

Reimplemented from CPPredicate.

Definition at line 478 of file CPComparisonPredicate.j.

- (BOOL) evaluateWithObject: (id)  object
substitutionVariables: (CPDictionary variables 

Returns a Boolean value that indicates whether a given object matches the conditions specified by the receiver after substituting in the values in a given variables dictionary.

Parameters:
objectThe object against which to evaluate the receiver.
variablesThe substitution variables dictionary. The dictionary must contain key-value pairs for all variables in the receiver.
Returns:
YES if object matches the conditions specified by the receiver after substituting in the values in variables for any replacement tokens, otherwise NO.

Reimplemented from CPPredicate.

Definition at line 483 of file CPComparisonPredicate.j.

- (id) initWithCoder: (CPCoder coder

Definition at line 514 of file CPComparisonPredicate.j.

- (id) initWithLeftExpression: (CPExpression left
rightExpression: (CPExpression right
customSelector: (SEL)  selector 

Initializes a predicate formed by combining given left and right expressions using a given selector.

Parameters:
leftThe left hand side expression.
rightThe right hand side expression.
selectorThe selector to use for comparison. The method defined by the selector must take a single argument and return a BOOL value.
Returns:
The receiver, initialized by combining the left and right expressions using selector.

Definition at line 211 of file CPComparisonPredicate.j.

- (id) initWithLeftExpression: (CPExpression left
rightExpression: (CPExpression right
modifier: (CPComparisonPredicateModifier modifier
type: (CPPredicateOperatorType type
options: (unsigned)  options 

Initializes a predicate to a given type formed by combining given left and right expressions using a given modifier and options.

Parameters:
leftThe left hand expression.
rightThe right hand expression.
modifierThe modifier to apply.
typeThe predicate operator type.
optionsThe options to apply (see CPComparisonPredicate Options).
Returns:
The receiver, initialized to a predicate of type type formed by combining the left and right expressions using the modifier and options.

Definition at line 237 of file CPComparisonPredicate.j.

- (CPExpression) leftExpression

Returns the left expression for the receiver.

Returns:
The left expression for the receiver, or nil if there is none.

Definition at line 283 of file CPComparisonPredicate.j.

- (unsigned) options

Returns the options that are set for the receiver.

Returns:
The options that are set for the receiver.

Definition at line 292 of file CPComparisonPredicate.j.

- (CPString) predicateFormat

Returns the receiver’s format string.

Returns:
The receiver’s format string.

Reimplemented from CPPredicate.

Definition at line 316 of file CPComparisonPredicate.j.

- (CPPredicateOperatorType) predicateOperatorType

Returns the predicate type for the receiver.

Returns:
Returns the predicate type for the receiver.

Definition at line 301 of file CPComparisonPredicate.j.

+ (CPPredicate) predicateWithLeftExpression: (CPExpression left
rightExpression: (CPExpression right
customSelector: (SEL)  selector 

Returns a new predicate formed by combining the left and right expressions using a given selector.

Parameters:
leftThe left hand side expression.
rightThe right hand side expression.
selectorThe selector to use for comparison. The method defined by the selector must take a single argument and return a BOOL value.
Returns:
A new predicate formed by combining the left and right expressions using selector.

Definition at line 185 of file CPComparisonPredicate.j.

+ (CPPredicate) predicateWithLeftExpression: (CPExpression left
rightExpression: (CPExpression right
modifier: (CPComparisonPredicateModifier modifier
type: (int)  type
options: (unsigned)  options 

Creates and returns a predicate of a given type formed by combining given left and right expressions using a given modifier and options.

Parameters:
leftThe left hand expression.
rightThe right hand expression.
modifierThe modifier to apply.
typeThe predicate operator type.
optionsThe options to apply (see CPComparisonPredicate Options).
Returns:
A new predicate of type type formed by combining the given left and right expressions using the modifier and options.

Definition at line 199 of file CPComparisonPredicate.j.

- (CPPredicate) predicateWithSubstitutionVariables: (CPDictionary variables

Returns a copy of the receiver with the receiver’s variables substituted by values specified in a given substitution variables dictionary.

Parameters:
variablesThe substitution variables dictionary. The dictionary must contain key-value pairs for all variables in the receiver.
Returns:
A copy of the receiver with the receiver’s variables substituted by values specified in variables.

Reimplemented from CPPredicate.

Definition at line 384 of file CPComparisonPredicate.j.

- (CPExpression) rightExpression

Returns the right expression for the receiver.

Returns:
The right expression for the receiver, or nil if there is none.

Definition at line 310 of file CPComparisonPredicate.j.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Defines