wt.fc.collections
Class WTArrayList

java.lang.Object
  extended byjava.util.AbstractCollection
      extended bywt.fc.collections.AbstractWTCollection
          extended bywt.fc.collections.AbstractWTList
              extended bywt.fc.collections.WTArrayList
All Implemented Interfaces:
Cloneable, Collection, Externalizable, List, ReferenceBased, ResultProcessor, Serializable, WTCollection, WTList

public class WTArrayList
extends AbstractWTList
implements Cloneable, ResultProcessor, Externalizable

An array-based implementation of WTArrayList

WTArrayList implements wt.fc.ResultProcessor to provide better integration with the persistence layer. By implementing ResultProcessor, the default collections can be used in place of a QueryResult when retrieving data. The APIs to accomplish this are:

 PersistenceManager.find(StatementSpec, ResultProcessor)
 PersisenceManagerSvr.query(StatementSpec, ResultProcessor)
 

In addition to a no-arg clone method, WTArrayList provides a "deep" clone in which the references are copied and the Persistables in the set are cloned using PersistenceCloner.

A WTArrayList can be constructed with a key mask. The default key mask is CollectionsHelper.OBJECT_IDENTIFIER.

Supported API: true

Extendable: false

See Also:
Serialized Form

Nested Class Summary
(package private) static class WTArrayList.FilteredList
           
(package private) static class WTArrayList.OffSetList
           
 
Nested classes inherited from class wt.fc.collections.AbstractWTList
 
Nested classes inherited from class wt.fc.collections.AbstractWTCollection
AbstractWTCollection.PersistableCollection
 
Field Summary
private static String CLASSNAME
           
private  boolean deflatedOnSerialization
           
static long EXTERNALIZATION_VERSION_UID
           
(package private)  int keyMask
           
protected static long OLD_FORMAT_VERSION_UID
           
(package private)  ReferenceMap.ReferenceList referenceList
           
(package private)  ReferenceMap referenceMap
           
private static String RESOURCE
           
(package private) static long serialVersionUID
           
 
Fields inherited from class wt.fc.collections.AbstractWTList
 
Fields inherited from class wt.fc.collections.AbstractWTCollection
 
Fields inherited from interface wt.fc.collections.WTCollection
DEFLATED_ON_SERIALIZATION
 
Constructor Summary
WTArrayList()
          

Supported API: true
WTArrayList(Collection c)
          

Supported API: true
WTArrayList(Collection c, int key_mask)
          

Supported API: true
WTArrayList(int initial_capacity)
          

Supported API: true
WTArrayList(int initial_capacity, int key_mask)
          

Supported API: true
 
Method Summary
 void add(int index, WTReference ref)
          

Supported API: false
 void addElement(Object anObj)
          Add the specified object to the result processor, and increase the size by one

Supported API: false
 Iterator classIterator()
          

Supported API: false
 void clear()
          

Supported API: false
 Object clone()
          

Supported API: true
 WTArrayList clone(boolean deep)
          

Supported API: true
 int getKeyMask()
          

Supported API: false
(package private)  int getModCount()
           
 Persistable getPersistable(int index)
          

Supported API: false
 QueryKey getQueryKey(int index)
          

Supported API: false
 WTReference getReference(int index)
          

Supported API: false
(package private)  List getReferences()
           
 boolean isDeflatedOnSerialization()
          Gets the value of the attribute: deflatedOnSerialization.
 Iterator persistableIterator()
          Returns an iterator over the objects in this collection, as Persistables.
 Iterator persistableIterator(Class filter, boolean include_subclasses)
          

Supported API: false
 ListIterator persistableListIterator(int index)
          

Supported API: false
 Iterator queryKeyIterator()
          Returns an iterator over the QueryKeys in this collection.
 Iterator queryKeyIterator(Class filter, boolean include_subclasses)
          

Supported API: false
 ListIterator queryKeyListIterator(int index)
          

