|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractList<java.lang.Object>
org.intermine.objectstore.query.Results
public class Results
Results representation as a List of ResultRows. Extending AbstractList requires implementation of get(int) and size(). In addition subList(int, int) overrides AbstractList implementation for efficiency. Also iterator() and isEmpty() to avoid evaluating the entire collection.
| Field Summary | |
|---|---|
protected boolean |
explain
|
protected boolean |
immutable
|
protected int |
lastGet
|
protected boolean |
optimise
|
protected boolean |
prefetch
|
protected ResultsBatches |
resultsBatches
|
protected int |
sequential
|
| Fields inherited from class java.util.AbstractList |
|---|
modCount |
| Constructor Summary | |
|---|---|
protected |
Results()
No argument constructor for testing purposes |
|
Results(Query query,
ObjectStore os,
java.util.Map<java.lang.Object,java.lang.Integer> sequence)
Constructor for a Results object. |
|
Results(ResultsBatches batches,
boolean optimise,
boolean explain,
boolean prefetch)
Constructor for a Results object, given a ResultsBatches object. |
| Method Summary | |
|---|---|
java.util.List<java.lang.Object> |
asList()
Return this Collection as a List. |
java.lang.Object |
get(int index)
|
protected int |
getBatchNoForRow(int row)
Gets the batch for a particular row |
int |
getBatchSize()
Gets the batch size being used. |
ResultsInfo |
getInfo()
Gets the best current estimate of the characteristics of the query. |
ObjectStore |
getObjectStore()
Returns the ObjectStore that this Results object will use |
Query |
getQuery()
Get the Query that produced this Results object. |
ResultsBatches |
getResultsBatches()
Returns the underlying ResultsBatches object that this object is using, in order to create more Results objects (with different settings) from it. |
java.util.Map<java.lang.Object,java.lang.Integer> |
getSequence()
Returns the sequence that this Results object was created with |
boolean |
isEmpty()
|
boolean |
isSingleBatch()
Returns true if the results are known to fit entirely within the first batch. |
java.util.Iterator<java.lang.Object> |
iterator()
|
java.util.Iterator<java.lang.Object> |
iteratorFrom(int from)
Returns an iterator over the List, starting from the given position. |
java.util.List<java.lang.Object> |
range(int start,
int end)
Returns a range of rows of results. |
void |
setBatchSize(int size)
Sets the number of rows requested from the ObjectStore whenever an execute call is made |
void |
setImmutable()
Tells this Results object that it is being put into a cache, so it needs to be made immutable to prevent threads stomping on each other and changing settings. |
void |
setNoExplain()
Sets this Results object to bypass the explain check in ObjectStore.execute(). |
void |
setNoOptimise()
Sets this Results object to bypass the optimiser. |
void |
setNoPrefetch()
Tells this Results object to never do any background prefetching. |
int |
size()
Gets the number of results rows in this Results object |
java.util.List<java.lang.Object> |
subList(int start,
int end)
|
| Methods inherited from class java.util.AbstractList |
|---|
add, add, addAll, clear, equals, hashCode, indexOf, lastIndexOf, listIterator, listIterator, remove, removeRange, set |
| Methods inherited from class java.util.AbstractCollection |
|---|
addAll, contains, containsAll, 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.Set |
|---|
add, addAll, clear, contains, containsAll, equals, hashCode, remove, removeAll, retainAll, toArray, toArray |
| Methods inherited from interface java.util.List |
|---|
addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArray |
| Field Detail |
|---|
protected ResultsBatches resultsBatches
protected boolean optimise
protected boolean explain
protected boolean prefetch
protected boolean immutable
protected int lastGet
protected int sequential
| Constructor Detail |
|---|
protected Results()
public Results(Query query,
ObjectStore os,
java.util.Map<java.lang.Object,java.lang.Integer> sequence)
query - the Query that produces this Resultsos - the ObjectStore that can be used to get results rows fromsequence - a number representing the state of the ObjectStore, which should be quoted
back to the ObjectStore when requests are made
public Results(ResultsBatches batches,
boolean optimise,
boolean explain,
boolean prefetch)
batches - a ResultsBatches object that will back this new objectoptimise - true if queries should be optimisedexplain - true if queries should be explainedprefetch - true to switch on the PrefetchManager| Method Detail |
|---|
public void setNoOptimise()
setNoOptimise in interface LazyCollection<java.lang.Object>public void setNoExplain()
setNoExplain in interface LazyCollection<java.lang.Object>public void setNoPrefetch()
public void setImmutable()
public Query getQuery()
getQuery in interface LazyCollection<java.lang.Object>public java.util.Map<java.lang.Object,java.lang.Integer> getSequence()
public ObjectStore getObjectStore()
getObjectStore in interface Lazy
public java.util.List<java.lang.Object> range(int start,
int end)
throws ObjectStoreException
start - the start index (inclusive)end - the end index (inclusive)
ObjectStoreException - if an error occurs in the underlying ObjectStore
java.lang.IndexOutOfBoundsException - if end is beyond the number of rows in the results
java.lang.IllegalArgumentException - if start > endpublic java.lang.Object get(int index)
get in interface java.util.List<java.lang.Object>get in class java.util.AbstractList<java.lang.Object>index - of the ResultsRow required
public java.util.List<java.lang.Object> subList(int start,
int end)
subList in interface java.util.List<java.lang.Object>subList in class java.util.AbstractList<java.lang.Object>start - the index to start from (inclusive)end - the index to end at (exclusive)
public int size()
size in interface java.util.Collection<java.lang.Object>size in interface java.util.List<java.lang.Object>size in interface java.util.Set<java.lang.Object>size in class java.util.AbstractCollection<java.lang.Object>public boolean isEmpty()
isEmpty in interface java.util.Collection<java.lang.Object>isEmpty in interface java.util.List<java.lang.Object>isEmpty in interface java.util.Set<java.lang.Object>isEmpty in class java.util.AbstractCollection<java.lang.Object>
public ResultsInfo getInfo()
throws ObjectStoreException
getInfo in interface LazyCollection<java.lang.Object>ObjectStoreException - if an error occurs in the underlying ObjectStorepublic void setBatchSize(int size)
setBatchSize in interface LazyCollection<java.lang.Object>size - the number of rowspublic int getBatchSize()
protected int getBatchNoForRow(int row)
row - the row to get the batch for
public java.util.List<java.lang.Object> asList()
asList in interface LazyCollection<java.lang.Object>public boolean isSingleBatch()
public java.util.Iterator<java.lang.Object> iterator()
iterator in interface java.lang.Iterable<java.lang.Object>iterator in interface java.util.Collection<java.lang.Object>iterator in interface java.util.List<java.lang.Object>iterator in interface java.util.Set<java.lang.Object>iterator in class java.util.AbstractList<java.lang.Object>public java.util.Iterator<java.lang.Object> iteratorFrom(int from)
from - the index of the first object to be fetched
public ResultsBatches getResultsBatches()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||