com.caucho.amber.collection
Class CollectionImpl<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by com.caucho.amber.collection.CollectionImpl<E>
All Implemented Interfaces:
AmberCollection, java.lang.Iterable<E>, java.util.Collection<E>, java.util.List<E>

public class CollectionImpl<E>
extends java.util.AbstractList<E>
implements AmberCollection

Represents a lazy collection.


Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
CollectionImpl(AmberConnection aConn, java.lang.String query)
           
CollectionImpl(AmberQuery query)
           
 
Method Summary
 boolean add(E o)
          Adds an item to the collection.
 boolean addAll(int index, java.util.Collection<? extends E> collection)
          Adds an item to the collection.
 void clear()
          Clears the collection.
 void detach()
          Detaches the collection.
 E get(int index)
          Returns an iterator of the items.
 AmberQuery getQuery()
          Returns the query.
 AmberConnection getSession()
          Returns the session.
protected  boolean isValid()
           
 java.util.Iterator<E> iterator()
          Returns an iterator of the items.
 void setSession(AmberConnection aConn)
          Sets the session.
 int size()
          Returns the number of items in the collection.
 void update()
          Updates the collection.
 
Methods inherited from class java.util.AbstractList
add, equals, hashCode, indexOf, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 

Constructor Detail

CollectionImpl

public CollectionImpl(AmberConnection aConn,
                      java.lang.String query)

CollectionImpl

public CollectionImpl(AmberQuery query)
Method Detail

setSession

public void setSession(AmberConnection aConn)
Sets the session.


getSession

public AmberConnection getSession()
Returns the session.


getQuery

public AmberQuery getQuery()
Returns the query.


size

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

Specified by:
size in interface java.util.Collection<E>
Specified by:
size in interface java.util.List<E>
Specified by:
size in class java.util.AbstractCollection<E>

iterator

public java.util.Iterator<E> iterator()
Returns an iterator of the items.

Specified by:
iterator in interface java.lang.Iterable<E>
Specified by:
iterator in interface java.util.Collection<E>
Specified by:
iterator in interface java.util.List<E>
Overrides:
iterator in class java.util.AbstractList<E>

get

public E get(int index)
Returns an iterator of the items.

Specified by:
get in interface java.util.List<E>
Specified by:
get in class java.util.AbstractList<E>

add

public boolean add(E o)
Adds an item to the collection.

Specified by:
add in interface java.util.Collection<E>
Specified by:
add in interface java.util.List<E>
Overrides:
add in class java.util.AbstractList<E>

addAll

public boolean addAll(int index,
                      java.util.Collection<? extends E> collection)
Adds an item to the collection.

Specified by:
addAll in interface java.util.List<E>
Overrides:
addAll in class java.util.AbstractList<E>

clear

public void clear()
Clears the collection.

Specified by:
clear in interface java.util.Collection<E>
Specified by:
clear in interface java.util.List<E>
Overrides:
clear in class java.util.AbstractList<E>

update

public void update()
Updates the collection.

Specified by:
update in interface AmberCollection

isValid

protected boolean isValid()

detach

public void detach()
Detaches the collection.