Package nzilbb.labbcat.server.search
Class ArraySearchResults
- java.lang.Object
-
- nzilbb.labbcat.server.search.ArraySearchResults
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Iterator<String>,SearchResults
public class ArraySearchResults extends Object implements SearchResults
Search results constructed from an array of selected MatchId strings.- Author:
- Robert Fromont robert@fromont.net.nz
-
-
Constructor Summary
Constructors Constructor Description ArraySearchResults(String[] IDs)Constructor from MatchId array.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close all open resources (there are none).StringgetLastMatchId()Getter forlastMatchId: The ID of the last match the iterator returned fromnext()StringgetName()SearchResults method: A descriptive name for the collection.intgetPageLength()Getter forpageLength: The maximum number of results to return fromnext(), or 0 for no maximum.booleanhasNext()Iterator method: Returns true if the iteration has more elements.Stringnext()Iterator method: Returns the next result ID.voidreset()SearchResults method: Resets the iterator to the beginning of the listbooleanseek(int n)Go to the nth item in the list, so it will be the next returned bynext().ArraySearchResultssetName(String newName)Setter forname: Name of result set.SearchResultssetPageLength(int newPageLength)Setter forpageLength: The maximum number of results to return fromnext(), or 0 for no maximum.intsize()SearchResults method: Returns the number of utterances in the collection.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining, remove
-
-
-
-
Constructor Detail
-
ArraySearchResults
public ArraySearchResults(String[] IDs)
Constructor from MatchId array.- Parameters:
IDs- An array of MatchIDs.
-
-
Method Detail
-
getName
public String getName()
SearchResults method: A descriptive name for the collection.- Specified by:
getNamein interfaceSearchResults- Returns:
- A descriptive name for the collection.
-
setName
public ArraySearchResults setName(String newName)
Setter forname: Name of result set.- Parameters:
newName- Name of result set.
-
getPageLength
public int getPageLength()
Getter forpageLength: The maximum number of results to return fromnext(), or 0 for no maximum.- Specified by:
getPageLengthin interfaceSearchResults- Returns:
- The maximum number of results to return from
next(), or 0 for no maximum.
-
setPageLength
public SearchResults setPageLength(int newPageLength)
Setter forpageLength: The maximum number of results to return fromnext(), or 0 for no maximum.- Specified by:
setPageLengthin interfaceSearchResults- Parameters:
newPageLength- The maximum number of results to return fromnext(), or 0 for no maximum.
-
getLastMatchId
public String getLastMatchId()
Getter forlastMatchId: The ID of the last match the iterator returned fromnext()- Specified by:
getLastMatchIdin interfaceSearchResults- Returns:
- The ID of the last match the iterator returned from
next()
-
reset
public void reset()
SearchResults method: Resets the iterator to the beginning of the list- Specified by:
resetin interfaceSearchResults
-
size
public int size()
SearchResults method: Returns the number of utterances in the collection.- Specified by:
sizein interfaceSearchResults- Returns:
- The number of utterances in the collection.
-
seek
public boolean seek(int n)
Go to the nth item in the list, so it will be the next returned bynext().- Specified by:
seekin interfaceSearchResults- Parameters:
n- The number of the item to seek to.- Returns:
- true if the nth item exists, false otherwise.
-
hasNext
public boolean hasNext()
Iterator method: Returns true if the iteration has more elements.
-
next
public String next()
Iterator method: Returns the next result ID.
-
close
public void close()
Close all open resources (there are none).- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
-