Class

NSWhose​Specifier

NSWhose​Specifier 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. NSWhose​Specifier 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 NSWhose​Specifier object encapsulates a “test” object for defining this condition. A test object is instantiated from a subclass of the abstract NSScript​Whose​Test class, whose one declared method is is​True(). See "Boolean Expressions and Logical Operations" in NSScript​Object​Specifier and the descriptions in NSComparisonMethods and NSScriptingComparisonMethods for more information.

Overview

The set of elements specified by an NSWhose​Specifier object can be a subset of those that pass the NSWhose​Specifier object's test. This subset is specified by the various sub-element properties of the NSWhose​Specifier object . Consider as an example the specifier paragraphs where color of third word is blue. This would be represented by an NSWhose​Specifier 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 blue​Color]. 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).

NSWhose​Specifier is part of Cocoa’s built-in script handling. You don’t normally subclass it.

Nested Types

NSWhose​Specifier.Subelement​Identifier

NSWhose​Specifier uses these constants to specify sub-elements within the collection of objects being tested that pass the specifier’s test.

Symbols

Accessing information about a whose specifier

var end​Subelement​Identifier:​ NSWhose​Specifier.Subelement​Identifier

Sets the end sub-element identifier for the specifier to the value of a given sub-element.

var end​Subelement​Index:​ Int

Sets the index position of the last sub-element within the range of objects being tested that pass the specifier’s test.

var start​Subelement​Identifier:​ NSWhose​Specifier.Subelement​Identifier

Returns the start sub-element identifier for the receiver.

var start​Subelement​Index:​ Int

Returns the index position of the first sub-element within the range of objects being tested that pass the receiver's test.

var test:​ NSScript​Whose​Test

Returns the test object encapsulated by the receiver.

Constants

NSWhose​Specifier.Subelement​Identifier

NSWhose​Specifier uses these constants to specify sub-elements within the collection of objects being tested that pass the specifier’s test.

Relationships