net.wotonomy.foundation
Class NSMutableArray

java.lang.Object
  extended by net.wotonomy.foundation.NSArray
      extended by net.wotonomy.foundation.NSMutableArray
All Implemented Interfaces:
java.io.Serializable, java.lang.Iterable, java.util.Collection, java.util.List

public class NSMutableArray
extends NSArray

NSMutableArray extends NSArray to allow modification.

Version:
$Revision: 893 $
Author:
michael@mpowers.net, $Author: cgruber $
See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.wotonomy.foundation.NSArray
EmptyArray, NotFound
 
Constructor Summary
NSMutableArray()
          Default constructor returns an empty array.
NSMutableArray(java.util.Collection aCollection)
          Produces an array containing the objects in the specified collection.
NSMutableArray(int aSize)
          Constructor with a size hint.
NSMutableArray(java.lang.Object anObject)
          Produces an array containing only the specified object.
NSMutableArray(java.lang.Object[] anArray)
          Produces an array containing the specified objects.
 
Method Summary
 void add(int index, java.lang.Object element)
           
 boolean add(java.lang.Object o)
           
 boolean addAll(java.util.Collection coll)
           
 boolean addAll(int index, java.util.Collection c)
           
 void addObject(java.lang.Object anObject)
          Adds the specified object to the end of this array.
 void addObjectsFromArray(java.util.Collection aCollection)
          Adds all objects in the specified collection.
 void clear()
           
 java.lang.Object clone()
           
 NSArray immutableClone()
           
 void insertObjectAtIndex(java.lang.Object anObject, int anIndex)
          Inserts the specified object into this array at the specified index.
 java.util.Iterator iterator()
           
 java.util.ListIterator listIterator()
           
 java.util.ListIterator listIterator(int index)
           
static NSMutableArray mutableArrayBackedByList(java.util.List aList)
          Returns an NSArray backed by the specified List.
 NSMutableArray mutableClone()
           
 java.lang.Object remove(int index)
           
 boolean remove(java.lang.Object o)
           
 boolean removeAll(java.util.Collection coll)
           
 void removeAllObjects()
          Removes all objects from the array.
 void removeIdenticalObject(java.lang.Object anObject)
          Removes all occurences of the specified object, comparing by reference.
 void removeIdenticalObject(java.lang.Object anObject, NSRange aRange)
          Removes all instances of the specified object within the range of specified indices, comparing by reference.
 void removeLastObject()
          Removes the last object from the array.
 void removeObject(java.lang.Object anObject)
          Removes all objects equivalent to the specified object.
 void removeObject(java.lang.Object anObject, NSRange aRange)
          Removes all objects equivalent to the specified object within the range of specified indices.
 void removeObjectAtIndex(int index)
          Removes the object at the specified index.
 void removeObjectsInArray(java.util.Collection aCollection)
          Removes all objects in the specified collection from the array.
 void removeObjectsInRange(NSRange aRange)
          Removes all objects in the indices within the specified range from the array.
 void replaceObjectAtIndex(int anIndex, java.lang.Object anObject)
          Replaces the object at the specified index with the specified object.
 void replaceObjectsInRange(NSRange currentRange, java.util.List otherArray, NSRange otherRange)
          Replaces objects in the current range with objects from the specified range of the specified array.
 boolean retainAll(java.util.Collection coll)
           
 java.lang.Object set(int index, java.lang.Object element)
           
 void setArray(java.util.Collection aCollection)
          Clears the current array and then populates it with the contents of the specified collection.
 void sortUsingSelector(NSSelector aSelector)
          Sorts this array using the values from the specified selector.
 java.util.List subList(int fromIndex, int toIndex)
           
 
Methods inherited from class net.wotonomy.foundation.NSArray
arrayBackedByList, arrayByAddingObject, arrayByAddingObjectsFromArray, componentsJoinedByString, componentsSeparatedByString, contains, containsAll, containsObject, count, equals, firstObjectCommonWithArray, get, getObjects, getObjects, hashCode, indexOf, indexOfIdenticalObject, indexOfIdenticalObject, indexOfObject, indexOfObject, isEmpty, isEqualToArray, lastIndexOf, lastObject, objectAtIndex, objectEnumerator, protectedAdd, protectedAddAll, reverseObjectEnumerator, size, subarrayWithRange, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NSMutableArray

public NSMutableArray()
Default constructor returns an empty array.


NSMutableArray

public NSMutableArray(int aSize)
Constructor with a size hint.


NSMutableArray

public NSMutableArray(java.lang.Object anObject)
Produces an array containing only the specified object.


NSMutableArray

public NSMutableArray(java.lang.Object[] anArray)
Produces an array containing the specified objects.


NSMutableArray

public NSMutableArray(java.util.Collection aCollection)
Produces an array containing the objects in the specified collection.

Method Detail

mutableArrayBackedByList

