Project Wonder 5.0

com.webobjects.foundation
Class NSMutableArray<E>

java.lang.Object
  extended by com.webobjects.foundation.NSArray<E>
      extended by com.webobjects.foundation.NSMutableArray<E>
All Implemented Interfaces:
_NSFoundationCollection, NSCoding, NSKeyValueCoding, NSKeyValueCodingAdditions, Serializable, Cloneable, Iterable<E>, Collection<E>, List<E>, RandomAccess
Direct Known Subclasses:
_EOCheapCopyMutableArray, ERXBatchingDisplayGroup.FakeArray, ERXMutableArray, ERXSortOrdering.ERXSortOrderings

public class NSMutableArray<E>
extends NSArray<E>
implements RandomAccess

Bugfix reimplementation of NSMutableArray. To be able to use this class, the framework this class resides in must be before JavaFoundation.framework in your classpath.
It fixes a lot of issues:

Once these issues are resolved in a WO distribution, this class will go away and the Apple supplied will will be used again without changes in code on your side.

See Also:
Serialized Form
Author:
ak

Nested Class Summary
 
Nested classes/interfaces inherited from class com.webobjects.foundation.NSArray
NSArray._AvgNumberOperator, NSArray._CountOperator, NSArray._MaxOperator, NSArray._MinOperator, NSArray._Operator, NSArray._SumNumberOperator, NSArray.Operator
 
Nested classes/interfaces inherited from interface com.webobjects.foundation.NSCoding
NSCoding._BigDecimalSupport, NSCoding._BigIntegerSupport, NSCoding._BooleanSupport, NSCoding._ByteSupport, NSCoding._CharacterSupport, NSCoding._DateSupport, NSCoding._DoubleSupport, NSCoding._FloatSupport, NSCoding._IntegerSupport, NSCoding._LongSupport, NSCoding._NumberSupport, NSCoding._ShortSupport, NSCoding._StringSupport, NSCoding.Support
 
Nested classes/interfaces inherited from interface com.webobjects.foundation.NSKeyValueCodingAdditions
NSKeyValueCodingAdditions.DefaultImplementation, NSKeyValueCodingAdditions.Utility
 
Nested classes/interfaces inherited from interface com.webobjects.foundation.NSKeyValueCoding
NSKeyValueCoding._BooleanFieldBinding, NSKeyValueCoding._BooleanMethodBinding, NSKeyValueCoding._FieldBinding, NSKeyValueCoding._ForwardingBinding, NSKeyValueCoding._KeyBinding, NSKeyValueCoding._KeyBindingCreation, NSKeyValueCoding._MethodBinding, NSKeyValueCoding._NumberFieldBinding, NSKeyValueCoding._NumberMethodBinding, NSKeyValueCoding._ReflectionKeyBindingCreation, NSKeyValueCoding.ErrorHandling, NSKeyValueCoding.MapImplementation, NSKeyValueCoding.Null<T>, NSKeyValueCoding.UnknownKeyException, NSKeyValueCoding.ValueAccessor
 
Field Summary
protected  int _capacity
           
static Class _CLASS
           
protected  int _count
           
protected  Object[] _objectsCache
           
static Object ERX_MARKER
           
protected  int modCount
           
 
Fields inherited from class com.webobjects.foundation.NSArray
_hashCache, _NSArrayClassHashCode, _objects, AverageOperatorName, CheckForNull, CountOperatorName, EmptyArray, IgnoreNull, MaximumOperatorName, MinimumOperatorName, NotFound, SumOperatorName
 
Fields inherited from interface com.webobjects.foundation.NSKeyValueCodingAdditions
_KeyPathSeparatorChar, KeyPathSeparator
 
Fields inherited from interface com.webobjects.foundation.NSKeyValueCoding
NullValue
 
Constructor Summary
NSMutableArray()
           
NSMutableArray(Collection<? extends E> collection)
           
NSMutableArray(E object)
           
NSMutableArray(E[] objects)
           
NSMutableArray(E[] objects, NSRange range)
           
NSMutableArray(E object, E... objects)
           
NSMutableArray(int capacity)
           
NSMutableArray(List<? extends E> list, NSRange range, boolean ignoreNull)
           
NSMutableArray(NSArray<? extends E> otherArray)
           
NSMutableArray(Vector<? extends E> vector, NSRange range, boolean ignoreNull)
           
 
Method Summary
protected  void _ensureCapacity(int capacity)
           
protected  void _initializeWithCapacity(int capacity)
           
 void _moveObjectAtIndexToIndex(int sourceIndex, int destIndex)
           
