Source code: com/eireneh/bible/book/raw/Items.java
1
2 package com.eireneh.bible.book.raw;
3
4 import java.util.Enumeration;
5 import java.io.IOException;
6
7 /**
8 * Items is a list of words, puncuation marks or other bits of data that
9 * can be indexed by number.
10 *
11 * <table border='1' cellPadding='3' cellSpacing='0' width="100%">
12 * <tr><td bgColor='white'class='TableRowColor'><font size='-7'>
13 * Distribution Licence:<br />
14 * Project B is free software; you can redistribute it
15 * and/or modify it under the terms of the GNU General Public License,
16 * version 2 as published by the Free Software Foundation.<br />
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.<br />
21 * The License is available on the internet
22 * <a href='http://www.gnu.org/copyleft/gpl.html'>here</a>, by writing to
23 * <i>Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
24 * MA 02111-1307, USA</i>, Or locally at the Licence link below.<br />
25 * The copyright to this program is held by it's authors.
26 * </font></td></tr></table>
27 * @see <a href='http://www.eireneh.com/servlets/Web'>Project B Home</a>
28 * @see docs.Licence
29 * @author Joe Walker
30 * @version D0.I0.T0
31 */
32 public interface Items
33 {
34 /**
35 * Get an Enumeration through the words
36 * @return An Enumeration
37 */
38 public Enumeration getEnumeration();
39
40 /**
41 * Fetch an item from the dictionary by an id.
42 * @param index The id of the word to fetch
43 * @exception NoSuchWordException
44 */
45 public String getItem(int index) throws NoSuchResourceException;
46
47 /**
48 * This method is called during the creation of the index to add a
49 * word to the index or to get a current id. If the IndexedResource
50 * was created without create=true then we do not create a new id
51 * we just return -1
52 * @param data The word to find/create an id for
53 * @return The (new) id for the item, or -1
54 */
55 public int getIndex(String data);
56
57 /**
58 * Set a list of word indexes as the test to a Verse
59 * @param verse The Verse to set the words for
60 * @param data The array of wordd to be indexed
61 */
62 public int[] getIndex(String[] data);
63
64 /**
65 * How many items are there in the current dictionary
66 * @return the Item count
67 */
68 public int size();
69
70 /**
71 * Ensure that all changes to the index of words are written to disk
72 */
73 public void save() throws IOException;
74 }