Class: NSMutableOrderedSet

Inherits:
NSOrderedSet show all

Overview

NSMutableOrderedSet class declares the programmatic interface to a mutable, ordered collection of distinct objects.

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from NSOrderedSet

#addObserver:forKeyPath:options:context:, #array, #containsObject:, #count, #description, #descriptionWithLocale:, #descriptionWithLocale:indent:, #enumerateObjectsAtIndexes:options:usingBlock:, #enumerateObjectsUsingBlock:, #enumerateObjectsWithOptions:usingBlock:, #firstObject, #getObjects:range:, #indexOfObject:, #indexOfObject:inSortedRange:options:usingComparator:, #indexOfObjectAtIndexes:options:passingTest:, #indexOfObjectPassingTest:, #indexOfObjectWithOptions:passingTest:, #indexesOfObjectsAtIndexes:options:passingTest:, #indexesOfObjectsPassingTest:, #indexesOfObjectsWithOptions:passingTest:, #initWithArray:, #initWithArray:copyItems:, #initWithArray:range:copyItems:, #initWithObject:, #initWithObjects:, #initWithObjects:count:, #initWithOrderedSet:, #initWithOrderedSet:copyItems:, #initWithOrderedSet:range:copyItems:, #initWithSet:, #initWithSet:copyItems:, #intersectsOrderedSet:, #intersectsSet:, #isEqualToOrderedSet:, #isSubsetOfOrderedSet:, #isSubsetOfSet:, #lastObject, #objectAtIndex:, #objectAtIndexedSubscript:, #objectEnumerator, #objectsAtIndexes:, orderedSet, orderedSetWithArray:, orderedSetWithArray:range:copyItems:, orderedSetWithObject:, orderedSetWithObjects:, orderedSetWithObjects:count:, orderedSetWithOrderedSet:, orderedSetWithOrderedSet:range:copyItems:, orderedSetWithSet:, orderedSetWithSet:copyItems:, #removeObserver:forKeyPath:, #removeObserver:forKeyPath:context:, #reverseObjectEnumerator, #reversedOrderedSet, #set, #setValue:forKey:, #sortedArrayUsingComparator:, #sortedArrayWithOptions:usingComparator:, #valueForKey:

Methods inherited from NSObject

#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version

Constructor Details

This class inherits a constructor from NSObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class NSObject

Class Method Details

+ (Object) orderedSetWithCapacity(numItems)

Creates and returns an mutable ordered set with a given initial capacity. Mutable ordered sets allocate additional memory as needed, so numItems simply establishes the set’s initial capacity.

Parameters:

  • numItems (Integer)

    The initial capacity of the new ordered set.

Returns:

  • (Object)

    A mutable ordered set with initial capacity to hold numItems members.

Instance Method Details

- (Object) addObject(object)

Appends a given object to the mutable ordered set, if it is not already a member.

Parameters:

  • object (Object)

    The object to add to the set.

Returns:

- (Object) addObjects(objects, count:count)

Appends the given number of objects from a given C array.

Parameters:

  • objects (Object)

    A C array of objects.

  • count (Integer)

    The number of values from the objects C array to append to the mutable ordered set. This number will be the count of the new array—it must not be negative or greater than the number of elements in objects.

Returns:

- (Object) addObjectsFromArray(array)

Appends to the mutable ordered set each object contained in a given array that is not already a member.

Parameters:

  • array (Array)

    An array of objects to add to the set.

Returns:

- (Object) exchangeObjectAtIndex(idx1, withObjectAtIndex:idx2)

Exchanges the object at the specified index with the object at the other index.

Parameters:

  • idx1 (Integer)

    The index of the first object.Important: Raises an NSRangeException if index is beyond the end of the mutable ordered set.

  • idx2 (Integer)

    The index of the second object.Important: Raises an NSRangeException if index is beyond the end of the mutable ordered set.

Returns:

- (Object) initWithCapacity(numItems)

Returns an initialized mutable ordered set with a given initial capacity. Mutable ordered sets allocate additional memory as needed, so numItems simply establishes the set’s initial capacity.

