org.LexGrid.LexBIG.Impl.helpers
Class ResolvedConceptReferencesIteratorImpl

java.lang.Object
  extended by org.LexGrid.LexBIG.Impl.helpers.ResolvedConceptReferencesIteratorImpl
All Implemented Interfaces:
java.io.Serializable, EntityListIterator, ResolvedConceptReferencesIterator

public class ResolvedConceptReferencesIteratorImpl
extends java.lang.Object
implements ResolvedConceptReferencesIterator

Implements iterator behavior for fetching coded node sets.

Version:
subversion $Revision: $ checked in on $Date: $
Author:
Dan Armbrust, Jesse Erdmann, Kevin Peterson
See Also:
Serialized Form

Nested Class Summary
 class ResolvedConceptReferencesIteratorImpl.CleanUpThread
           
 
Constructor Summary
ResolvedConceptReferencesIteratorImpl()
           
ResolvedConceptReferencesIteratorImpl(CodeHolder codes, LocalNameList restrictToProperties, CodedNodeSet.PropertyType[] restrictToPropertyTypes, Filter[] filters, boolean resolveEntities)
           
 
Method Summary
 ResolvedConceptReferenceList get(int start, int end)
          Return concept references from the underlying list, from the start point (inclusive) to the end point (exclusive).
 ResolvedConceptReferenceList getNext()
          Return a list containing the items specified in the last scroll call.
 boolean hasNext()
          True means that there still values that can be returned.
 ResolvedConceptReference next()
          Return the next available concept reference, in order, from the underlying list.
 ResolvedConceptReferenceList next(int maxToReturn)
          Return concept references from the underlying list, in order and up to the specified maximum.
 int numberRemaining()
          Returns a count of the number of items remaining in the iterator.
 void release()
          Release the iterator.
 ResolvedConceptReferencesIterator scroll(int maxToReturn)
          Return the next batch of resolved concept references.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResolvedConceptReferencesIteratorImpl

public ResolvedConceptReferencesIteratorImpl()

ResolvedConceptReferencesIteratorImpl

public ResolvedConceptReferencesIteratorImpl(CodeHolder codes,
                                             LocalNameList restrictToProperties,
                                             CodedNodeSet.PropertyType[] restrictToPropertyTypes,
                                             Filter[] filters,
                                             boolean resolveEntities)
Method Detail

next

public ResolvedConceptReference next()
                              throws LBResourceUnavailableException,
                                     LBInvocationException
Description copied from interface: ResolvedConceptReferencesIterator
Return the next available concept reference, in order, from the underlying list.

Note: This is effectively the same as performing next(1), but eliminates the need to continually unwrap the concept reference from the resolved list. Note: This method is not affected by calls to get(int, int).

Specified by:
next in interface ResolvedConceptReferencesIterator
Throws:
LBResourceUnavailableException
LBInvocationException

next

public ResolvedConceptReferenceList next(int maxToReturn)
                                  throws LBResourceUnavailableException,
                                         LBInvocationException
Description copied from interface: ResolvedConceptReferencesIterator
Return concept references from the underlying list, in order and up to the specified maximum. Note: This method is not affected by calls to get(int, int).

Specified by:
next in interface ResolvedConceptReferencesIterator
Parameters:
maxToReturn - The maximum number of entries to return. Note that the interface may return less than the supplied number of entries even if there are still more to come. -1 means return a "natural" block size, potentially up to the maximum amount available, as determined by the service software. 0 returns an empty list and can be used to keep the iterator "alive".
Throws:
LBResourceUnavailableException
LBInvocationException

get

public ResolvedConceptReferenceList get(int start,
                                        int end)
                                 throws LBResourceUnavailableException,
                                        LBInvocationException,
                                        LBParameterException
Description copied from interface: ResolvedConceptReferencesIterator
Return concept references from the underlying list, from the start point (inclusive) to the end point (exclusive). Calling this method has no effect on the next() calls - next() will still iterate through the results in the same sequential order regardless of if this method has been used. the result of numberRemaining() is not affected by calls to this method. Note: This method may return fewer results than requested even if there are still more results after the last result returned by the service. Note: The method is optional, and may not be implemented by all implementations. Note: Using this method in combination with Filters may cause significant performance reductions.

Specified by:
get in interface ResolvedConceptReferencesIterator
Parameters:
start - The start point of the range of results to return - inclusive. The entries list is 0 indexed - so to get the first result, you should start with '0'. LBParameterException is thrown if the start position is > the last item available.
end - The end point of the range of results to return - exclusive. A range request of (0, 50) will return 50 items (0 through 49 in an array)
Throws:
LBResourceUnavailableException
LBInvocationException
LBParameterException

hasNext

public boolean hasNext()
                throws LBResourceUnavailableException
Description copied from interface: EntityListIterator
True means that there still values that can be returned. False means all values have already been returned. This method only applies to calls to next() and next(int) - it does not have any bearing on calls to get(int, int).

Specified by:
hasNext in interface EntityListIterator
Throws:
LBResourceUnavailableException

release

public void release()
Description copied from interface: EntityListIterator
Release the iterator. Iterators can have a fixed lifespan as determined by the service, but this allows the iterator to be returned gracefully to the system.

Specified by:
release in interface EntityListIterator

scroll

public ResolvedConceptReferencesIterator scroll(int maxToReturn)
                                         throws LBResourceUnavailableException,
                                                LBInvocationException
Description copied from interface: ResolvedConceptReferencesIterator
Return the next batch of resolved concept references.

Specified by:
scroll in interface ResolvedConceptReferencesIterator
Parameters:
maxToReturn - The maximum number of remaining concepts to return
Returns:
Throws:
LBResourceUnavailableException
LBInvocationException

getNext

public ResolvedConceptReferenceList getNext()
Description copied from interface: ResolvedConceptReferencesIterator
Return a list containing the items specified in the last scroll call.

Specified by:
getNext in interface ResolvedConceptReferencesIterator
Returns:

numberRemaining

public int numberRemaining()
                    throws LBResourceUnavailableException
Description copied from interface: EntityListIterator
Returns a count of the number of items remaining in the iterator. This is optional, and may only be an estimate. Implementations should return -1 if they cannot count or estimate the number remaining. Note: This method is not affected by calls to get(int, int). It only returns counts with respect to calls to next() or next(int).

Specified by:
numberRemaining in interface EntityListIterator
Throws:
LBResourceUnavailableException
See Also:
for an authoritative answer whether or not the iterator has returned all possible items.

Copyright: (c) 2004-2006 Mayo Foundation for Medical Education and Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the triple-shield Mayo logo are trademarks and service marks of MFMER.