Inherits from | |
Conforms to | |
Framework | /System/Library/Frameworks/Foundation.framework |
Availability | Available in Mac OS X v10.0 and later. |
Companion guide | |
Declared in | NSScriptWhoseTests.h |
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
.
Returns a specifier test initialized to evaluate a test object against an object specified by an object specifier using a given comparison operation.
- (id)initWithObjectSpecifier:(NSScriptObjectSpecifier *)obj1 comparisonOperator:(NSTestComparisonOperation)compOp testObject:(id)obj2
An object specifier.
The comparison operation.
The object against which to evaluate the object specified by obj1.
A specifier test initialized to evaluate (obj2) against an object specified by obj1 using the comparison operation compOp.
NSScriptWhoseTests.h
These are passed to initWithObjectSpecifier:comparisonOperator:testObject: to specify the comparison operator.
typedef enum { NSEqualToComparison = 0, NSLessThanOrEqualToComparison, NSLessThanComparison, NSGreaterThanOrEqualToComparison, NSGreaterThanComparison, NSBeginsWithComparison, NSEndsWithComparison, NSContainsComparison } NSTestComparisonOperation;
NSEqualToComparison
Binary comparison operator that results in YES
if the two objects are equal.
Available in Mac OS X v10.0 and later.
Declared in NSScriptWhoseTests.h
.
NSLessThanOrEqualToComparison
Binary comparison operator that results in YES
if the value of the test object is equal to or less than the value of the other object.
Available in Mac OS X v10.0 and later.
Declared in NSScriptWhoseTests.h
.
NSLessThanComparison
Binary comparison operator that results in YES
if the value of the test object is less than the value of the other object.
Available in Mac OS X v10.0 and later.
Declared in NSScriptWhoseTests.h
.
NSGreaterThanOrEqualToComparison
Binary comparison operator that results in YES
if the value of the test object is greater than or equal to the value of the other object.
Available in Mac OS X v10.0 and later.
Declared in NSScriptWhoseTests.h
.
NSGreaterThanComparison
Binary comparison operator that results in YES
if the value of the test object is greater than the value of the other object.
Available in Mac OS X v10.0 and later.
Declared in NSScriptWhoseTests.h
.
NSBeginsWithComparison
Binary containment operator that results in YES
if 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 Mac OS X v10.0 and later.
Declared in NSScriptWhoseTests.h
.
NSEndsWithComparison
Binary containment operator that results in YES
if 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 Mac OS X v10.0 and later.
Declared in NSScriptWhoseTests.h
.
NSContainsComparison
Binary containment operator that results in YES
if 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 Mac OS X v10.0 and later.
Declared in NSScriptWhoseTests.h
.
NSScriptWhoseTests.h
© 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-06-28)