Package ubic.gemma.core.search
Class SearchResultSet<T extends Identifiable>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<SearchResult<T>>
-
- ubic.gemma.core.search.SearchResultSet<T>
-
- All Implemented Interfaces:
Iterable<SearchResult<T>>
,Collection<SearchResult<T>>
,Set<SearchResult<T>>
public class SearchResultSet<T extends Identifiable> extends AbstractSet<SearchResult<T>>
This is a special kind of set designed for holdingSearchResult
.If a better result is added to the set, it replaces the existing one. If the original result had a non-null
SearchResult#getResultObject()
, it is transferred over so that it won't need to be filled later on if needed.The collection also honor the
SearchSettings#getMaxResults()
value, rejecting any new result unless replacing an existing one.- Author:
- poirigui
-
-
Constructor Summary
Constructors Constructor Description SearchResultSet(SearchSettings settings)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(SearchResult<T> t)
Iterator<SearchResult<T>>
iterator()
int
size()
-
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
-
Methods inherited from class java.util.AbstractCollection
addAll, clear, contains, containsAll, isEmpty, remove, 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.Collection
parallelStream, removeIf, stream
-
-
-
-
Constructor Detail
-
SearchResultSet
public SearchResultSet(SearchSettings settings)
-
-
Method Detail
-
iterator
public Iterator<SearchResult<T>> iterator()
- Specified by:
iterator
in interfaceCollection<T extends Identifiable>
- Specified by:
iterator
in interfaceIterable<T extends Identifiable>
- Specified by:
iterator
in interfaceSet<T extends Identifiable>
- Specified by:
iterator
in classAbstractCollection<SearchResult<T extends Identifiable>>
-
size
public int size()
- Specified by:
size
in interfaceCollection<T extends Identifiable>
- Specified by:
size
in interfaceSet<T extends Identifiable>
- Specified by:
size
in classAbstractCollection<SearchResult<T extends Identifiable>>
-
add
public boolean add(SearchResult<T> t)
- Specified by:
add
in interfaceCollection<T extends Identifiable>
- Specified by:
add
in interfaceSet<T extends Identifiable>
- Overrides:
add
in classAbstractCollection<SearchResult<T extends Identifiable>>
-
-