Parameters:

  • numItems (Integer)

    The initial capacity of the new ordered set.

Returns:

  • (Object)

    An initialized mutable ordered set with initial capacity to hold numItems members.

- (Object) insertObject(object, atIndex:idx)

Inserts the given object at the specified index of the mutable ordered set. If the index is already occupied, the objects at index and beyond are shifted by adding 1 to their indices to make room.

Parameters:

  • object (Object)

    The object to insert into to the set’s content. This value must not be nil.Important: Important: Raises an NSInvalidArgumentException if object is nil.

  • idx (Integer)

    The index in the mutable ordered set at which to insert object. This value must not be greater than the count of elements in the array.Important: Important: Raises an NSRangeException if idx is greater than the number of elements in the mutable ordered set.

Returns:

- (Object) insertObjects(objects, atIndexes:indexes)

Inserts the objects in the array at the specified indexes. Each object in objects is inserted into the receiving mutable ordered set in turn at the corresponding location specified in indexes after earlier insertions have been made.

Parameters:

  • objects (Array)

    An array of objects to insert into the mutable ordered set.

  • indexes (NSIndexSet)

    The indexes at which the objects in objects should be inserted. The count of locations in indexes must equal the count of objects.

Returns:

- (Object) intersectOrderedSet(other)

Removes from the receiving ordered set each object that isn’t a member of another ordered set.

Parameters:

  • other (NSOrderedSet)

    The ordered set with which to perform the intersection.

Returns:

- (Object) intersectSet(other)

Removes from the receiving ordered set each object that isn’t a member of another set.

Parameters:

  • other (NSSet)

    The set with which to perform the intersection.

Returns:

- (Object) minusOrderedSet(other)

Removes each object in another given ordered set from the receiving mutable ordered set, if present.

Parameters:

  • other (NSOrderedSet)

    The ordered set of objects to remove from the receiving set.

Returns:

- (Object) minusSet(other)

Removes each object in another given set from the receiving mutable ordered set, if present.

Parameters:

  • other (NSSet)

    The set of objects to remove from the receiving set.

Returns:

- (Object) moveObjectsAtIndexes(indexes, toIndex:idx)

Moves the object at the specified indexes to the new location.

Parameters:

  • indexes (NSIndexSet)

    The indexes of the objects to move.

  • idx (Integer)

    The index in the mutable ordered array at which to insert the objects.

Returns:

- (Object) removeAllObjects

Removes all the objects from the mutable ordered set.

Returns:

- (Object) removeObject(object)

Removes a given object from the mutable ordered set.

Parameters:

  • object (Object)

    The object to remove from the mutable ordered set.

Returns:

- (Object) removeObjectAtIndex(idx)

Removes a the object at the specified index from the mutable ordered set. To fill the gap, all elements beyond index are moved by subtracting 1 from their index.

Parameters:

  • idx (Integer)

    The index of the object to remove from the mutable ordered set. The value must not exceed the bounds of the set.Important: Raises an NSRangeException if index is beyond the end of the mutable ordered set.

Returns:

- (Object) removeObjectsAtIndexes(indexes)

Removes the objects at the specified indexes from the mutable ordered set. This method is similar to removeObjectAtIndex:, but allows you to efficiently remove multiple objects with a single operation.

Parameters:

  • indexes (NSIndexSet)

    The indexes of the objects to remove from the mutable ordered set. The locations specified by indexes must lie within the bounds of the mutable ordered .

Returns:

- (Object) removeObjectsInArray(array)

Removes the objects in the array from the mutable ordered set. This method is similar to removeObject:, but allows you to efficiently remove large sets of objects with a single operation. If the receiving mutable ordered set does not contain objects in array, the method has no effect (although it does incur the overhead of searching the contents).This method assumes that all elements in array respond to hash and isEqual:.

Parameters:

  • array (Array)

    An array containing the objects to be removed from the receiving mutable ordered set.

Returns:

- (Object) removeObjectsInRange(range)

Removes from the mutable ordered set each of the objects within a given range. The objects are removed using removeObjectAtIndex:.

