org.intermine.objectstore.query
Class SingletonResults

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<java.lang.Object>
          extended by org.intermine.objectstore.query.Results
              extended by org.intermine.objectstore.query.SingletonResults
All Implemented Interfaces:
java.lang.Iterable<java.lang.Object>, java.util.Collection<java.lang.Object>, java.util.List<java.lang.Object>, java.util.Set<java.lang.Object>, Lazy, LazyCollection<java.lang.Object>

public class SingletonResults
extends Results
implements java.util.Set<java.lang.Object>

This class is equivalent to a Result object with ResultRows consisting only of single items


Field Summary
 
Fields inherited from class org.intermine.objectstore.query.Results
explain, immutable, lastGet, optimise, prefetch, resultsBatches, sequential
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
SingletonResults(Query q, ObjectStore os, java.util.Map<java.lang.Object,java.lang.Integer> sequence)
          Constructor for a SingletonResults object
SingletonResults(ResultsBatches batches, boolean optimise, boolean explain, boolean prefetch)
          Constructor for a SingletonResults object, given a ResultsBatches object.
 
Method Summary
 java.util.List<java.lang.Object> range(int start, int end)
          Returns a range of rows of results.
 
Methods inherited from class org.intermine.objectstore.query.Results
asList, get, getBatchNoForRow, getBatchSize, getInfo, getObjectStore, getQuery, getResultsBatches, getSequence, isEmpty, isSingleBatch, iterator, iteratorFrom, setBatchSize, setImmutable, setNoExplain, setNoOptimise, setNoPrefetch, size, subList
 
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, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 
Methods inherited from interface java.util.List
addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArray
 

Constructor Detail

SingletonResults

public SingletonResults(Query q,
                        ObjectStore os,
                        java.util.Map<java.lang.Object,java.lang.Integer> sequence)
Constructor for a SingletonResults object

Parameters:
q - the Query that produces this Results
os - the ObjectStore that can be used to get results rows from
sequence - an object representing the state of the ObjectStore, which should be quoted back to the ObjectStore when requests are made
Throws:
java.lang.IllegalArgumentException - if q does not return a single column

SingletonResults

public SingletonResults(ResultsBatches batches,
                        boolean optimise,
                        boolean explain,
                        boolean prefetch)
Constructor for a SingletonResults object, given a ResultsBatches object.

Parameters:
batches - a ResultsBatches object that will back this new object
optimise - true if queries should be optimised
explain - true if queries should be explained
prefetch - true to switch on the PrefetchManager
Method Detail

range

public java.util.List<java.lang.Object> range(int start,
                                              int end)
                                       throws ObjectStoreException
Returns a range of rows of results. Will fetch batches from the underlying ObjectStore if necessary.

Overrides:
range in class Results
Parameters:
start - the start index (inclusive)
end - the end index (inclusive)
Returns:
the relevant ResultRows as a List
Throws:
ObjectStoreException - if an error occurs in the underlying ObjectStore