Project Wonder 5.0

com.webobjects.foundation
Class NSArray<E>

java.lang.Object
  extended by com.webobjects.foundation.NSArray<E>
All Implemented Interfaces:
_NSFoundationCollection, NSCoding, NSKeyValueCoding, NSKeyValueCodingAdditions, Serializable, Cloneable, Iterable<E>, Collection<E>, List<E>
Direct Known Subclasses:
_EOCheapCopyArray, ERXEnterpriseObjectArrayCache.NotFoundArray, ERXFaultArray, NSMutableArray

public class NSArray<E>
extends Object
implements Cloneable, Serializable, NSCoding, NSKeyValueCoding, NSKeyValueCodingAdditions, _NSFoundationCollection, List<E>

NSArray re-implementation to support JDK 1.5 templates. Use with

 NSArray<Bug> bugs = ds.fetchObjects();
 
 for(Bug : bugs) {
          ...
 }

See Also:
Serialized Form

Nested Class Summary
static class NSArray._AvgNumberOperator
           
static class NSArray._CountOperator
           
static class NSArray._MaxOperator
           
static class NSArray._MinOperator
           
static class NSArray._Operator
           
static class NSArray._SumNumberOperator
           
static interface 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
static Class _CLASS
           
protected  int _hashCache
           
protected static int _NSArrayClassHashCode
           
protected  Object[] _objects
           
static String AverageOperatorName
           
static boolean CheckForNull
           
static String CountOperatorName
           
static NSArray EmptyArray
           
static boolean IgnoreNull
           
static String MaximumOperatorName
           
static String MinimumOperatorName
           
static int NotFound
           
static String SumOperatorName
           
 
Fields inherited from interface com.webobjects.foundation.NSKeyValueCodingAdditions
_KeyPathSeparatorChar, KeyPathSeparator
 
Fields inherited from interface com.webobjects.foundation.NSKeyValueCoding
NullValue
 
Constructor Summary
  NSArray()
           
  NSArray(Collection<? extends E> collection)
           
  NSArray(Collection<? extends E> collection, boolean checkForNull)
           
  NSArray(E object)
           
  NSArray(E[] objects)
           
  NSArray(E[] objects, NSRange range)
           
  NSArray(E object, E... objects)
           
  NSArray(List<? extends E> list, boolean checkForNull)
           
  NSArray(List<? extends E> list, NSRange range, boolean ignoreNull)
           
  NSArray(NSArray<? extends E> otherArray)
           
protected NSArray(Object[] objects, int rangeLocation, int rangeLength, boolean checkForNull, boolean ignoreNull)
           
  NSArray(Vector<? extends E> vector, NSRange range, boolean ignoreNull)
           
 
Method Summary
protected  void _initializeWithCapacity(int capacity)
           
protected  boolean _mustRecomputeHash()
           
static NSMutableArray<String> _mutableComponentsSeparatedByString(String string, String separator)
           
protected  Object[] _objects()
           
protected  void _setCount(int count)
           
protected  void _setMustRecomputeHash(boolean change)
           
protected  void _setObjects(Object[] objects)
           
 int _shallowHashCode()
           
 boolean add(E element)
           
 void add(int index, E element)
           
 boolean addAll(Collection<? extends E> collection)
           
 boolean addAll(int index, Collection<? extends E> collection)
           
 NSArray<E> arrayByAddingObject(E object)
           
 NSArray<E> arrayByAddingObjectsFromArray(NSArray<? extends E> otherArray)
           
 ArrayList<E> arrayList()
           
 Class classForCoder()
           
 void clear()
           
 Object clone()
           
 String componentsJoinedByString(String separator)
           
static NSArray<String> componentsSeparatedByString(String string, String separator)
           
 boolean contains(Object element)
           
 boolean containsAll(Collection<?> c)
           
 boolean containsObject(Object object)
           
 int count()
           
static Object decodeObject(NSCoder coder)
           
static
<T> NSArray<T>
emptyArray()
           
 void encodeWithCoder(NSCoder coder)
           
 boolean equals(Object object)
           
 E firstObjectCommonWithArray(NSArray<?> otherArray)
           
 E get(int index)
           
 void getObjects(Object[] objects)
          Deprecated. Method getObjects is deprecated
 void getObjects(Object[] objects, NSRange range)
          Deprecated. Method getObjects is deprecated
 int hashCode()
           
 NSArray<E> immutableClone()
           
 int indexOf(Object element)
           
 int indexOfIdenticalObject(Object object)
           
 int indexOfIdenticalObject(Object object, NSRange range)
           
 int indexOfObject(Object object)
           
 int indexOfObject(Object object, NSRange range)
           
 boolean isEmpty()
           
 boolean isEqualToArray(NSArray<?> otherArray)
           
 Iterator<E> iterator()
           
 int lastIndexOf(Object element)
           
 E lastObject()
           
 ListIterator<E> listIterator()
           
 ListIterator<E> listIterator(int index)
           
 void makeObjectsPerformSelector(NSSelector selector, Object... parameters)
           
 NSMutableArray<E> mutableClone()
           
 E objectAtIndex(int index)
           
 Enumeration<E> objectEnumerator()
           
 Object[] objects()
           
 Object[] objects(NSRange range)
           
