001/*
002 *                    BioJava development code
003 *
004 * This code may be freely distributed and modified under the
005 * terms of the GNU Lesser General Public Licence.  This should
006 * be distributed with the code.  If you do not have a copy,
007 * see:
008 *
009 *      http://www.gnu.org/copyleft/lesser.html
010 *
011 * Copyright for this code is held jointly by the individual
012 * authors.  These should be listed in @author doc comments.
013 *
014 * For more information on the BioJava project and its aims,
015 * or to join the biojava-l mailing list, visit the home page
016 * at:
017 *
018 *      http://www.biojava.org/
019 *
020 */
021package org.biojava.bio.search;
022
023
024/**
025 * <p>
026 * An adapter for SearchContentHandler.
027 * </p>
028 *
029 * <p>
030 * This adapter is in the same spirit as the event handler adapters in
031 * java.awt.event, and is intended as a simple base-class for implementations
032 * that only want to handle a small number of the possible call-backs. All
033 * method implementations are empty except for getMoreSearches() and
034 * setMoreSearches(). These two maintain a boolean state between calls.
035 * If you over-ride one, you should override the other.
036 * </p>
037 *
038 * <h2>Example</h2>
039 * <pre>
040 * // a very boring handler
041 * SearchContentHanlder ignoreEverything = new SearchContentAdapter();
042 *
043 * // just respond to sub hit properties
044 * SearchContentHander subHitsOnly = new SearchContentAdapter() {
045 *   public void addSubHitProperth(Object key, Object value) {
046 *     System.out.println(key + " -> " + value);
047 *   }
048 * };
049 * </pre>
050 * 
051 * @author Matthew Pocock
052 * @since 1.3
053 */
054public class SearchContentAdapter
055implements SearchContentHandler {
056  private boolean moreSearches = false;
057
058  public void addHitProperty(Object key, Object value) {}
059  public void addSearchProperty(Object key, Object value) {}
060  public void addSubHitProperty(Object key, Object value) {}
061  public void startHeader() {}
062  public void endHeader() {}
063  public void startHit() {}
064  public void endHit() {}
065  public void startSearch() {}
066  public void endSearch() {}
067  public void startSubHit() {}
068  public void endSubHit() {}
069  public void setQueryID(String queryID) {}
070  public void setDatabaseID(String databaseID) {}
071
072  public boolean getMoreSearches() {
073    return moreSearches;
074  }
075
076  public void setMoreSearches(boolean val) {
077    this.moreSearches = val;
078  }
079}