com.orientechnologies.jdo
Class oResultSet

java.lang.Object
  extended bycom.orientechnologies.jdo.oResultSet
All Implemented Interfaces:
java.util.Collection

public class oResultSet
extends java.lang.Object
implements java.util.Collection

Handle the resultset of query execution. It implements the collection contract. Objects are loaded in the client cache only on use.

See Also:
oQuery

Constructor Summary
oResultSet()
           
oResultSet(oPersistenceManager iManager)
           
oResultSet(oPersistenceManager iManager, java.util.ArrayList iData)
           
 
Method Summary
 boolean add(java.lang.Object iValue)
          Add an object in the collection.
 boolean addAll(java.util.Collection c)
           
 void clear()
          Clear the result set.
 boolean contains(java.lang.Object iObject)
           
 boolean containsAll(java.util.Collection c)
           
 boolean equals(java.lang.Object iSource)
           
 java.lang.Object get(int iIndex)
          Return the object by index.
 java.util.ArrayList getInternal()
          Get internal ArrayList containing the resultset
 int getLoadBlockSize()
          Get the block size of objects to transfer to the client.
 oOID getObjectId(int iIndex)
           
 boolean isEmpty()
          Know if the collection is empty or not.
 boolean isLoadAtOnce()
          Return the status of load at once.
 java.util.Iterator iterator()
          Return the Iterator to browse the collection of elements.
 boolean remove(java.lang.Object o)
           
 boolean remove(oOID iOid)
           
 boolean removeAll(java.util.Collection c)
           
 boolean retainAll(java.util.Collection c)
           
 void setLoadAtOnce(boolean loadAtOnce)
          Optimize performance for browsing the result set by loading the entire resultset in the client.
 void setLoadBlockSize(int loadBlockSize)
          Optimize performance for browsing the result set by transferring the objects in the client space at blocks.
 int size()
          Know collection size.
 java.lang.Object[] toArray()
          Convert the collection in an array of objects
 java.lang.Object[] toArray(java.lang.Object[] iArray)
          Convert the collection in an array of objects.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Collection
hashCode
 

Constructor Detail

oResultSet

public oResultSet()

oResultSet

public oResultSet(oPersistenceManager iManager)

oResultSet

public oResultSet(oPersistenceManager iManager,
                  java.util.ArrayList iData)
Method Detail

size

public int size()
Know collection size.

Specified by:
size in interface java.util.Collection
Returns:
the number of objects in the collection

isEmpty

public boolean isEmpty()
Know if the collection is empty or not.

Specified by:
isEmpty in interface java.util.Collection
Returns:
TRUE if the collection is empty, otherwise false.

contains

public boolean contains(java.lang.Object iObject)
Specified by:
contains in interface java.util.Collection

iterator

public java.util.Iterator iterator()
Return the Iterator to browse the collection of elements.

Specified by:
iterator in interface java.util.Collection
Returns:
Iterator object

toArray

public java.lang.Object[] toArray()
Convert the collection in an array of objects

Specified by:
toArray in interface java.util.Collection
Returns:
Array of objects

toArray

public java.lang.Object[] toArray(java.lang.Object[] iArray)
Convert the collection in an array of objects. The array used is passed as parameter and is returned back if was enought large and another one was used.

Specified by:
toArray in interface java.util.Collection
Returns:
Array of objects, can be the same of iArray parameter if is large enought to store objects, otherwise a new one is returned

add

public boolean add(java.lang.Object iValue)
Add an object in the collection.

Specified by:
add in interface java.util.Collection
Parameters:
iValue - Object to add
Returns:
true if the object was added, otherwise false.

get

public java.lang.Object get(int iIndex)
Return the object by index. If the object is present in cache, then the object is returned without involving datastore.

Parameters:
iIndex - Index of object in the collection
Returns:
Persistent object in the collection

getObjectId

public oOID getObjectId(int iIndex)

remove

public boolean remove(oOID iOid)

remove

public boolean remove(java.lang.Object o)
Specified by:
remove in interface java.util.Collection

containsAll

public boolean containsAll(java.util.Collection c)
Specified by:
containsAll in interface java.util.Collection

addAll

public boolean addAll(java.util.Collection c)
Specified by:
addAll in interface java.util.Collection

removeAll

public boolean removeAll(java.util.Collection c)
Specified by:
removeAll in interface java.util.Collection

retainAll

public boolean retainAll(java.util.Collection c)
Specified by:
retainAll in interface java.util.Collection

clear

public void clear()
Clear the result set.

Specified by:
clear in interface java.util.Collection

equals

public boolean equals(java.lang.Object iSource)
Specified by:
equals in interface java.util.Collection

getLoadBlockSize

public int getLoadBlockSize()
Get the block size of objects to transfer to the client.

Returns:
Size of block
See Also:
setLoadBlockSize(int loadBlockSize), isLoadAtOnce()

setLoadBlockSize

public void setLoadBlockSize(int loadBlockSize)
Optimize performance for browsing the result set by transferring the objects in the client space at blocks. Default setting 64 objects.

Parameters:
loadBlockSize - number of objects for a block
See Also:
getLoadBlockSize(), setLoadAtOnce(boolean loadAtOnce)

getInternal

public java.util.ArrayList getInternal()
Get internal ArrayList containing the resultset

Returns:
ArrayList of objects

isLoadAtOnce

public boolean isLoadAtOnce()
Return the status of load at once. Default setting is false.

See Also:
setLoadAtOnce(boolean loadAtOnce)

setLoadAtOnce

public void setLoadAtOnce(boolean loadAtOnce)
Optimize performance for browsing the result set by loading the entire resultset in the client. It's useful when all result set is browsed. Default setting is false.

Parameters:
loadAtOnce - true if entire collection must be loaded on browsing, otherwise false.
See Also:
isLoadAtOnce()