Parameters:

  • range (NSRange)

    The range of the objects to remove from the mutable ordered set.

Returns:

- (Object) replaceObjectAtIndex(idx, withObject:object)

Replaces the object at the specified index with the new object.

Parameters:

  • idx (Integer)

    The index of the object to be replaced. This value must not exceed the bounds of the mutable ordered set.Important: Raises an NSRangeException if index is beyond the end of the mutable ordered set.

  • object (Object)

    The object with which to replace the object at the index in the ordered set specified by idx. This value must not be nil.Important: Raises an NSInvalidArgumentException if object is nil.

Returns:

- (Object) replaceObjectsAtIndexes(indexes, withObjects:objects)

Replaces the objects at the specified indexes with the new objects. The indexes in indexes are used in the same order as the objects in objects.If objects or indexes is nil, this method raises an exception.

Parameters:

  • indexes (NSIndexSet)

    The indexes of the objects to be replaced.

  • objects (Array)

    The objects with which to replace the objects in the receiving mutable ordered set at the indexes specified by indexes.The count of locations in indexes must equal the count of objects.

Returns:

- (Object) replaceObjectsInRange(range, withObjects:objects, count:count)

Replaces the objects in the receiving mutable ordered set at the range with the specified number of objects from a given C array. Elements are added to the new array in the same order they appear in objects, up to but not including index count.

Parameters:

  • range (NSRange)

    The range of the objects to replace.

  • objects (Object)

    A C array of objects.

  • count (Integer)

    The number of values from the objects C array to insert in place of the objects in range. This number will be the count of the new array—it must not be negative or greater than the number of elements in objects.

Returns:

- (Object) setObject(obj, atIndex:idx)

Appends or replaces the object at the specified index.

Parameters:

  • obj (Object)

    The object to insert or append.

  • idx (Integer)

    The index. If the index is equal to the length of the collection, then it inserts the object at that index, otherwise it replaces the object at that index with the given object.

Returns:

- (Object) setObject(obj, atIndexedSubscript:idx)

Inserts the given object at the specified index of the mutable ordered set. If the index is already occupied, the objects at index and beyond are shifted by adding 1 to their indices to make room.This method is identical to insertObject:atIndex:.

Parameters:

  • object (Object)

    The object to insert into to the set’s content. This value must not be nil.Important: Important: Raises an NSInvalidArgumentException if object is nil.

  • idx (Integer)

    The index in the mutable ordered set at which to insert object. This value must not be greater than the count of elements in the array.Important: Important: Raises an NSRangeException if idx is greater than the number of elements in the mutable ordered set.

Returns:

- (Object) sortRange(range, options:opts, usingComparator:cmptr)

Sorts the specified range of the mutable ordered set using the specified options and the comparison method specified by a given comparator block.

Parameters:

  • range (NSRange)

    The range to sort.

  • opts (NSSortOptions)

    A bitmask that specifies the options for the sort (whether it should be performed concurrently and whether it should be performed stably).

  • cmptr (NSComparator)

    A comparator block.

Returns:

- (Object) sortUsingComparator(cmptr)

Sorts the mutable ordered set using the comparison method specified by the comparator block.

Parameters:

  • cmptr (NSComparator)

    A comparator block.

Returns:

- (Object) sortWithOptions(opts, usingComparator:cmptr)

Sorts the mutable ordered set using the specified options and the comparison method specified by a given comparator block.

Parameters:

  • opts (NSSortOptions)

    A bitmask that specifies the options for the sort (whether it should be performed concurrently and whether it should be performed stably).

  • cmptr (NSComparator)

    A comparator block.

Returns:

- (Object) unionOrderedSet(other)

Adds each object in another given ordered set to the receiving mutable ordered set, if not present.

Parameters:

  • other (NSOrderedSet)

    The set of objects to add to the receiving mutable ordered set.

Returns:

- (Object) unionSet(other)

Adds each object in another given set to the receiving mutable ordered set, if not present.

Parameters:

  • other (NSSet)

    The set of objects to add to the receiving mutable ordered set.

Returns: