1   /**
2    * Distribution License:
3    * JSword is free software; you can redistribute it and/or modify it under
4    * the terms of the GNU Lesser General Public License, version 2.1 as published by
5    * the Free Software Foundation. This program is distributed in the hope
6    * that it will be useful, but WITHOUT ANY WARRANTY; without even the
7    * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
8    * See the GNU Lesser General Public License for more details.
9    *
10   * The License is available on the internet at:
11   *       http://www.gnu.org/copyleft/lgpl.html
12   * or by writing to:
13   *      Free Software Foundation, Inc.
14   *      59 Temple Place - Suite 330
15   *      Boston, MA 02111-1307, USA
16   *
17   * Copyright: 2008
18   *     The copyright to this program is held by it's authors.
19   *
20   * ID: $Id: org.eclipse.jdt.ui.prefs 1178 2006-11-06 12:48:02Z dmsmith $
21   */
22  package org.crosswire.jsword.index.lucene.analysis;
23  
24  import org.apache.lucene.analysis.TokenFilter;
25  import org.apache.lucene.analysis.TokenStream;
26  import org.crosswire.jsword.book.Book;
27  
28  /**
29   * An AbstractBookTokenFilter ties a Lucene TokenFilter to a Book.
30   * 
31   * @see gnu.lgpl.License for license details.<br>
32   *      The copyright to this program is held by it's authors.
33   * @author DM Smith [dmsmith555 at yahoo dot com]
34   */
35  public abstract class AbstractBookTokenFilter extends TokenFilter {
36  
37      /**
38       * Create a TokenFilter not tied to a Book.
39       * 
40       * @param input
41       *            the token stream to filter
42       */
43      public AbstractBookTokenFilter(TokenStream input) {
44          this(null, input);
45      }
46  
47      /**
48       * Create a TokenFilter tied to a Book.
49       * 
50       * @param input
51       *            the token stream to filter
52       */
53      public AbstractBookTokenFilter(Book book, TokenStream input) {
54          super(input);
55          this.book = book;
56      }
57  
58      /**
59       * @return the book
60       */
61      public Book getBook() {
62          return book;
63      }
64  
65      /**
66       * @param book
67       *            the book to set
68       */
69      public void setBook(Book book) {
70          this.book = book;
71      }
72  
73      /* Define to quite FindBugs */
74      @Override
75      public boolean equals(Object obj) {
76          return super.equals(obj);
77      }
78  
79      /* Define to quite FindBugs */
80      @Override
81      public int hashCode() {
82          return super.hashCode();
83      }
84  
85      private Book book;
86  }
87