NSLogicalTest 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 perform logical operations of AND, OR, and NOT on Boolean expressions represented by NSSpecifierTest objects. These operators are equivalent to “&&”, “||”, and “!” in the C language.

For AND and OR operations, an NSLogicalTest object is typically initialized with an array containing two or more NSSpecifierTest objects. isTrue—inherited from NSScriptWhoseTest—evaluates the array in a manner appropriate to the logical operation. For NOT operations, an NSLogicalTest object is initialized with only one NSSpecifierTest object; it simply reverses the Boolean outcome of the isTrue method.

You don’t normally subclass NSLogicalTest.

Tasks

Initializing a Logical Test

Instance Methods

initAndTestWithTests:

Returns an NSLogicalTest object initialized to perform an AND operation with the NSSpecifierTest objects in a given array.

- (id)initAndTestWithTests:(NSArray *)subTests
Parameters
subTests

An array of NSSpecifierTest objects representing Boolean expressions.

Return Value

An NSLogicalTest object initialized to perform an AND operation with the NSSpecifierTest objects in subTests.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSScriptWhoseTests.h

initNotTestWithTest:

Returns an NSLogicalTest object initialized to perform a NOT operation on the given NSScriptWhoseTest object.

- (id)initNotTestWithTest:(NSScriptWhoseTest *)subTest
Parameters
subTest

The NSScriptWhoseTest object to invert.

Return Value

An NSLogicalTest object initialized to perform a NOT operation on subTest.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSScriptWhoseTests.h

initOrTestWithTests:

Returns an NSLogicalTest object initialized to perform an OR operation with the NSSpecifierTest objects in a given array.

- (id)initOrTestWithTests:(NSArray *)subTests
Parameters
subTests

An array of NSSpecifierTest objects representing Boolean expressions.

Return Value

An NSLogicalTest object initialized to perform an OR operation with the NSSpecifierTest objects in subTests.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSScriptWhoseTests.h