protected  Object[] objectsNoCopy()
           
static NSArray.Operator operatorForKey(String operatorName)
           
static NSArray<String> operatorNames()
           
 E remove(int index)
           
 boolean remove(Object object)
           
 boolean removeAll(Collection<?> collection)
           
static void removeOperatorForKey(String operatorName)
           
 boolean retainAll(Collection<?> collection)
           
 Enumeration<E> reverseObjectEnumerator()
           
 E set(int index, E element)
           
static void setOperatorForKey(String operatorName, NSArray.Operator arrayOperator)
           
 int size()
           
 NSArray<E> sortedArrayUsingComparator(NSComparator comparator)
           
 NSArray sortedArrayUsingSelector(NSSelector selector)
          Deprecated. Method sortedArrayUsingSelector is deprecated
 NSArray<E> subarrayWithRange(NSRange range)
           
 List<E> subList(int fromIndex, int toIndex)
           
 void takeValueForKey(Object value, String key)
           
 void takeValueForKeyPath(Object value, String keyPath)
           
 Object[] toArray()
           
<T> T[]
toArray(T[] objects)
           
 String toString()
           
 Object valueForKey(String key)
           
 Object valueForKeyPath(String keyPath)
           
 Vector<E> vector()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_CLASS

public static final Class _CLASS

NotFound

public static final int NotFound
See Also:
Constant Field Values

EmptyArray

public static final NSArray EmptyArray

CountOperatorName

public static final String CountOperatorName
See Also:
Constant Field Values

MaximumOperatorName

public static final String MaximumOperatorName
See Also:
Constant Field Values

MinimumOperatorName

public static final String MinimumOperatorName
See Also:
Constant Field Values

SumOperatorName

public static final String SumOperatorName
See Also:
Constant Field Values

AverageOperatorName

public static final String AverageOperatorName
See Also:
Constant Field Values

_NSArrayClassHashCode

protected static final int _NSArrayClassHashCode

_objects

protected Object[] _objects

_hashCache

protected transient int _hashCache

CheckForNull

public static final boolean CheckForNull
See Also:
Constant Field Values

IgnoreNull

public static final boolean IgnoreNull
See Also:
Constant Field Values
Constructor Detail

NSArray

public NSArray()

NSArray

public NSArray(E object)

NSArray

protected NSArray(Object[] objects,
                  int rangeLocation,
                  int rangeLength,
                  boolean checkForNull,
                  boolean ignoreNull)

NSArray

public NSArray(E[] objects)

NSArray

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

NSArray

public NSArray(E[] objects,
               NSRange range)

NSArray

public NSArray(NSArray<? extends E> otherArray)

NSArray

public NSArray(List<? extends E> list,
               boolean checkForNull)

NSArray

public NSArray(Collection<? extends E> collection,
               boolean checkForNull)

NSArray

public NSArray(Collection<? extends E> collection)

NSArray

public NSArray(List<? extends E> list,
               NSRange range,
               boolean ignoreNull)

NSArray

public NSArray(Vector<? extends E> vector,
               NSRange range,
               boolean ignoreNull)
Method Detail

operatorNames

public static NSArray<String> operatorNames()

setOperatorForKey

public static void setOperatorForKey(String operatorName,
                                     NSArray.Operator arrayOperator)

operatorForKey

public static NSArray.Operator operatorForKey(String operatorName)

removeOperatorForKey

public static void removeOperatorForKey(String operatorName)

_initializeWithCapacity

protected void _initializeWithCapacity(int capacity)

_setCount

protected void _setCount(int count)

_objects

protected Object[] _objects()

_setObjects

protected void _setObjects(Object[] objects)

objectsNoCopy

protected Object[] objectsNoCopy()

count

public int count()

objectAtIndex

public E objectAtIndex(int index)

arrayByAddingObject

public NSArray<E> arrayByAddingObject(E object)

arrayByAddingObjectsFromArray

public NSArray<E> arrayByAddingObjectsFromArray(NSArray<? extends E> otherArray)

objects

public Object[] objects()

objects

public Object[] objects(NSRange range)

vector

public Vector<E> vector()

arrayList

public ArrayList<E> arrayList()

containsObject

public boolean containsObject(Object object)

firstObjectCommonWithArray

public E firstObjectCommonWithArray(NSArray<?> otherArray)

getObjects

@Deprecated
public void getObjects(Object[] objects)
Deprecated. Method getObjects is deprecated


getObjects

