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: 2007
18   *     The copyright to this program is held by it's authors.
19   *
20   * ID: $Id: Bookmark.java 1605 2007-08-03 21:34:46Z dmsmith $
21   */
22  package org.crosswire.jsword.book;
23  
24  import java.io.Serializable;
25  import java.util.List;
26  
27  import org.crosswire.jsword.index.search.SearchRequest;
28  
29  /**
30   * A Bookmark remembers a particular view of one or more Books. What is viewed
31   * regarding a book set is either a SearchRequest or a key lookup request.
32   * 
33   * @see gnu.lgpl.License for license details.<br>
34   *      The copyright to this program is held by it's authors.
35   * @author DM Smith [dmsmith555 at yahoo dot com]
36   */
37  public interface Bookmark extends Serializable, Cloneable {
38      /**
39       * Add a Book to this Bookmark. The books are maintained in the order they
40       * are added as a set.
41       * 
42       * @param book
43       *            the Book to add.
44       */
45      void addBook(Book book);
46  
47      /**
48       * Return the ordered set of books.
49       * 
50       * @return the books
51       */
52      List<Book> getBooks();
53  
54      /**
55       * Set the SearchRequest for this Bookmark. A copy of the SearchRequest will
56       * be stored. Note, setting this will clear the lookup request, if any.
57       * 
58       * @param request
59       *            the SearchRequest
60       */
61      void setSearchRequest(SearchRequest request);
62  
63      /**
64       * Get the SearchRequest for this Bookmark.
65       * 
66       * @return a copy of the SearchRequest, or null.
67       */
68      SearchRequest getSearchRequest();
69  
70      /**
71       * Set the lookup request for this Bookmark. Note, setting this will clear
72       * the SearchRequest, if any.
73       * 
74       * @param request
75       *            the lookup request.
76       */
77      void setLookupRequest(String request);
78  
79      /**
80       * Get the lookup request.
81       * 
82       * @return the lookup request or null.
83       */
84      String getLookupRequest();
85  
86      /**
87       * Convert this Bookmark into a BookData by converting the SearchReqeust or
88       * lookup request into a key list.
89       * 
90       * @return the resulting BookData
91       */
92      BookData getBookData();
93  
94      /**
95       * This needs to be declared here so that it is visible as a method on a
96       * derived Bookmark.
97       * 
98       * @return A complete copy of ourselves
99       */
100     Bookmark clone();
101 }
102