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