org.garret.jsql
Class ResultSetIterator

java.lang.Object
  extended byorg.garret.jsql.ResultSetIterator
All Implemented Interfaces:
QueryIterator, java.io.Serializable

public class ResultSetIterator
extends java.lang.Object
implements QueryIterator, java.io.Serializable

Query iterator using ArrayList

See Also:
Serialized Form

Constructor Summary
ResultSetIterator(java.lang.Object[] a)
          Constructor of iterator for specified result set
 
Method Summary
 QueryIterator concurrentIterator()
          JSQL is able to perform sequential search in parallel.
 boolean getByKeyRange(java.lang.String key, java.lang.Object minValue, java.lang.Object maxValue, boolean inclusive, Query result)
          Try to use index to select objects belonginh to the specified range
 java.lang.Object getByPrimaryKey(java.lang.String key, java.lang.Object keyValue)
          Try to use index to locate object by unique primary key.
 java.lang.Object getFirst()
          Get first object.
 java.lang.Object getNext(java.lang.Object prevObj, int prevIndex)
          Get next object.
 boolean isThreadSafe()
          Check if it is possible to use iterator concurrently.
 boolean useNormalizedKeys()
          Check if iterator supporting direct access by key stores key values in normalized form (all integer types as Long, all real types as Double, other types as it is).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResultSetIterator

public ResultSetIterator(java.lang.Object[] a)
Constructor of iterator for specified result set

Method Detail

getFirst

public java.lang.Object getFirst()
Description copied from interface: QueryIterator
Get first object.

Specified by:
getFirst in interface QueryIterator
Returns:
first object or null if there are no object to search.

getNext

public java.lang.Object getNext(java.lang.Object prevObj,
                                int prevIndex)
Description copied from interface: QueryIterator
Get next object.

Specified by:
getNext in interface QueryIterator
Parameters:
prevObj - reference returned by previous call of getNext or getFirst
prevIndex - index of previous object (starting from 0 for first object)
Returns:
next object or null if there are no more objects

getByPrimaryKey

public java.lang.Object getByPrimaryKey(java.lang.String key,
                                        java.lang.Object keyValue)
Description copied from interface: QueryIterator
Try to use index to locate object by unique primary key.

Specified by:
getByPrimaryKey in interface QueryIterator
Parameters:
key - name of primary key field. This files should be unique among all searched object.
keyValue - key value
Returns:
object with specified value of primary key or null if object was not found.

getByKeyRange

public boolean getByKeyRange(java.lang.String key,
                             java.lang.Object minValue,
                             java.lang.Object maxValue,
                             boolean inclusive,
                             Query result)
Description copied from interface: QueryIterator
Try to use index to select objects belonginh to the specified range

Specified by:
getByKeyRange in interface QueryIterator
Parameters:
key - name of key field.
minValue - low bound for key value (if null, then there is no low bound
maxValue - high bound for key value (if null, then there is no high bound
inclusive - whether bounds are inclusive or exclusive
result - query to which records belongin to the specified range should be added using add method
Returns:
true if index is applicable, false otherwise

concurrentIterator

public QueryIterator concurrentIterator()
Description copied from interface: QueryIterator
JSQL is able to perform sequential search in parallel. To be able to achive it, query iterator should is either reentrant either cloneable. The method concurrentIterator should either return this if iterator is reentrant, or clone the iterator. This method will be called prior any other access to the iterator by JSQL.

Specified by:
concurrentIterator in interface QueryIterator
Returns:
this if iterator is reentrant or clone of iterator

isThreadSafe

public boolean isThreadSafe()
Description copied from interface: QueryIterator
Check if it is possible to use iterator concurrently. JQSl is able to perform sequential search in parallel. Iterator should be reentrant or supports clone method to be use in multiple concurrent threads.

Specified by:
isThreadSafe in interface QueryIterator
Returns:
true is iterator can be use in parallel search, false otherwise

useNormalizedKeys

public boolean useNormalizedKeys()
Description copied from interface: QueryIterator
Check if iterator supporting direct access by key stores key values in normalized form (all integer types as Long, all real types as Double, other types as it is). Normalization of key value should be performed using Query.normilizeKeyValue method.
If this method returns false then JSQL will try to convert search literals to the type of the indexed field. But it is possible only if type of the field is known at query compilation time. Otherwise in case of using dynamic binding such covertsion should be performed by iterator itself using Query.castLiteral method.

Specified by:
useNormalizedKeys in interface QueryIterator
Returns:
true if key values are stored in the index in normalized form