SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool

com.solarmetric.rd.rop
Class LazyResultList

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--com.solarmetric.rd.rop.LazyResultList
All Implemented Interfaces:
java.util.Collection, java.util.List, ResultList, java.io.Serializable

public class LazyResultList
extends java.util.AbstractList
implements ResultList

Lazy ResultList implementation. It maintains a soft reference map of the items that we have already instantiated. If we ever resolve all of the values in the input, they will be copied over to a HashMap so that the input can be closed.

Since:
2.2.6
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
LazyResultList(java.lang.Object input, com.solarmetric.rd.rop.ResultObjectProvider rop, int batchSize)
           
 
Method Summary
 void checkClosed()
          Check to see if this ResultList has been closed, and if so, throw a NoSuchElementException.
 void close()
          Close the list.
 boolean equals(java.lang.Object other)
           
protected  void finalize()
           
 void flush(int targetReduction)
          Internal method to try to flush out all references that are not present elsewhere.
protected  void free()
           
 java.lang.Object get(int index)
           
 int getCacheSize()
           
 java.util.Collection getCacheValues()
           
 int getInstantiatedCount()
          Returns the number of objects that are currently instantiated internally in this list.
 int hashCode()
           
 boolean isClosed()
          Returns true if the list has been closed.
 java.util.Iterator iterator()
           
 java.util.ListIterator listIterator()
           
 int size()
          Return the size of this List.
 java.lang.String toString()
           
 void useSoftMap()
           
 void useWeakMap()
           
 java.lang.Object writeReplace()
           
 
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, indexOf, lastIndexOf, listIterator, remove, removeRange, set, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, indexOf, isEmpty, lastIndexOf, listIterator, remove, remove, removeAll, retainAll, set, subList, toArray, toArray
 

Constructor Detail

LazyResultList

public LazyResultList(java.lang.Object input,
                      com.solarmetric.rd.rop.ResultObjectProvider rop,
                      int batchSize)
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.util.AbstractCollection

getInstantiatedCount

public int getInstantiatedCount()
Description copied from interface: ResultList
Returns the number of objects that are currently instantiated internally in this list.

Specified by:
getInstantiatedCount in interface ResultList

getCacheSize

public int getCacheSize()

getCacheValues

public java.util.Collection getCacheValues()

get

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

flush

public void flush(int targetReduction)
Internal method to try to flush out all references that are not present elsewhere.


useWeakMap

public void useWeakMap()

useSoftMap

public void useSoftMap()

size

public int size()
Return the size of this List. Since at any given time, only some (or none) of the results may be cached, we calculate the size by jumping to the last row in the Result and getting its row index: this will be the correct size, according to the JDBC 2.0 specification.

Specified by:
size in interface java.util.List
Specified by:
size in class java.util.AbstractCollection

checkClosed

public void checkClosed()
Description copied from interface: ResultList
Check to see if this ResultList has been closed, and if so, throw a NoSuchElementException.

Specified by:
checkClosed in interface ResultList

close

public void close()
Description copied from interface: ResultList
Close the list.

Specified by:
close in interface ResultList

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
java.lang.Throwable

free

protected void free()

iterator

public java.util.Iterator iterator()
Specified by:
iterator in interface java.util.List
Overrides:
iterator in class java.util.AbstractList

listIterator

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

isClosed

public boolean isClosed()
Description copied from interface: ResultList
Returns true if the list has been closed.

Specified by:
isClosed in interface ResultList

writeReplace

public java.lang.Object writeReplace()
                              throws java.io.ObjectStreamException
java.io.ObjectStreamException

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.List
Overrides:
hashCode in class java.util.AbstractList

equals

public boolean equals(java.lang.Object other)
Specified by:
equals in interface java.util.List
Overrides:
equals in class java.util.AbstractList

SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool

Copyright 2001,2002,2003 SolarMetric, Inc. All Rights Reserved.