~sword-devel/jsword/trunk

« back to all changes in this revision

Viewing changes to jsword/java/jsword/org/crosswire/jsword/book/raw/PuncItemsMem.java

  • Committer: joe
  • Date: 2002-10-08 21:36:18 UTC
  • Revision ID: svn-v4:a88caf3b-7e0a-0410-8d0d-cecb45342206:trunk:80
big config and comment update

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
import java.util.Hashtable;
10
10
 
11
11
/**
12
 
* PuncItemsMem is almost identical to WordItemsMem, but the Dictionary is
13
 
* much smaller, there are almost certainly less than 256 different
14
 
* intra-word punctuation sets, so we will only need 1 byte per word
15
 
* instead of 2.
16
 
*
17
 
* <table border='1' cellPadding='3' cellSpacing='0' width="100%">
18
 
* <tr><td bgColor='white'class='TableRowColor'><font size='-7'>
19
 
* Distribution Licence:<br />
20
 
* Project B is free software; you can redistribute it
21
 
* and/or modify it under the terms of the GNU General Public License,
22
 
* version 2 as published by the Free Software Foundation.<br />
23
 
* This program is distributed in the hope that it will be useful,
24
 
* but WITHOUT ANY WARRANTY; without even the implied warranty of
25
 
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26
 
* General Public License for more details.<br />
27
 
* The License is available on the internet
28
 
* <a href='http://www.gnu.org/copyleft/gpl.html'>here</a>, by writing to
29
 
* <i>Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
30
 
* MA 02111-1307, USA</i>, Or locally at the Licence link below.<br />
31
 
* The copyright to this program is held by it's authors.
32
 
* </font></td></tr></table>
33
 
* @see <a href='http://www.eireneh.com/servlets/Web'>Project B Home</a>
34
 
* @see <{docs.Licence}>
35
 
* @author Joe Walker
36
 
* @version D0.I0.T0
37
 
*/
 
12
 * PuncItemsMem is almost identical to WordItemsMem, but the Dictionary is
 
13
 * much smaller, there are almost certainly less than 256 different
 
14
 * intra-word punctuation sets, so we will only need 1 byte per word
 
15
 * instead of 2.
 
16
 * 
 
17
 * <p><table border='1' cellPadding='3' cellSpacing='0'>
 
18
 * <tr><td bgColor='white' class='TableRowColor'><font size='-7'>
 
19
 *
 
20
 * Distribution Licence:<br />
 
21
 * JSword is free software; you can redistribute it
 
22
 * and/or modify it under the terms of the GNU General Public License,
 
23
 * version 2 as published by the Free Software Foundation.<br />
 
24
 * This program is distributed in the hope that it will be useful,
 
25
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
26
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 
27
 * General Public License for more details.<br />
 
28
 * The License is available on the internet
 
29
 * <a href='http://www.gnu.org/copyleft/gpl.html'>here</a>, or by writing to:
 
30
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 
31
 * MA 02111-1307, USA<br />
 
32
 * The copyright to this program is held by it's authors.
 
33
 * </font></td></tr></table>
 
34
 * @see docs.Licence
 
35
 * @author Joe Walker [joe at eireneh dot com]
 
36
 * @version $Id$
 
37
 */
38
38
public class PuncItemsMem extends ItemsMem
39
39
{
40
40
    /**
41
 
    * Create a PuncItemsMem from a File that contains the dictionary.
42
 
    * @param raw Reference to the RawBible that is using us
43
 
    * @param filename The leaf name to read/write
44
 
    * @param create Should we start all over again
45
 
    */
 
41
     * Create a PuncItemsMem from a File that contains the dictionary.
 
42
     * @param raw Reference to the RawBible that is using us
 
43
     * @param filename The leaf name to read/write
 
44
     * @param create Should we start all over again
 
45
     */
46
46
    public PuncItemsMem(RawBible raw, boolean create) throws Exception
47
47
    {
48
48
        super(raw, "punc.idx", create);
49
49
    }
50
50
 
51
51
    /**
52
 
    * Create a PuncItemsMem from a File that contains the dictionary.
53
 
    * @param raw Reference to the RawBible that is using us
54
 
    * @param filename The leaf name to read/write
55
 
    * @param create Should we start all over again
56
 
    * @param messages We append stuff here if something went wrong
57
 
    */
 
52
     * Create a PuncItemsMem from a File that contains the dictionary.
 
53
     * @param raw Reference to the RawBible that is using us
 
54
     * @param filename The leaf name to read/write
 
55
     * @param create Should we start all over again
 
56
     * @param messages We append stuff here if something went wrong
 
57
     */
58
58
    public PuncItemsMem(RawBible raw, boolean create, StringBuffer messages)
59
59
    {
60
60
        super(raw, "punc.idx", create, messages);
61
61
    }
62
62
 
63
63
    /**
64
 
    * How many items are there in this index?
65
 
    * @return The number of items that we must remember
66
 
    */
 
64
     * How many items are there in this index?
 
65
     * @return The number of items that we must remember
 
66
     */
67
67
    public int getMaxItems()
68
68
    {
69
69
        return 1000;
70
70
    }
71
71
 
72
72
    /**
73
 
    * Load the Resource from a stream
74
 
    * @param in The stream to read from
75
 
    */
 
73
     * Load the Resource from a stream
 
74
     * @param in The stream to read from
 
75
     */
76
76
    public void load(InputStream in) throws IOException, ClassNotFoundException
77
77
    {
78
78
        DataInputStream din = new DataInputStream(in);
102
102
    }
103
103
 
104
104
    /**
105
 
    * Ensure that all changes to the index of words are written to a
106
 
    * stream
107
 
    * @param out The stream to write to
108
 
    */
 
105
     * Ensure that all changes to the index of words are written to a
 
106
     * stream
 
107
     * @param out The stream to write to
 
108
     */
109
109
    public void save(OutputStream out) throws IOException
110
110
    {
111
111
        DataOutputStream dout = new DataOutputStream(out);