protected  void _setCount(int count)
           
 boolean add(E element)
           
 void add(int index, E element)
           
 boolean addAll(Collection<? extends E> collection)
           
 boolean addAll(int index, Collection<? extends E> collection)
           
 void addObject(E object)
           
 void addObjects(E... objects)
           
 void addObjectsFromArray(NSArray<? extends E> otherArray)
           
 void clear()
           
 Object clone()
           
 int count()
           
 void ensureCapacity(int capacity)
           
 NSArray<E> immutableClone()
           
 void insertObjectAtIndex(E object, int index)
           
 Iterator<E> iterator()
           
 ListIterator<E> listIterator()
           
 ListIterator<E> listIterator(int index)
           
 NSMutableArray<E> mutableClone()
           
protected  Object[] objectsNoCopy()
           
 E remove(int index)
           
 boolean remove(Object o)
           
 boolean removeAll(Collection<?> collection)
           
 void removeAllObjects()
           
 boolean removeIdenticalObject(Object object)
           
 boolean removeIdenticalObject(Object object, NSRange range)
           
 E removeLastObject()
           
 boolean removeObject(Object object)
           
 boolean removeObject(Object object, NSRange range)
           
 E removeObjectAtIndex(int index)
           
 void removeObjects(Object... otherObjects)
          Much faster implementation of the remove method for larger arrays.
 void removeObjectsInArray(NSArray<?> otherArray)
           
 void removeObjectsInRange(NSRange range)
           
protected  void removeRange(int fromIndex, int toIndex)
           
 E replaceObjectAtIndex(E object, int index)
          Clears the objectsNoCopy too.
 void replaceObjectAtIndex(int index, E object)
          Deprecated. Method replaceObjectAtIndex is deprecated
 void replaceObjectsInRange(NSRange range, NSArray<? extends E> otherArray, NSRange otherRange)
           
 boolean retainAll(Collection<?> c)
           
 E set(int index, E element)
           
 void setArray(NSArray<? extends E> otherArray)
           
 void sortUsingComparator(NSComparator comparator)
           
 List<E> subList(int fromIndex, int toIndex)
           
<T> T[]
toArray(T[] array)
          Bugfix for the broken implementation in NSArray.
 void trimToSize()
           
 
Methods inherited from class com.webobjects.foundation.NSArray
_mustRecomputeHash, _mutableComponentsSeparatedByString, _objects, _setMustRecomputeHash, _setObjects, _shallowHashCode, arrayByAddingObject, arrayByAddingObjectsFromArray, arrayList, classForCoder, componentsJoinedByString, componentsSeparatedByString, contains, containsAll, containsObject, decodeObject, emptyArray, encodeWithCoder, equals, firstObjectCommonWithArray, get, getObjects, getObjects, hashCode, indexOf, indexOfIdenticalObject, indexOfIdenticalObject, indexOfObject, indexOfObject, isEmpty, isEqualToArray, lastIndexOf, lastObject, makeObjectsPerformSelector, objectAtIndex, objectEnumerator, objects, objects, operatorForKey, operatorNames, removeOperatorForKey, reverseObjectEnumerator, setOperatorForKey, size, sortedArrayUsingComparator, sortedArrayUsingSelector, subarrayWithRange, takeValueForKey, takeValueForKeyPath, toArray, toString, valueForKey, valueForKeyPath, vector
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_CLASS

public static final Class _CLASS

ERX_MARKER

public static final Object ERX_MARKER

modCount

protected transient int modCount

_capacity

protected transient int _capacity

_objectsCache

protected transient Object[] _objectsCache

_count

protected transient int _count
Constructor Detail

NSMutableArray

public NSMutableArray()

NSMutableArray

public NSMutableArray(Collection<? extends E> collection)

NSMutableArray

public NSMutableArray(int capacity)

NSMutableArray

public NSMutableArray(E object)

NSMutableArray

public NSMutableArray(E[] objects)

NSMutableArray

public NSMutableArray(E object,
                      E... objects)

NSMutableArray

public NSMutableArray(E[] objects,
                      NSRange range)

NSMutableArray

public NSMutableArray(NSArray<? extends E> otherArray)

NSMutableArray

public NSMutableArray(Vector<? extends E> vector,
                      NSRange range,
                      boolean ignoreNull)

NSMutableArray

public NSMutableArray(List<? extends E> list,
                      NSRange range,
                      boolean ignoreNull)
Method Detail

_initializeWithCapacity

protected void _initializeWithCapacity(int capacity)
Overrides:
_initializeWithCapacity in class NSArray<E>

_ensureCapacity

protected void _ensureCapacity(int capacity)

ensureCapacity

public void ensureCapacity(int capacity)

trimToSize

public void trimToSize()

_setCount

protected void _setCount(int count)
Overrides:
_setCount in class NSArray<E>

setArray

public void setArray(NSArray<? extends E> otherArray)

objectsNoCopy

protected Object[] objectsNoCopy()
Overrides:
objectsNoCopy in class NSArray<E>

count

public int count()
Overrides:
count in class NSArray<E>

