public class ScoredIterator extends java.lang.Object implements ResolvedConceptReferencesIterator
Constructor and Description |
---|
ScoredIterator(java.util.Collection<org.LexGrid.LexBIG.example.ScoredTerm> scoredTerms,
int maxItems)
Construct from a map of ScoredTerms, ordered from high to low score.
|
ScoredIterator(org.LexGrid.LexBIG.example.ScoredTerm[] scoredTerms)
Construct from a pre-sorted array of ScoredTerms.
|
Modifier and Type | Method and Description |
---|---|
ResolvedConceptReferenceList |
get(int start,
int end)
Returns a specific range of items without altering cursor position.
|
ResolvedConceptReferenceList |
getNext()
Returns items skipped by last scroll() without altering cursor position.
|
boolean |
hasNext()
Indicates if more items are available through next() operations.
|
ResolvedConceptReference |
next()
Returns the next item and advances the cursor.
|
ResolvedConceptReferenceList |
next(int maxToReturn)
Returns the next 'n' items and advances the cursor.
|
int |
numberRemaining()
Indicates the number of items available to retrieve via next()
operations.
|
void |
release()
Releases the maintained terms and invalidates the iterator.
|
ResolvedConceptReferencesIterator |
scroll(int maxToReturn)
Skips 'n' items which are available via getNext() until a call to next(),
returning self.
|
protected void |
verifyResources()
Verifies the iterator is still valid.
|
public ScoredIterator(java.util.Collection<org.LexGrid.LexBIG.example.ScoredTerm> scoredTerms, int maxItems)
scoredTerms
- maxItems
- public ScoredIterator(org.LexGrid.LexBIG.example.ScoredTerm[] scoredTerms)
scoredTerms
- public ResolvedConceptReferenceList get(int start, int end) throws LBResourceUnavailableException, LBInvocationException, LBParameterException
get
in interface ResolvedConceptReferencesIterator
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)LBResourceUnavailableException
LBInvocationException
LBParameterException
public ResolvedConceptReferenceList getNext()
getNext
in interface ResolvedConceptReferencesIterator
public ResolvedConceptReference next() throws LBResourceUnavailableException, LBInvocationException
next
in interface ResolvedConceptReferencesIterator
LBResourceUnavailableException
LBInvocationException
public ResolvedConceptReferenceList next(int maxToReturn) throws LBResourceUnavailableException, LBInvocationException
next
in interface ResolvedConceptReferencesIterator
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".LBResourceUnavailableException
LBInvocationException
public ResolvedConceptReferencesIterator scroll(int maxToReturn) throws LBResourceUnavailableException, LBInvocationException
scroll
in interface ResolvedConceptReferencesIterator
maxToReturn
- The maximum number of remaining concepts to returnLBResourceUnavailableException
LBInvocationException
public boolean hasNext() throws LBResourceUnavailableException
hasNext
in interface EntityListIterator
LBResourceUnavailableException
public int numberRemaining() throws LBResourceUnavailableException
numberRemaining
in interface EntityListIterator
LBResourceUnavailableException
for an authoritative answer whether or not the iterator
has returned all possible items.
public void release() throws LBResourceUnavailableException
release
in interface EntityListIterator
LBResourceUnavailableException
protected void verifyResources() throws LBResourceUnavailableException
LBResourceUnavailableException