|
SolarMetric Kodo JDO 2.5.8 generated on January 11 2004 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--java.util.AbstractCollection
|
+--java.util.AbstractList
|
+--com.solarmetric.kodo.runtime.objectprovider.OnDemandForwardResultList
ResultList implementation that uses lazy instantiation for
forward-only underlying ResultObjectProvider instances.
The result of size() will return Integer.MAX_VALUE
if the results have not yet been completely instantiated, in accordance
with section 14.6.1 of the JDO specification.
By default, hard references will be used to hold elements of
the list. The configuration parameters setUseHardReferences(boolean),
setUseSoftReferences(boolean), and setUseWeakReferences(boolean)
can be used to configure this behavior. Note that if a weak
or soft reference holder is garbage collected, then null may
be returned from invocations of get(int), since the
underlying input cannot be scrolled back to retrieve the
lost object.
ResultList,
Configuration.setResultListClass(java.lang.String),
Configuration.setResultListProperties(java.lang.String), Serialized Form| Fields inherited from class java.util.AbstractList |
modCount |
| Constructor Summary | |
OnDemandForwardResultList()
|
|
| Method Summary | |
void |
checkClosed()
Ensure that the ResultList is not closed. |
void |
close()
To be in accordance with the spec, we need to throw an Exception on list access after our owning Extent or Query is closed. |
boolean |
equals(Object other)
Unless the list is completely instantiated, returns the identity equals for objects, since returning the default Collection.equals(java.lang.Object) behanvior would mean that
we have to traverse the entire list. |
(package private) void |
free()
Close and free the result object provider. |
Object |
get(int index)
Get the element at the indexth position. |
int |
getInstantiatedCount()
Returns the number of results that have been instantiated. |
int |
getKnownSize()
Return the correct size of the results if known, otherwise return Integer.MAX_VALUE. |
(package private) Object |
getReferenceAtIndex(int index)
Returns the element of the list at index, or null if we are past the end of the list. |
int |
getTrueSize()
Return the correct size of the results if known. |
boolean |
getUseCorrectSize()
If true, the size() method will ensure that the
results are completely instantiated before returning the
size of the results. |
boolean |
getUseWindow()
If this returns true, this list will use a
sliding window of the same size as the PM's batch size
(actually, the batch size plus one, to make room for the
lookahead object) at the time that this list was created. |
int |
hashCode()
Unless the list is completely instantiated, returns the identity hash code of this object, since returning the default Collection.hashCode() behanvior would mean that
we have to traverse the entire list. |
void |
initResultList(Object input,
ResultObjectProvider rop,
Configuration config)
Initialize the ResultList implementation, which will allow custom ResultList objects to be used for Query results. |
boolean |
isClosed()
Returns true if the ResultList has been explicitely closed. |
void |
setUseCorrectSize(boolean useCorrectSize)
Sets whether the results if size() should be correct. |
void |
setUseHardReferences(boolean use)
If true, weak references will be held in the list. |
void |
setUseSoftReferences(boolean use)
If true, soft references will be held in the list. |
void |
setUseWeakReferences(boolean use)
If true, hard references will ensure that results will not be garbage collected. |
void |
setUseWindow(boolean val)
If set to true, this list will use a sliding
window of the same size as the PM's batch size (actually, the
batch size plus one, to make room for the lookahead object) at
the time that this list was created. |
int |
size()
If getUseCorrectSize() is true, return the true size of
the ResultList (instantiating all the elements if necessary),
otherwise return the size of the results if they have been
completely instantiated, or else Integer.MAX_VALUE (as per
the JDO specification 1.0 section 14.6.1). |
String |
toString()
|
boolean |
windowHasMoved()
Returns true if the window has moved -- if the
low end of the list have been dropped as we've moved through
the list. |
Object |
writeReplace()
Serialize as a simple ArrayList. |
| Methods inherited from class java.util.AbstractList |
add, add, addAll, clear, indexOf, iterator, lastIndexOf, listIterator, 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 |
|
| Methods inherited from interface java.util.List |
add, add, addAll, addAll, clear, contains, containsAll, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, subList, toArray, toArray |
| Constructor Detail |
public OnDemandForwardResultList()
| Method Detail |
public void initResultList(Object input,
ResultObjectProvider rop,
Configuration config)
CustomResultListinitResultList in interface CustomResultListcom.solarmetric.kodo.runtime.objectprovider.CustomResultListinput - the source of the results (e.g., a JDBC ResultSet)rop - the provider used to obtain the next element
from the listconfig - the Configuration object to usepublic int getInstantiatedCount()
getInstantiatedCount in interface ResultListpublic int size()
getUseCorrectSize() is true, return the true size of
the ResultList (instantiating all the elements if necessary),
otherwise return the size of the results if they have been
completely instantiated, or else Integer.MAX_VALUE (as per
the JDO specification 1.0 section 14.6.1).size in interface Listsize in class AbstractCollectiongetTrueSize(),
getKnownSize()public int getKnownSize()
Integer.MAX_VALUE.public int getTrueSize()
public Object writeReplace()
throws ObjectStreamException
ArrayList.
public void checkClosed()
throws FatalUserException
ResultList is not closed.checkClosed in interface ResultListFatalUserException - if the list is closedpublic void close()
close in interface ResultListvoid free()
public Object get(int index)
get in interface Listget in class AbstractListObject getReferenceAtIndex(int index)
public boolean isClosed()
isClosed in interface ResultListpublic int hashCode()
Unless the list is completely instantiated, returns the identity
hash code of this object, since returning the
default Collection.hashCode() behanvior would mean that
we have to traverse the entire list.
If the list is completely instantiated, the standard
Collection.hashCode() contract is respected.
hashCode in interface ListhashCode in class AbstractListpublic boolean equals(Object other)
Unless the list is completely instantiated,
returns the identity equals for objects, since returning the
default Collection.equals(java.lang.Object) behanvior would mean that
we have to traverse the entire list.
If the list is completely instantiated, the standard
Collection.equals(java.lang.Object) contract is respected.
equals in interface Listequals in class AbstractListpublic void setUseCorrectSize(boolean useCorrectSize)
size() should be correct.getUseCorrectSize()public boolean getUseCorrectSize()
size() method will ensure that the
results are completely instantiated before returning the
size of the results. If false, size() will return
Integer.MAX_VALUE if the results have not been
completely instantiated.public void setUseWindow(boolean val)
true, this list will use a sliding
window of the same size as the PM's batch size (actually, the
batch size plus one, to make room for the lookahead object) at
the time that this list was created. If this list uses a
sliding window, then low results will be dropped as we walk
through this list. This means that the list can only be
iterated once, and that the list will maintain a fixed amount
of memory, among other things. By default, this is
false.public boolean getUseWindow()
true, this list will use a
sliding window of the same size as the PM's batch size
(actually, the batch size plus one, to make room for the
lookahead object) at the time that this list was created. If
this list uses a sliding window, then low results will be
dropped as we walk through this list. This means that the list
can only be iterated once, and that the list will maintain a
fixed amount of memory, among other things. By default, this
returns false.public void setUseWeakReferences(boolean use)
public void setUseHardReferences(boolean use)
public void setUseSoftReferences(boolean use)
public boolean windowHasMoved()
true if the window has moved -- if the
low end of the list have been dropped as we've moved through
the list. Otherwise, returns false.public String toString()
toString in class AbstractCollection
|
SolarMetric Kodo JDO 2.5.8 generated on January 11 2004 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||