Package org.biojava.bio.search
Class SearchContentAdapter
- java.lang.Object
-
- org.biojava.bio.search.SearchContentAdapter
-
- All Implemented Interfaces:
SearchContentHandler
- Direct Known Subclasses:
FilteringContentHandler
public class SearchContentAdapter extends Object implements SearchContentHandler
An adapter for SearchContentHandler.
This adapter is in the same spirit as the event handler adapters in java.awt.event, and is intended as a simple base-class for implementations that only want to handle a small number of the possible call-backs. All method implementations are empty except for getMoreSearches() and setMoreSearches(). These two maintain a boolean state between calls. If you over-ride one, you should override the other.
Example
// a very boring handler SearchContentHanlder ignoreEverything = new SearchContentAdapter(); // just respond to sub hit properties SearchContentHander subHitsOnly = new SearchContentAdapter() { public void addSubHitProperth(Object key, Object value) { System.out.println(key + " -> " + value); } };- Since:
- 1.3
- Author:
- Matthew Pocock
-
-
Constructor Summary
Constructors Constructor Description SearchContentAdapter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddHitProperty(Object key, Object value)TheaddHitPropertymethod adds a key/value pair containing some property of a particular hit.voidaddSearchProperty(Object key, Object value)TheaddSearchPropertymethod adds a key/value pair containing some property of the overall search result.voidaddSubHitProperty(Object key, Object value)TheaddSubHitPropertymethod adds a key/value pair containing some property of a particular subhit.voidendHeader()TheendHeadermethod indicates the end of a formatted header.voidendHit()TheendHitmethod indicates the end of a formatted hit.voidendSearch()TheendSearchmethod indicates the end of useful search information.voidendSubHit()TheendSubHitmethod indicates the end of a formatted subhit.booleangetMoreSearches()getMoreSearchesreturns the state of theSearchContentHandlerwith respect to further searches from its data source.voidsetDatabaseID(String databaseID)setDatabaseIDidentifies the database searched by a name, ID or URN.voidsetMoreSearches(boolean val)setMoreSearchessets the state of theSearchContentHandler's expectation of receiving more results.voidsetQueryID(String queryID)setQueryIDidentifies the query sequence by a name, ID or URN.voidstartHeader()ThestartHeadermethod indicates the start of a formatted header.voidstartHit()ThestartHitmethod indicates the start of a formatted hit.voidstartSearch()ThestartSearchmethod indicates the start of useful search information.voidstartSubHit()ThestartSubHitmethod indicates the start of a formatted subhit.
-
-
-
Constructor Detail
-
SearchContentAdapter
public SearchContentAdapter()
-
-
Method Detail
-
addHitProperty
public void addHitProperty(Object key, Object value)
Description copied from interface:SearchContentHandlerTheaddHitPropertymethod adds a key/value pair containing some property of a particular hit.- Specified by:
addHitPropertyin interfaceSearchContentHandler- Parameters:
key- anObject.value- anObject.
-
addSearchProperty
public void addSearchProperty(Object key, Object value)
Description copied from interface:SearchContentHandlerTheaddSearchPropertymethod adds a key/value pair containing some property of the overall search result.- Specified by:
addSearchPropertyin interfaceSearchContentHandler- Parameters:
key- anObject.value- anObject.
-
addSubHitProperty
public void addSubHitProperty(Object key, Object value)
Description copied from interface:SearchContentHandlerTheaddSubHitPropertymethod adds a key/value pair containing some property of a particular subhit.- Specified by:
addSubHitPropertyin interfaceSearchContentHandler- Parameters:
key- anObject.value- anObject.
-
startHeader
public void startHeader()
Description copied from interface:SearchContentHandlerThestartHeadermethod indicates the start of a formatted header. This usually contains information relevant to the search as a whole.- Specified by:
startHeaderin interfaceSearchContentHandler
-
endHeader
public void endHeader()
Description copied from interface:SearchContentHandlerTheendHeadermethod indicates the end of a formatted header.- Specified by:
endHeaderin interfaceSearchContentHandler
-
startHit
public void startHit()
Description copied from interface:SearchContentHandlerThestartHitmethod indicates the start of a formatted hit. This could be a single line, or a block of lines.- Specified by:
startHitin interfaceSearchContentHandler
-
endHit
public void endHit()
Description copied from interface:SearchContentHandlerTheendHitmethod indicates the end of a formatted hit.- Specified by:
endHitin interfaceSearchContentHandler
-
startSearch
public void startSearch()
Description copied from interface:SearchContentHandlerThestartSearchmethod indicates the start of useful search information.- Specified by:
startSearchin interfaceSearchContentHandler
-
endSearch
public void endSearch()
Description copied from interface:SearchContentHandlerTheendSearchmethod indicates the end of useful search information.- Specified by:
endSearchin interfaceSearchContentHandler
-
startSubHit
public void startSubHit()
Description copied from interface:SearchContentHandlerThestartSubHitmethod indicates the start of a formatted subhit. There may be zero or more of these per hit.- Specified by:
startSubHitin interfaceSearchContentHandler
-
endSubHit
public void endSubHit()
Description copied from interface:SearchContentHandlerTheendSubHitmethod indicates the end of a formatted subhit.- Specified by:
endSubHitin interfaceSearchContentHandler
-
setQueryID
public void setQueryID(String queryID)
Description copied from interface:SearchContentHandlersetQueryIDidentifies the query sequence by a name, ID or URN.- Specified by:
setQueryIDin interfaceSearchContentHandler- Parameters:
queryID- aStringwhich should be an unique identifer for the sequence.
-
setDatabaseID
public void setDatabaseID(String databaseID)
Description copied from interface:SearchContentHandlersetDatabaseIDidentifies the database searched by a name, ID or URN.- Specified by:
setDatabaseIDin interfaceSearchContentHandler- Parameters:
databaseID- aStringwhich should be an unique identifier for the database searched.
-
getMoreSearches
public boolean getMoreSearches()
Description copied from interface:SearchContentHandlergetMoreSearchesreturns the state of theSearchContentHandlerwith respect to further searches from its data source. Used for handling streams of search results.- Specified by:
getMoreSearchesin interfaceSearchContentHandler- Returns:
- a
booleanvalue.
-
setMoreSearches
public void setMoreSearches(boolean val)
Description copied from interface:SearchContentHandlersetMoreSearchessets the state of theSearchContentHandler's expectation of receiving more results. Used for handling streams of search results.- Specified by:
setMoreSearchesin interfaceSearchContentHandler- Parameters:
val- abooleanvalue.
-
-