org.objectweb.speedo.query.lib
Class QueryResultList

java.lang.Object
  extended byorg.objectweb.speedo.query.lib.QueryResultCommon
      extended byorg.objectweb.speedo.query.lib.QueryResultList
All Implemented Interfaces:
java.util.Collection, java.util.List

public class QueryResultList
extends QueryResultCommon
implements java.util.List

is the result of a JDO query. The result is exported as a java.util.List. This implementation supports user class or persistent class as query result. This implementation does not supports simultaneous iterations.

Author:
S.Chassande-Barrioz

Field Summary
 
Fields inherited from class org.objectweb.speedo.query.lib.QueryResultCommon
conns, debug, logger, pm, tc
 
Constructor Summary
QueryResultList(org.objectweb.medor.tuple.api.TupleCollection _tc, javax.jdo.PersistenceManager _pm, java.lang.Object[] _conns, java.lang.Class _resultClazz, java.lang.Class[] _selectedFieldTypes, boolean staticFirstElementIndex, org.objectweb.util.monolog.api.Logger _logger)
          Builds a QueryResultList.
 
Method Summary
 void add(int index, java.lang.Object element)
           
 boolean add(java.lang.Object o)
          Ensures that this collection contains the specified element (optional operation).
 boolean addAll(java.util.Collection c)
          Adds all of the elements in the specified collection to this collection (optional operation).
 boolean addAll(int index, java.util.Collection c)
           
protected  boolean assertBeforeNext()
           
protected  boolean assertNotClosed()
           
 void clear()
          Removes all of the elements from this collection (optional operation).
 boolean contains(java.lang.Object o)
          Returns true if this collection contains the specified element.
 boolean containsAll(java.util.Collection c)
          Returns true if this collection contains all of the elements in the specified collection.
 boolean equals(java.lang.Object o)
          Compares the specified object with this collection for equality.
 java.lang.Object get(int index)
           
protected  java.util.List getList()
          Computes the query result.
 int hashCode()
          Returns the hash code value for this collection.
 int indexOf(java.lang.Object o)
           
 boolean isEmpty()
          Returns true if this collection contains no elements.
 java.util.Iterator iterator()
          Returns an iterator over the elements in this collection.
 int lastIndexOf(java.lang.Object o)
           
 java.util.ListIterator listIterator()
           
 java.util.ListIterator listIterator(int index)
           
 java.lang.Object remove(int index)
           
 boolean remove(java.lang.Object o)
          Removes a single instance of the specified element from this collection, if it is present (optional operation).
 boolean removeAll(java.util.Collection c)
          Removes all this collection's elements that are also contained in the specified collection (optional operation).
 boolean retainAll(java.util.Collection c)
          Retains only the elements in this collection that are contained in the specified collection (optional operation).
 java.lang.Object set(int index, java.lang.Object element)
           
 int size()
          Returns the number of elements in this collection.
 java.util.List subList(int fromIndex, int toIndex)
           
 java.lang.Object[] toArray()
          Returns an array containing all of the elements in this collection.
 java.lang.Object[] toArray(java.lang.Object[] a)
          Returns an array containing all of the elements in this collection whose runtime type is that of the specified array.
 
Methods inherited from class org.objectweb.speedo.query.lib.QueryResultCommon
close, closeConnection, getValue, pname2Object
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryResultList

public QueryResultList(org.objectweb.medor.tuple.api.TupleCollection _tc,
                       javax.jdo.PersistenceManager _pm,
                       java.lang.Object[] _conns,
                       java.lang.Class _resultClazz,
                       java.lang.Class[] _selectedFieldTypes,
                       boolean staticFirstElementIndex,
                       org.objectweb.util.monolog.api.Logger _logger)
                throws org.objectweb.medor.api.MedorException,
                       SpeedoException
Builds a QueryResultList.

Parameters:
_tc - the tuple collection representing the query result
_pm - is the peristence manager linked to the query
_conns - is the connection to the underlying support to close in same time than the query.
_resultClazz - is the class encapsulated the result
Method Detail

assertNotClosed

protected boolean assertNotClosed()
Returns:
true if the calculation of the next element can be done, otherwise false.

assertBeforeNext

protected boolean assertBeforeNext()
Returns:
true if the query has not been closed

getList

protected java.util.List getList()
Computes the query result.


add

public boolean add(java.lang.Object o)
Ensures that this collection contains the specified element (optional operation).

Specified by:
add in interface java.util.List

addAll

public boolean addAll(java.util.Collection c)
Adds all of the elements in the specified collection to this collection (optional operation).

Specified by:
addAll in interface java.util.List

clear

public void clear()
Removes all of the elements from this collection (optional operation).

Specified by:
clear in interface java.util.List

contains

public boolean contains(java.lang.Object o)
Returns true if this collection contains the specified element.

Specified by:
contains in interface java.util.List

containsAll

public boolean containsAll(java.util.Collection c)
Returns true if this collection contains all of the elements in the specified collection.

Specified by:
containsAll in interface java.util.List

equals

public boolean equals(java.lang.Object o)
Compares the specified object with this collection for equality.

Specified by:
equals in interface java.util.List

hashCode

public int hashCode()
Returns the hash code value for this collection.

Specified by:
hashCode in interface java.util.List

isEmpty

public boolean isEmpty()
Returns true if this collection contains no elements.

Specified by:
isEmpty in interface java.util.List

iterator

public java.util.Iterator iterator()
Returns an iterator over the elements in this collection.

Specified by:
iterator in interface java.util.List

remove

public boolean remove(java.lang.Object o)
Removes a single instance of the specified element from this collection, if it is present (optional operation).

Specified by:
remove in interface java.util.List

removeAll

public boolean removeAll(java.util.Collection c)
Removes all this collection's elements that are also contained in the specified collection (optional operation).

Specified by:
removeAll in interface java.util.List

retainAll

public boolean retainAll(java.util.Collection c)
Retains only the elements in this collection that are contained in the specified collection (optional operation).

Specified by:
retainAll in interface java.util.List

size

public int size()
Returns the number of elements in this collection.

Specified by:
size in interface java.util.List

toArray

public java.lang.Object[] toArray()
Returns an array containing all of the elements in this collection.

Specified by:
toArray in interface java.util.List

toArray

public java.lang.Object[] toArray(java.lang.Object[] a)
Returns an array containing all of the elements in this collection whose runtime type is that of the specified array.

Specified by:
toArray in interface java.util.List

add

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

addAll

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

get

public java.lang.Object get(int index)
Specified by:
get in interface java.util.List

indexOf

public int indexOf(java.lang.Object o)
Specified by:
indexOf in interface java.util.List

lastIndexOf

public int lastIndexOf(java.lang.Object o)
Specified by:
lastIndexOf in interface java.util.List

listIterator

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

listIterator

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

remove

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

set

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

subList

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