NSSpecifierTest Class Reference
| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/Foundation.framework |
| Availability | Available in OS X v10.0 and later. |
| Companion guide | |
| Declared in | NSScriptWhoseTests.h |
Overview
Instances of this class represent a Boolean expression; they evaluate an object specifier and compare the resulting object to another object using a given comparison method. For more information on NSSpecifierTest, see the method description for its sole public method, its initializer, initWithObjectSpecifier:comparisonOperator:testObject:.
When an NSSpecifierTest object is properly initialized, it holds two objects:
A “value” or “test” object used as the basis of the comparison; this object can be a regular object or object specifier (such as “blue” in “words whose color is blue”).
An object specifier evaluating to the container (“words”).
The instance also encapsulates a selector identifying the method performing this comparison. The informal protocol NSComparisonMethods defines a set of comparison methods useful for this purpose, while NSScriptingComparisonMethods describes additional methods you may need to use for scripting.
The test object is compared, using the selector, against each object in the container. Specifiers in these tests usually have containerIsObjectBeingTested invoked on their topmost container.
You should rarely need to subclass NSSpecifierTest.
Instance Methods
initWithObjectSpecifier:comparisonOperator:testObject:
Returns a specifier test initialized to evaluate a test object against an object specified by an object specifier using a given comparison operation.
Parameters
- obj1
An object specifier.
- compOp
The comparison operation.
- obj2
The object against which to evaluate the object specified by obj1.
Return Value
A specifier test initialized to evaluate (obj2) against an object specified by obj1 using the comparison operation compOp.
Availability
- Available in OS X v10.0 and later.
Declared In
NSScriptWhoseTests.hConstants
NSTestComparisonOperation
These are passed to initWithObjectSpecifier:comparisonOperator:testObject: to specify the comparison operator.
typedef enum {
NSEqualToComparison = 0,
NSLessThanOrEqualToComparison,
NSLessThanComparison,
NSGreaterThanOrEqualToComparison,
NSGreaterThanComparison,
NSBeginsWithComparison,
NSEndsWithComparison,
NSContainsComparison
} NSTestComparisonOperation;
Constants
NSEqualToComparisonBinary comparison operator that results in
YESif the two objects are equal.Available in OS X v10.0 and later.
Declared in
NSScriptWhoseTests.h.NSLessThanOrEqualToComparisonBinary comparison operator that results in
YESif the value of the test object is equal to or less than the value of the other object.Available in OS X v10.0 and later.
Declared in
NSScriptWhoseTests.h.NSLessThanComparisonBinary comparison operator that results in
YESif the value of the test object is less than the value of the other object.Available in OS X v10.0 and later.
Declared in
NSScriptWhoseTests.h.NSGreaterThanOrEqualToComparisonBinary comparison operator that results in
YESif the value of the test object is greater than or equal to the value of the other object.Available in OS X v10.0 and later.
Declared in
NSScriptWhoseTests.h.NSGreaterThanComparisonBinary comparison operator that results in
YESif the value of the test object is greater than the value of the other object.Available in OS X v10.0 and later.
Declared in
NSScriptWhoseTests.h.NSBeginsWithComparisonBinary containment operator that results in
YESif the test object is a list or string that matches the beginning of the other object (which is also a list or string).Available in OS X v10.0 and later.
Declared in
NSScriptWhoseTests.h.NSEndsWithComparisonBinary containment operator that results in
YESif the test object is a list or string that matches the end of the other object (which is also a list or string).Available in OS X v10.0 and later.
Declared in
NSScriptWhoseTests.h.NSContainsComparisonBinary containment operator that results in
YESif the test object is a list or string that matches the other object (which is also a list or string) at any location.Available in OS X v10.0 and later.
Declared in
NSScriptWhoseTests.h.
Availability
- Available in OS X v10.0 and later.
Declared In
NSScriptWhoseTests.h© 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-06-28)