Supported API: false
 void readExternal(ObjectInput input)
          Reads the non-transient fields of this class from an external source.
private  boolean readOldVersion(ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source, which is not the current version.
protected  boolean readVersion(WTArrayList thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source.
 Iterator referenceIterator()
          Returns an Iterator over the objects in this collection, as WTReferences.
 Iterator referenceIterator(Class filter, boolean include_subclasses)
          

Supported API: false
 ListIterator referenceListIterator(int index)
          

Supported API: false
 WTReference set(int index, WTReference ref)
          

Supported API: false
 void setDeflatedOnSerialization(boolean a_DeflatedOnSerialization)
          Sets the value of the attribute: deflatedOnSerialization.
 int size()
          Return the number of objects which have been added by the result processor

Supported API: false
 WTCollection subCollection(Class filter, boolean include_subclasses)
          

Supported API: false
 List subList(int from_index, int to_index)
          

Supported API: false
 void writeExternal(ObjectOutput output)
          Writes the non-transient fields of this class to an external source.
 
Methods inherited from class wt.fc.collections.AbstractWTList
add, add, add, add, add, add, addAll, addAll, connect, connect, connect, connect, connectAll, equals, get, indexOf, indexOf, indexOf, indexOf, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf, listIterator, listIterator, persistableListIterator, queryKeyListIterator, referenceListIterator, remove, set, set, set
 
Methods inherited from class wt.fc.collections.AbstractWTCollection
add, addAll, connect, connect, connect, connect, connect, connect, connectAll, connectAll, contains, contains, contains, contains, containsInstance, containsNonPersisted, containsOnly, deflate, getIteratorListener, getLastReturnedReference, getReference, getReference, getReference, getReferences, hashCode, inflate, isEnabled, iterator, persistableCollection, referenceAdded, referenceRemoved, remove, remove, remove, remove, removeAll, removeNonPersisted, retainAll, setLastReturnedReference, subCollection, toArray, toArray, toArray, toArray, toArray, toArray, toIdArray
 
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface wt.fc.collections.WTList
connect, connect, connect
 
Methods inherited from interface wt.fc.collections.WTCollection
add, addAll, connect, connect, connect, connectAll, connectAll, contains, contains, contains, contains, containsInstance, containsOnly, deflate, inflate, isEnabled, iterator, persistableCollection, remove, remove, remove, remove, removeAll, retainAll, subCollection, toArray, toArray, toArray, toArray, toArray, toArray, toIdArray
 
Methods inherited from interface java.util.Collection
containsAll, hashCode, isEmpty, removeAll, retainAll
 
Methods inherited from interface java.util.List
add, contains, containsAll, hashCode, isEmpty, iterator, remove, removeAll, retainAll, toArray, toArray
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

deflatedOnSerialization

private transient boolean deflatedOnSerialization

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

EXTERNALIZATION_VERSION_UID

public static final long EXTERNALIZATION_VERSION_UID
See Also:
Constant Field Values

OLD_FORMAT_VERSION_UID

protected static final long OLD_FORMAT_VERSION_UID
See Also:
Constant Field Values

keyMask

int keyMask

referenceMap

transient ReferenceMap referenceMap

referenceList

transient ReferenceMap.ReferenceList referenceList
Constructor Detail

WTArrayList

public WTArrayList()


Supported API: true


WTArrayList

public WTArrayList(int initial_capacity)


Supported API: true

Parameters:
initial_capacity -

WTArrayList

public WTArrayList(int initial_capacity,
                   int key_mask)


Supported API: true

Parameters:
initial_capacity -
key_mask -

WTArrayList

public WTArrayList(Collection c)


Supported API: true

Parameters:
c -

WTArrayList

public WTArrayList(Collection c,
                   int key_mask)


Supported API: true

Parameters:
c -
key_mask -
Method Detail

writeExternal

public void writeExternal(ObjectOutput output)
                   throws IOException
Writes the non-transient fields of this class to an external source.

Supported API: false

Specified by:
writeExternal in interface Externalizable
Parameters:
output -
Throws:
IOException

readExternal

public void readExternal(ObjectInput input)
                  throws IOException,
                         ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Specified by:
readExternal in interface Externalizable
Parameters:
input -
Throws:
IOException
ClassNotFoundException

readVersion

protected boolean readVersion(WTArrayList thisObject,
                              ObjectInput input,
                              long readSerialVersionUID,
                              boolean passThrough,
                              boolean superDone)
                       throws IOException,
                              ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Parameters:
thisObject -
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

readOldVersion

private boolean readOldVersion(ObjectInput input,
                               long readSerialVersionUID,
                               boolean passThrough,
                               boolean superDone)
                        throws IOException,
                               ClassNotFoundException
Reads the non-transient fields of this class from an external source, which is not the current version.

Parameters:
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

isDeflatedOnSerialization

public boolean isDeflatedOnSerialization()
Gets the value of the attribute: deflatedOnSerialization.

Supported API: false

Specified by:
isDeflatedOnSerialization in interface WTCollection
Overrides:
isDeflatedOnSerialization in class AbstractWTCollection
Returns:
boolean

setDeflatedOnSerialization

public void setDeflatedOnSerialization(boolean a_DeflatedOnSerialization)
                                throws WTPropertyVetoException
Sets the value of the attribute: deflatedOnSerialization.

Supported API: false

Specified by:
setDeflatedOnSerialization in interface WTCollection
Overrides:
setDeflatedOnSerialization in class AbstractWTCollection
Parameters:
a_DeflatedOnSerialization -
Throws:
WTPropertyVetoException

classIterator

public Iterator classIterator()


Supported API: false

Specified by:
classIterator in interface WTCollection
Specified by:
classIterator in class AbstractWTCollection
Returns:
Iterator

clear

public void clear()


Supported API: false

Specified by:
clear in interface Collection

clone

public Object clone()


Supported API: true

Returns:
Object

clone

public WTArrayList clone(boolean deep)


Supported API: true

Parameters:
deep -
Returns:
WTArrayList

getKeyMask

public int getKeyMask()


Supported API: false

Specified by:
getKeyMask in interface WTCollection
Specified by:
getKeyMask in class AbstractWTCollection
Returns:
int

getPersistable

public Persistable getPersistable(int index)
                           throws WTException


Supported API: false

Specified by:
getPersistable in interface WTList
Overrides:
getPersistable in class AbstractWTList
Parameters:
index -
Returns:
Persistable
Throws:
WTException

getQueryKey

public QueryKey getQueryKey(int index)


Supported API: false

Specified by:
getQueryKey in interface WTList
Overrides:
getQueryKey in class AbstractWTList
Parameters:
index -
Returns:
QueryKey

getReference

public WTReference getReference(int index)


Supported API: false

Specified by:
getReference in interface WTList
Overrides:
getReference in class AbstractWTList
Parameters:
index -
Returns:
WTReference

persistableIterator

public Iterator persistableIterator()
                             throws WTException
Returns an iterator over the objects in this collection, as Persistables. Inflates all the QueryKeys and references in this collection that don't have Persistables yet. Persistables that are already in the collection are not refreshed.

Supported API: true

Specified by:
persistableIterator in interface WTCollection
Specified by:
persistableIterator in class AbstractWTCollection
Returns:
An iterator of Persistables
Throws:
ConcurrentModificationException - If the collection is modified while the iterator is being processed.
WTException

persistableIterator

public Iterator persistableIterator(Class filter,
                                    boolean include_subclasses)
                             throws WTException


Supported API: false

Specified by:
persistableIterator in interface WTCollection
Specified by:
persistableIterator in class AbstractWTCollection
Parameters:
filter -
include_subclasses -
Returns:
Iterator
Throws:
WTException

persistableListIterator

public ListIterator persistableListIterator(int index)
                                     throws WTException


Supported API: false

Specified by:
persistableListIterator in interface WTList
Specified by:
persistableListIterator in class AbstractWTList
Parameters:
index -
Returns:
ListIterator
Throws:
WTException

queryKeyIterator

public Iterator queryKeyIterator()
Returns an iterator over the QueryKeys in this collection. These will typically be ObjectIdentifiers, but may be other QueryKey types depending on how the collection is constructed. Nonpersisted objects will not be included in the id iterator.

Supported API: true

Specified by:
queryKeyIterator in interface WTCollection
Specified by:
queryKeyIterator in class AbstractWTCollection
Returns:
An iterator of QueryKeys
Throws:
ConcurrentModificationException - If the collection is modified while the iterator is being processed.

queryKeyIterator

public Iterator queryKeyIterator(Class filter,
                                 boolean include_subclasses)


Supported API: false

Specified by:
queryKeyIterator in interface WTCollection
Specified by:
queryKeyIterator in class AbstractWTCollection
Parameters:
filter -
include_subclasses -
Returns:
Iterator

queryKeyListIterator

public ListIterator queryKeyListIterator(int index)


Supported API: false

Specified by:
queryKeyListIterator in interface WTList
Specified by:
queryKeyListIterator in class AbstractWTList
Parameters:
index -
Returns:
ListIterator

referenceIterator

public Iterator referenceIterator()
Returns an Iterator over the objects in this collection, as WTReferences. The precise subclass of WTReference is determined by the referenced class, and by this collection's key mask. The references in the iterator may or may not be inflated, depending upon how they were added to the collection and when the collection was last refreshed. Non-persisted objects will still have references in the iterator; they will have null keys.

Supported API: true

Specified by:
referenceIterator in interface WTCollection
Specified by:
referenceIterator in class AbstractWTCollection
Returns:
An iterator of WTReferences
Throws:
ConcurrentModificationException - If the collection is modified while the iterator is being processed.

referenceIterator

public Iterator referenceIterator(Class filter,
                                  boolean include_subclasses)


Supported API: false

Specified by:
referenceIterator in interface WTCollection
Specified by:
referenceIterator in class AbstractWTCollection
Parameters:
filter -
include_subclasses -
Returns:
Iterator

referenceListIterator

public ListIterator referenceListIterator(int index)


Supported API: false

Specified by:
referenceListIterator in interface WTList
Specified by:
referenceListIterator in class AbstractWTList
Parameters:
index -
Returns:
ListIterator

subCollection

public WTCollection subCollection(Class filter,
                                  boolean include_subclasses)


Supported API: false

Specified by:
subCollection in interface WTCollection
Specified by:
subCollection in class AbstractWTCollection
Parameters:
filter -
include_subclasses -
Returns:
WTCollection

subList

public List subList(int from_index,
                    int to_index)


Supported API: false

Specified by:
subList in interface WTList
Specified by:
subList in class AbstractWTList
Parameters:
from_index -
to_index -
Returns:
List

addElement

public void addElement(Object anObj)
Add the specified object to the result processor, and increase the size by one

Supported API: false

Specified by:
addElement in interface ResultProcessor
Parameters:
anObj -

size

public int size()
Return the number of objects which have been added by the result processor

Supported API: false

Specified by:
size in interface ResultProcessor
Returns:
int

add

public void add(int index,
                WTReference ref)
Description copied from class: AbstractWTList


Supported API: false

Specified by:
add in interface WTList
Overrides:
add in class AbstractWTList
Parameters:
index -
ref -

set

public WTReference set(int index,
                       WTReference ref)
Description copied from class: AbstractWTList


Supported API: false

Specified by:
set in interface WTList
Overrides:
set in class AbstractWTList
Parameters:
index -
ref -
Returns:
WTReference

getReferences

List getReferences()

getModCount

int getModCount()
Specified by:
getModCount in class AbstractWTList