@Deprecated
public void getObjects(Object[] objects,
                                  NSRange range)
Deprecated. Method getObjects is deprecated


indexOfObject

public int indexOfObject(Object object)

indexOfObject

public int indexOfObject(Object object,
                         NSRange range)

indexOfIdenticalObject

public int indexOfIdenticalObject(Object object)

indexOfIdenticalObject

public int indexOfIdenticalObject(Object object,
                                  NSRange range)

subarrayWithRange

public NSArray<E> subarrayWithRange(NSRange range)

lastObject

public E lastObject()

isEqualToArray

public boolean isEqualToArray(NSArray<?> otherArray)

equals

public boolean equals(Object object)
Specified by:
equals in interface Collection<E>
Specified by:
equals in interface List<E>
Overrides:
equals in class Object

objectEnumerator

public Enumeration<E> objectEnumerator()

reverseObjectEnumerator

public Enumeration<E> reverseObjectEnumerator()

sortedArrayUsingSelector

@Deprecated
public NSArray sortedArrayUsingSelector(NSSelector selector)
                                 throws NSComparator.ComparisonException
Deprecated. Method sortedArrayUsingSelector is deprecated

Throws:
NSComparator.ComparisonException

sortedArrayUsingComparator

public NSArray<E> sortedArrayUsingComparator(NSComparator comparator)
                                      throws NSComparator.ComparisonException
Throws:
NSComparator.ComparisonException

componentsJoinedByString

public String componentsJoinedByString(String separator)

componentsSeparatedByString

public static NSArray<String> componentsSeparatedByString(String string,
                                                          String separator)

_mutableComponentsSeparatedByString

public static NSMutableArray<String> _mutableComponentsSeparatedByString(String string,
                                                                         String separator)

valueForKey

public Object valueForKey(String key)
Specified by:
valueForKey in interface NSKeyValueCoding

takeValueForKey

public void takeValueForKey(Object value,
                            String key)
Specified by:
takeValueForKey in interface NSKeyValueCoding

valueForKeyPath

public Object valueForKeyPath(String keyPath)
Specified by:
valueForKeyPath in interface NSKeyValueCodingAdditions

takeValueForKeyPath

public void takeValueForKeyPath(Object value,
                                String keyPath)
Specified by:
takeValueForKeyPath in interface NSKeyValueCodingAdditions

classForCoder

public Class classForCoder()
Specified by:
classForCoder in interface NSCoding

decodeObject

public static Object decodeObject(NSCoder coder)

encodeWithCoder

public void encodeWithCoder(NSCoder coder)
Specified by:
encodeWithCoder in interface NSCoding

makeObjectsPerformSelector

public void makeObjectsPerformSelector(NSSelector selector,
                                       Object... parameters)

_shallowHashCode

public int _shallowHashCode()
Specified by:
_shallowHashCode in interface _NSFoundationCollection

hashCode

public int hashCode()
Specified by:
hashCode in interface Collection<E>
Specified by:
hashCode in interface List<E>
Overrides:
hashCode in class Object

clone

public Object clone()
Overrides:
clone in class Object

immutableClone

public NSArray<E> immutableClone()

mutableClone

public NSMutableArray<E> mutableClone()

toString

public String toString()
Overrides:
toString in class Object

_mustRecomputeHash

protected boolean _mustRecomputeHash()

_setMustRecomputeHash

protected void _setMustRecomputeHash(boolean change)

add

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

add

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

addAll

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

addAll

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

contains

public boolean contains(Object element)
Specified by:
contains in interface Collection<E>
Specified by:
contains in interface List<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>

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection<E>
Specified by:
toArray in interface List<E>

toArray

public <T> T[] toArray(T[] objects)
Specified by:
toArray in interface Collection<E>
Specified by:
toArray in interface List<E>

containsAll

public boolean containsAll(Collection<?> c)
Specified by:
containsAll in interface Collection<E>
Specified by:
containsAll in interface List<E>

listIterator

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

listIterator

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

get

public E get(int index)
Specified by:
get in interface List<E>

set

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

indexOf

public int indexOf(Object element)
Specified by:
indexOf in interface List<E>

lastIndexOf

public int lastIndexOf(Object element)
Specified by:
lastIndexOf in interface List<E>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection<E>
Specified by:
isEmpty in interface List<E>

size

public int size()
Specified by:
size in interface Collection<E>
Specified by:
size in interface List<E>

remove

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

remove

public boolean remove(Object object)
Specified by:
remove in interface Collection<E>
Specified by:
remove in interface List<E>

clear

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

retainAll

public boolean retainAll(Collection<?> collection)
Specified by:
retainAll in interface Collection<E>
Specified by:
retainAll in interface List<E>

removeAll

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

subList

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

emptyArray

public static final <T> NSArray<T> emptyArray()

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

Copyright © 2002 – 2011 Project Wonder.