| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/Foundation.framework  | 
| Availability | Available in Mac OS X v10.0 and later.  | 
| Companion guide | |
| Declared in | NSScriptObjectSpecifiers.h  | 
NSWhoseSpecifier specifies every object in a collection (or every element in a container) that matches the condition defined by a single Boolean expression or multiple Boolean expressions connected by logical operators. NSWhoseSpecifier is unique among object specifiers in that its top-level container is typically not the application object but an evaluated object specifier involved in the tested-for condition. An NSWhoseSpecifier object encapsulates a “test” object for defining this condition. A test object is instantiated from a subclass of the abstract NSScriptWhoseTest class, whose one declared method is isTrue. See "Boolean Expressions and Logical Operations" in NSScriptObjectSpecifier and the descriptions in NSComparisonMethods and NSScriptingComparisonMethods for more information.
The set of elements specified by an NSWhoseSpecifier object can be a subset of those that pass the NSWhoseSpecifier object's test. This subset is specified by the various sub-element properties of the NSWhoseSpecifier object . Consider as an example the specifier paragraphs where color of third word is blue. This would be represented by an NSWhoseSpecifier object  that uses a test specifier and another object specifier to identify a subset of the objects with the specified property. That is, the specifier’s property is paragraphs; the test specifier is an index specifier with property words and index 3; and the qualifier is a key value qualifier for key color and value [NSColor blueColor]. The test object specifier (word at index 3) is evaluated for each object (paragraph) using that object as the container; the resulting objects (if any) are tested with the qualifier (color blue).
NSWhoseSpecifier is part of Cocoa’s built-in script handling. You don’t normally subclass it.
– endSubelementIdentifier
                    
                    			
                        – endSubelementIndex
                    
                    			
                        – setEndSubelementIdentifier:
                    
                    			
                        – setEndSubelementIndex:
                    
                    			
                        – setStartSubelementIdentifier:
                    
                    			
                        – setStartSubelementIndex:
                    
                    			
                        – setTest:
                    
                    			
                        – startSubelementIdentifier
                    
                    			
                        – startSubelementIndex
                    
                    			
                        – test
                    
                    			
                        Returns the end sub-element identifier for the receiver.
- (NSWhoseSubelementIdentifier)endSubelementIdentifier
The end sub-element identifier for the receiver, or NSNoSubelement if there is none.
NSScriptObjectSpecifiers.hReturns the index position of the last sub-element within the range of objects being tested that passes the receiver's test.
- (NSInteger)endSubelementIndex
The index position of the last sub-element within the range of objects being tested that passes the receiver's test.
NSScriptObjectSpecifiers.hReturns an NSWhoseSpecifier object initialized with the given attributes.
- (id)initWithContainerClassDescription:(NSScriptClassDescription *)classDescription containerSpecifier:(NSScriptObjectSpecifier *)specifier key:(NSString *)property test:(NSScriptWhoseTest *)test
Class description for the receiver's container object.
An object specifier for the receiver's container object.
The key for the property for which to test.
The test condition.
An NSWhoseSpecifier object initialized with the given attributes.
Invokes the super class’s initWithContainerClassDescription:containerSpecifier:key: and sets the whose test condition to test.
NSScriptObjectSpecifiers.hSets the end sub-element identifier for the specifier to the value of a given sub-element.
- (void)setEndSubelementIdentifier:(NSWhoseSubelementIdentifier)subelement
The end sub-element for the receiver.
NSScriptObjectSpecifiers.hSets the index position of the last sub-element within the range of objects being tested that pass the specifier’s test.
- (void)setEndSubelementIndex:(NSInteger)index
The index position of the end sub-element.
Used only if the end sub-element identifier is NSIndexSubelement.
NSScriptObjectSpecifiers.hSets the start sub-element identifier for the specifier.
- (void)setStartSubelementIdentifier:(NSWhoseSubelementIdentifier)subelement
The start sub-element for the receiver.
NSScriptObjectSpecifiers.hSets the index position of the first sub-element within the range of objects being tested that passes the specifier’s test.
- (void)setStartSubelementIndex:(NSInteger)index
The index position of the start sub-element.
Used only if the start sub-element identifier is NSIndexSubelement.
NSScriptObjectSpecifiers.hSets the test object that is encapsulated by the receiver.
- (void)setTest:(NSScriptWhoseTest *)test
The test object for the receiver.
NSScriptObjectSpecifiers.hReturns the start sub-element identifier for the receiver.
- (NSWhoseSubelementIdentifier)startSubelementIdentifier
The start sub-element identifier for the receiver.
NSScriptObjectSpecifiers.hReturns the index position of the first sub-element within the range of objects being tested that pass the receiver's test.
- (NSInteger)startSubelementIndex
The index position of the first sub-element within the range of objects being tested that pass the receiver's test.
NSScriptObjectSpecifiers.hReturns the test object encapsulated by the receiver.
- (NSScriptWhoseTest *)test
The test object encapsulated by the receiver.
NSScriptObjectSpecifiers.hNSWhoseSpecifier uses these constants to specify sub-elements within the collection of objects being tested that pass the specifier’s test.
typedef enum {
   NSIndexSubelement  = 0,
   NSEverySubelement  = 1,
   NSMiddleSubelement = 2,
   NSRandomSubelement = 3,
   NSNoSubelement     = 4
} NSWhoseSubelementIdentifier;
NSIndexSubelementAn element at a given index that meets the specifier test.
Available in Mac OS X v10.0 and later.
Declared in NSScriptObjectSpecifiers.h.
NSEverySubelementEvery element that meets the specifier test.
Available in Mac OS X v10.0 and later.
Declared in NSScriptObjectSpecifiers.h.
NSMiddleSubelementThe middle element that meets the specifier test.
Available in Mac OS X v10.0 and later.
Declared in NSScriptObjectSpecifiers.h.
NSRandomSubelementAny element that meets the specifier test.
Available in Mac OS X v10.0 and later.
Declared in NSScriptObjectSpecifiers.h.
NSNoSubelementNo sub-element met the specifier test. Valid only for specifying the end sub-element.; that is, there is no end, so consider all elements.
Available in Mac OS X v10.0 and later.
Declared in NSScriptObjectSpecifiers.h.
These constants are used by startSubelementIdentifier, setStartSubelementIdentifier:, endSubelementIdentifier, and setEndSubelementIdentifier:.
NSScriptObjectSpecifiers.h
        © 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-06-28)