public static NSMutableArray mutableArrayBackedByList(java.util.List aList)
Returns an NSArray backed by the specified List. This is useful to "protect" an internal representation that is returned by a method of return type NSArray.


removeLastObject

public void removeLastObject()
Removes the last object from the array.


removeObjectAtIndex

public void removeObjectAtIndex(int index)
Removes the object at the specified index.


addObjectsFromArray

public void addObjectsFromArray(java.util.Collection aCollection)
Adds all objects in the specified collection.


removeAllObjects

public void removeAllObjects()
Removes all objects from the array.


removeObject

public void removeObject(java.lang.Object anObject,
                         NSRange aRange)
Removes all objects equivalent to the specified object within the range of specified indices.


removeIdenticalObject

public void removeIdenticalObject(java.lang.Object anObject,
                                  NSRange aRange)
Removes all instances of the specified object within the range of specified indices, comparing by reference.


removeObjectsInArray

public void removeObjectsInArray(java.util.Collection aCollection)
Removes all objects in the specified collection from the array.


removeObjectsInRange

public void removeObjectsInRange(NSRange aRange)
Removes all objects in the indices within the specified range from the array.


replaceObjectsInRange

public void replaceObjectsInRange(NSRange currentRange,
                                  java.util.List otherArray,
                                  NSRange otherRange)
Replaces objects in the current range with objects from the specified range of the specified array. If currentRange is larger than otherRange, the extra objects are removed. If otherRange is larger than currentRange, the extra objects are added.


setArray

public void setArray(java.util.Collection aCollection)
Clears the current array and then populates it with the contents of the specified collection.


sortUsingSelector

public void sortUsingSelector(NSSelector aSelector)
Sorts this array using the values from the specified selector.


removeObject

public void removeObject(java.lang.Object anObject)
Removes all objects equivalent to the specified object.


removeIdenticalObject

public void removeIdenticalObject(java.lang.Object anObject)
Removes all occurences of the specified object, comparing by reference.


insertObjectAtIndex

public void insertObjectAtIndex(java.lang.Object anObject,
                                int anIndex)
Inserts the specified object into this array at the specified index.


replaceObjectAtIndex

public void replaceObjectAtIndex(int anIndex,
                                 java.lang.Object anObject)
Replaces the object at the specified index with the specified object.


addObject

public void addObject(java.lang.Object anObject)
Adds the specified object to the end of this array.


clone

public java.lang.Object clone()
Overrides:
clone in class NSArray

immutableClone

public NSArray immutableClone()
Overrides:
immutableClone in class NSArray

mutableClone

public NSMutableArray mutableClone()
Overrides:
mutableClone in class NSArray

add

public void add(int index,
                java.lang.Object element)
Specified by:
add in interface java.util.List
Overrides:
add in class NSArray

add

public boolean add(java.lang.Object o)
Specified by:
add in interface java.util.Collection
Specified by:
add in interface java.util.List
Overrides:
add in class NSArray

addAll

public boolean addAll(java.util.Collection coll)
Specified by:
addAll in interface java.util.Collection
Specified by:
addAll in interface java.util.List
Overrides:
addAll in class NSArray

addAll

public boolean addAll(int index,
                      java.util.Collection c)
Specified by:
addAll in interface java.util.List
Overrides:
addAll in class NSArray

clear

public void clear()
Specified by:
clear in interface java.util.Collection
Specified by:
clear in interface java.util.List
Overrides:
clear in class NSArray

iterator

public java.util.Iterator iterator()
Specified by:
iterator in interface java.lang.Iterable
Specified by:
iterator in interface java.util.Collection
Specified by:
iterator in interface java.util.List
Overrides:
iterator in class NSArray

listIterator

public java.util.ListIterator listIterator()
Specified by:
listIterator in interface java.util.List
Overrides:
listIterator in class NSArray

listIterator

public java.util.ListIterator listIterator(int index)
Specified by:
listIterator in interface java.util.List
Overrides:
listIterator in class NSArray

remove

public java.lang.Object remove(int index)
Specified by:
remove in interface java.util.List
Overrides:
remove in class NSArray

remove

public boolean remove(java.lang.Object o)
Specified by:
remove in interface java.util.Collection
Specified by:
remove in interface java.util.List
Overrides:
remove in class NSArray

removeAll

public boolean removeAll(java.util.Collection coll)
Specified by:
removeAll in interface java.util.Collection
Specified by:
removeAll in interface java.util.List
Overrides:
removeAll in class NSArray

retainAll

public boolean retainAll(java.util.Collection coll)
Specified by:
retainAll in interface java.util.Collection
Specified by:
retainAll in interface java.util.List
Overrides:
retainAll in class NSArray

set

public java.lang.Object set(int index,
                            java.lang.Object element)
Specified by:
set in interface java.util.List
Overrides:
set in class NSArray

subList

public java.util.List subList(int fromIndex,
                              int toIndex)
Specified by:
subList in interface java.util.List
Overrides:
subList in class NSArray


Copyright © 2006 null. All Rights Reserved.