Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.eireneh.bible.book.raw
Class ItemsMem  view ItemsMem download ItemsMem.java

java.lang.Object
  extended bycom.eireneh.bible.book.raw.Mem
      extended bycom.eireneh.bible.book.raw.ItemsMem
All Implemented Interfaces:
Items
Direct Known Subclasses:
PuncItemsMem, WordItemsMem

public abstract class ItemsMem
extends Mem
implements Items

ItemsMem is a Base implementation of the Items interface using the in memory model (Mem).
Distribution Licence:
Project B is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
The License is available on the internet here, by writing to Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, Or locally at the Licence link below.
The copyright to this program is held by it's authors.

Version:
D0.I0.T0

Field Summary
protected  java.lang.String[] array
          Converting indexes to Words - this is about the number of words in the Bible
protected  int count
          The number of items so far
protected  java.util.Hashtable hash
          Map of word to their indexes
 
Fields inherited from class com.eireneh.bible.book.raw.Mem
create, leafname, raw
 
Constructor Summary
ItemsMem(RawBible raw, java.lang.String leafname, boolean create)
          Create a WordResource from a File that contains the dictionary.
ItemsMem(RawBible raw, java.lang.String leafname, boolean create, java.lang.StringBuffer messages)
          Create a WordResource from a File that contains the dictionary.
 
Method Summary
protected  void defaultLoad(java.io.InputStream in)
          Load the Resource from a stream.
protected  void defaultSave(java.io.OutputStream out)
          Ensure that all changes to the index of words are written to a stream.
 java.util.Enumeration getEnumeration()
          Get an Enumeration through the words
 int getIndex(java.lang.String data)
          This method is called during the creation of the index to add a word to the index or to get a current id.
 int[] getIndex(java.lang.String[] data)
          Set a list of word indexes as the test to a Verse
 java.lang.String getItem(int index)
          Fetch an item from the dictionary by an id.
abstract  int getMaxItems()
          How many items are there in this index?
 void init()
          Start all over again and clear the decks for more data.
 int size()
          How many items are there in the current dictionary
 
Methods inherited from class com.eireneh.bible.book.raw.Mem
load, load, save, save
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.eireneh.bible.book.raw.Items
save
 

Field Detail

hash

protected java.util.Hashtable hash
Map of word to their indexes


array

protected java.lang.String[] array
Converting indexes to Words - this is about the number of words in the Bible


count

protected int count
The number of items so far

Constructor Detail

ItemsMem

public ItemsMem(RawBible raw,
                java.lang.String leafname,
                boolean create)
         throws java.lang.Exception
Create a WordResource from a File that contains the dictionary.


ItemsMem

public ItemsMem(RawBible raw,
                java.lang.String leafname,
                boolean create,
                java.lang.StringBuffer messages)
Create a WordResource from a File that contains the dictionary.

Method Detail

getMaxItems

public abstract int getMaxItems()
How many items are there in this index?


init

public void init()
Start all over again and clear the decks for more data.

Specified by:
init in class Mem

defaultLoad

protected void defaultLoad(java.io.InputStream in)
                    throws java.io.IOException,
                           java.lang.ClassNotFoundException
Load the Resource from a stream. This has been renamed from the default load() to ensure that the custom versions are called.


defaultSave

protected void defaultSave(java.io.OutputStream out)
                    throws java.io.IOException
Ensure that all changes to the index of words are written to a stream. This has been renamed from the default save() to ensure that the custom versions are called.


getEnumeration

public java.util.Enumeration getEnumeration()
Get an Enumeration through the words

Specified by:
getEnumeration in interface Items

getItem

public java.lang.String getItem(int index)
                         throws NoSuchResourceException
Fetch an item from the dictionary by an id.

Specified by:
getItem in interface Items

getIndex

public int getIndex(java.lang.String data)
This method is called during the creation of the index to add a word to the index or to get a current id. If the IndexedResource was created without create=true then we do not create a new id we just return -1

Specified by:
getIndex in interface Items

getIndex

public int[] getIndex(java.lang.String[] data)
Set a list of word indexes as the test to a Verse

Specified by:
getIndex in interface Items

size

public int size()
How many items are there in the current dictionary

Specified by:
size in interface Items