addObject

public void addObject(E object)

addObjects

public void addObjects(E... objects)

replaceObjectAtIndex

public void replaceObjectAtIndex(int index,
                                 E object)
Deprecated. Method replaceObjectAtIndex is deprecated


insertObjectAtIndex

public void insertObjectAtIndex(E object,
                                int index)

removeObjectAtIndex

public E removeObjectAtIndex(int index)

removeAllObjects

public void removeAllObjects()

sortUsingComparator

public void sortUsingComparator(NSComparator comparator)
                         throws NSComparator.ComparisonException
Throws:
NSComparator.ComparisonException

addObjectsFromArray

public void addObjectsFromArray(NSArray<? extends E> otherArray)

replaceObjectsInRange

public void replaceObjectsInRange(NSRange range,
                                  NSArray<? extends E> otherArray,
                                  NSRange otherRange)

removeLastObject

public E removeLastObject()

removeObject

public boolean removeObject(Object object)

removeObject

public boolean removeObject(Object object,
                            NSRange range)

removeIdenticalObject

public boolean removeIdenticalObject(Object object)

removeIdenticalObject

public boolean removeIdenticalObject(Object object,
                                     NSRange range)

removeObjectsInArray

public void removeObjectsInArray(NSArray<?> otherArray)

removeObjectsInRange

public void removeObjectsInRange(NSRange range)

clone

public Object clone()
Overrides:
clone in class NSArray<E>

immutableClone

public NSArray<E> immutableClone()
Overrides:
immutableClone in class NSArray<E>

mutableClone

public NSMutableArray<E> mutableClone()
Overrides:
mutableClone in class NSArray<E>

_moveObjectAtIndexToIndex

public void _moveObjectAtIndexToIndex(int sourceIndex,
                                      int destIndex)

replaceObjectAtIndex

public E replaceObjectAtIndex(E object,
                              int index)
Clears the objectsNoCopy too. It's wrong not to clear it.


removeObjects

public void removeObjects(Object... otherObjects)
Much faster implementation of the remove method for larger arrays.


toArray

public <T> T[] toArray(T[] array)
Bugfix for the broken implementation in NSArray.

Specified by:
toArray in interface Collection<E>
Specified by:
toArray in interface List<E>
Overrides:
toArray in class NSArray<E>

set

public E set(int index,
             E element)
Specified by:
set in interface List<E>
Overrides:
set in class NSArray<E>

add

public void add(int index,
                E element)
Specified by:
add in interface List<E>
Overrides:
add in class NSArray<E>

add

public boolean add(E element)
Specified by:
add in interface Collection<E>
Specified by:
add in interface List<E>
Overrides:
add in class NSArray<E>

addAll

public boolean addAll(Collection<? extends E> collection)
Specified by:
addAll in interface Collection<E>
Specified by:
addAll in interface List<E>
Overrides:
addAll in class NSArray<E>

addAll

public boolean addAll(int index,
                      Collection<? extends E> collection)
Specified by:
addAll in interface List<E>
Overrides:
addAll in class NSArray<E>

remove

public E remove(int index)
Specified by:
remove in interface List<E>
Overrides:
remove in class NSArray<E>

remove

public boolean remove(Object o)
Specified by:
remove in interface Collection<E>
Specified by:
remove in interface List<E>
Overrides:
remove in class NSArray<E>

clear

public void clear()
Specified by:
clear in interface Collection<E>
Specified by:
clear in interface List<E>
Overrides:
clear in class NSArray<E>

retainAll

public boolean retainAll(Collection<?> c)
Specified by:
retainAll in interface Collection<E>
Specified by:
retainAll in interface List<E>
Overrides:
retainAll in class NSArray<E>

removeAll

public boolean removeAll(Collection<?> collection)
Specified by:
removeAll in interface Collection<E>
Specified by:
removeAll in interface List<E>
Overrides:
removeAll in class NSArray<E>

iterator

public Iterator<E> iterator()
Specified by:
iterator in interface Iterable<E>
Specified by:
iterator in interface Collection<E>
Specified by:
iterator in interface List<E>
Overrides:
iterator in class NSArray<E>

listIterator

public ListIterator<E> listIterator()
Specified by:
listIterator in interface List<E>
Overrides:
listIterator in class NSArray<E>

listIterator

public ListIterator<E> listIterator(int index)
Specified by:
listIterator in interface List<E>
Overrides:
listIterator in class NSArray<E>

subList

public List<E> subList(int fromIndex,
                       int toIndex)
Specified by:
subList in interface List<E>
Overrides:
subList in class NSArray<E>

removeRange

protected void removeRange(int fromIndex,
                           int toIndex)

Last updated: Wed, Feb 22, 2012 • 07:00 AM EST

Copyright © 2002 – 2011 Project Wonder.