SearchContentFilter (BioJava-1.5-beta API)
Keywords: org.biojava.bio.search.SearchContentFilter class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.biojava.bio.search
Class SearchContentFilter

    java.lang.Object
      org.biojava.bio.search.SearchContentFilter

All Implemented Interfaces:
  SearchContentHandler

    public class SearchContentFilter

extends Object
implements SearchContentHandler

Filtering implementation of SearchContentHandler that by default passes all messages on to the next delegate in the chain.

In this handler, all info will be passed onto a delegate handler. You can build up a chain of filters by using one filter as the delegate for another. When you over-ride a method in a filter, you can modify any state you wish. If you want that to propogate on, you should call the method on yourself via super.(), if not, just return.

It is your responsibility to ensure that the events emitted from your filter are sensible. In particular, start/end messages must be paired even after filtering.

## Example

     // we have a handler from somewhere
     SearchContentHandler handler = ...;

     // now we are going to mutate all "score" notifications to Double instances
     // from strings
     SearchContentHandler filter = new SearchContentFilter() {
       public void addHitProperty(Object key, Object value) {
         if("score".equals(key)) {
           if(value instanceof String) {
             value = new Double(value);
           }
         }
         super(key, value);
       }
     };

Since:
  1.3
Author:
  Matthew Pocock

Constructor Summary
`SearchContentFilter(SearchContentHandler delegate)`

Method Summary
`void` | `addHitProperty(Object key, Object value)` The `addHitProperty` method adds a key/value pair containing some property of a particular hit.
`void` | `addSearchProperty(Object key, Object value)` The `addSearchProperty` method adds a key/value pair containing some property of the overall search result.
`void` | `addSubHitProperty(Object key, Object value)` The `addSubHitProperty` method adds a key/value pair containing some property of a particular subhit.
`void` | `endHeader()` The `endHeader` method indicates the end of a formatted header.
`void` | `endHit()` The `endHit` method indicates the end of a formatted hit.
`void` | `endSearch()` The `endSearch` method indicates the end of useful search information.
`void` | `endSubHit()` The `endSubHit` method indicates the end of a formatted subhit.
`boolean` | `getMoreSearches()` `getMoreSearches` returns the state of the `SearchContentHandler` with respect to further searches from its data source.
`void` | `setDatabaseID(String databaseID)` `setDatabaseID` identifies the database searched by a name, ID or URN.
`void` | `setMoreSearches(boolean val)` `setMoreSearches` sets the state of the `SearchContentHandler`'s expectation of receiving more results.
`void` | `setQueryID(String queryID)` `setQueryID` identifies the query sequence by a name, ID or URN.
`void` | `startHeader()` The `startHeader` method indicates the start of a formatted header.
`void` | `startHit()` The `startHit` method indicates the start of a formatted hit.
`void` | `startSearch()` The `startSearch` method indicates the start of useful search information.
`void` | `startSubHit()` The `startSubHit` method indicates the start of a formatted subhit.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SearchContentFilter

    public SearchContentFilter(SearchContentHandler delegate)

Method Detail

### addHitProperty

    public void addHitProperty(Object key,
                               Object value)

  Description copied from interface: `SearchContentHandler`
  The `addHitProperty` method adds a key/value pair containing some property of a particular hit.

  Specified by:
    `addHitProperty` in interface `SearchContentHandler`
  Parameters:
    `key` - an `Object`.
    `value` - an `Object`.

### addSearchProperty

    public void addSearchProperty(Object key,
                                  Object value)

  Description copied from interface: `SearchContentHandler`
  The `addSearchProperty` method adds a key/value pair containing some property of the overall search result.

  Specified by:
    `addSearchProperty` in interface `SearchContentHandler`
  Parameters:
    `key` - an `Object`.
    `value` - an `Object`.

### addSubHitProperty

    public void addSubHitProperty(Object key,
                                  Object value)

  Description copied from interface: `SearchContentHandler`
  The `addSubHitProperty` method adds a key/value pair containing some property of a particular subhit.

  Specified by:
    `addSubHitProperty` in interface `SearchContentHandler`
  Parameters:
    `key` - an `Object`.
    `value` - an `Object`.

### startHeader

    public void startHeader()

  Description copied from interface: `SearchContentHandler`
  The `startHeader` method indicates the start of a formatted header. This usually contains information relevant to the search as a whole.

  Specified by:
    `startHeader` in interface `SearchContentHandler`

### endHeader

    public void endHeader()

  Description copied from interface: `SearchContentHandler`
  The `endHeader` method indicates the end of a formatted header.

  Specified by:
    `endHeader` in interface `SearchContentHandler`

### startHit

    public void startHit()

  Description copied from interface: `SearchContentHandler`
  The `startHit` method indicates the start of a formatted hit. This could be a single line, or a block of lines.

  Specified by:
    `startHit` in interface `SearchContentHandler`

### endHit

    public void endHit()

  Description copied from interface: `SearchContentHandler`
  The `endHit` method indicates the end of a formatted hit.

  Specified by:
    `endHit` in interface `SearchContentHandler`

### startSearch

    public void startSearch()

  Description copied from interface: `SearchContentHandler`
  The `startSearch` method indicates the start of useful search information.

  Specified by:
    `startSearch` in interface `SearchContentHandler`

### endSearch

    public void endSearch()

  Description copied from interface: `SearchContentHandler`
  The `endSearch` method indicates the end of useful search information.

  Specified by:
    `endSearch` in interface `SearchContentHandler`

### startSubHit

    public void startSubHit()

  Description copied from interface: `SearchContentHandler`
  The `startSubHit` method indicates the start of a formatted subhit. There may be zero or more of these per hit.

  Specified by:
    `startSubHit` in interface `SearchContentHandler`

### endSubHit

    public void endSubHit()

  Description copied from interface: `SearchContentHandler`
  The `endSubHit` method indicates the end of a formatted subhit.

  Specified by:
    `endSubHit` in interface `SearchContentHandler`

### setQueryID

    public void setQueryID(String queryID)

  Description copied from interface: `SearchContentHandler`
  `setQueryID` identifies the query sequence by a name, ID or URN.

  Specified by:
    `setQueryID` in interface `SearchContentHandler`
  Parameters:
    `queryID` - a `String` which should be an unique identifer for the sequence.

### setDatabaseID

    public void setDatabaseID(String databaseID)

  Description copied from interface: `SearchContentHandler`
  `setDatabaseID` identifies the database searched by a name, ID or URN.

  Specified by:
    `setDatabaseID` in interface `SearchContentHandler`
  Parameters:
    `databaseID` - a `String` which should be an unique identifier for the database searched.

### getMoreSearches

    public boolean getMoreSearches()

  Description copied from interface: `SearchContentHandler`
  `getMoreSearches` returns the state of the `SearchContentHandler` with respect to further searches from its data source. Used for handling streams of search results.

  Specified by:
    `getMoreSearches` in interface `SearchContentHandler`
  Returns:
    a `boolean` value.

### setMoreSearches

    public void setMoreSearches(boolean val)

  Description copied from interface: `SearchContentHandler`
  `setMoreSearches` sets the state of the `SearchContentHandler`'s expectation of receiving more results. Used for handling streams of search results.

  Specified by:
    `setMoreSearches` in interface `SearchContentHandler`
  Parameters:
    `val` - a `boolean` value.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD