Package javax.help.search

# Class SearchQuery

java.lang.Object
javax.help.search.SearchQuery

public abstract class SearchQuery extends Object
The instance of a query on a search database. It is instantiated by SearchEngine.startQuery. Subclasses of SearchQuery can perform the search or negotiate the search results with an outside agent as setup in the SearchEngine class. A server search engine is an an example of an outside agent. Search results are returned through SearchEvents to listeners that register with a SearchEngine instance.

See Also:
  - `SearchEvent`
  - `SearchListener`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected SearchEngine`
`hs`
`protected Locale`
`l`
`protected EventListenerList`
`listenerList`
`protected String`
`searchparams`

## Constructor Summary

Constructors
Constructor
Description
`SearchQuery(SearchEngine hs)`
Creates a SearchQuery.

## Method Summary

Modifier and Type
Method
Description
`void`
`addSearchListener(SearchListener l)`
Adds a listener for the SearchEngine posted after the search has started, stopped, or search parameters have been defined.
`protected void`
`fireItemsFound(boolean inSearch, Vector docs)`
Notifies that a SearchItem has been found.
`protected void`
`fireItemsFound(SearchEvent e)`
Passs through that a SearchEvent has happened.
`protected void`
`fireSearchFinished()`
Notifies that a search has completed.
`protected void`
`fireSearchStarted()`
Notifies that a search has started.
`SearchEngine`
`getSearchEngine()`
Returns the SearchEngine associated with this SearchQuery.
`abstract boolean`
`isActive()`
Determines if this SearchQuery is active.
`void`
`itemsFound(boolean inSearch, Vector docs)`
Notifies that query of items is found in the search.
`void`
`removeSearchListener(SearchListener l)`
Removes a listener previously added with `addSearchListener`.
`void`
`start(String searchparams, Locale l)`
Starts the search.
`void`
`stop()`
Stops the search.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### listenerList

protected EventListenerList listenerList

### hs

protected SearchEngine hs

### searchparams

protected String searchparams

### l

protected Locale l

## Constructor Details

### SearchQuery

public SearchQuery(SearchEngine hs)
Creates a SearchQuery.

## Method Details

### addSearchListener

public void addSearchListener(SearchListener l)
Adds a listener for the SearchEngine posted after the search has started, stopped, or search parameters have been defined.

Parameters:
  `l` - The listener to add.
See Also:
  - invalid reference

        java.javahelp.SearchEngine#removeSearchListener

### removeSearchListener

public void removeSearchListener(SearchListener l)
Removes a listener previously added with `addSearchListener`.

Parameters:
  `l` - The listener to remove.
See Also:
  - invalid reference

        java.javahelp.SearchEngine#addSearchListener

### start

public void start(String searchparams, Locale l) throws IllegalArgumentException, IllegalStateException
Starts the search. This method invokes searchStarted on SearchListeners and stores the searchparams. Extensions of SearchQuery should fully implement this method according to the needs of the SearchQuery and its corresponding SearchEngine.

Parameters:
  `searchparams` - The search string.
  `locale` - The locale of the search string.
Throws:
  `IllegalArgumentException` - The parameters are not understood by this engine.
  `IllegalStateException` - There is an active search in progress in this instance.

### stop

public void stop() throws IllegalStateException
Stops the search. This method invokes searchStopped on SearchListeners. Extensions of SearchQuery should fully implement this method according to needs of the SearchQuery and its corresponding SearchEngine.

Throws:
  `IllegalStateException` - The search engine is not in a state in which it can be started.

### getSearchEngine

public SearchEngine getSearchEngine()
Returns the SearchEngine associated with this SearchQuery.

### isActive

public abstract boolean isActive()
Determines if this SearchQuery is active.

### itemsFound

public void itemsFound(boolean inSearch, Vector docs)
Notifies that query of items is found in the search.

Parameters:
  `inSearch` - Is the search completed?
  `docs` - A vector of SearchItem.

### fireItemsFound

protected void fireItemsFound(boolean inSearch, Vector docs)
Notifies that a SearchItem has been found.

Parameters:
  `inSearch` - Is the search completed?
  `docs` - A vector of SearchItem.
  `params` - The parameters to the search.
See Also:
  - `SearchItem`

### fireItemsFound

protected void fireItemsFound(SearchEvent e)
Passs through that a SearchEvent has happened. This is useful for SearchEngine engines that encapsulate others.

Parameters:
  `e` - The SearchEvent to pass through.

### fireSearchStarted

protected void fireSearchStarted()
Notifies that a search has started.

Parameters:
  `params` - The parameters to the search.

### fireSearchFinished

protected void fireSearchFinished()
Notifies that a search has completed.

Parameters:
  `params` - The parameters to the search.