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

Quick Search    Search Deep

com.eireneh.bible.book
Class BookUtil  view BookUtil download BookUtil.java

java.lang.Object
  extended bycom.eireneh.bible.book.BookUtil

public class BookUtil
extends java.lang.Object

The BookUtil class provide utility functions for the various Books.
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:
D2.I0.T0

Constructor Summary
private BookUtil()
          Ensure we can not be instansiated
 
Method Summary
protected static int firstLetter(java.lang.String word)
          Where is the first letter in this word
static int[] getCases(java.lang.String[] words)
          From a sentance get a list of words (in original order) without any punctuation, and all in lower case.
static com.eireneh.bible.passage.Passage getPassage(Bible version, java.lang.String[] words)
          A basic version of getPassage(String[]) simply calls getPassage(String) in a loop for each word, adding the Verses to an Passage that is returned
static java.lang.String[] getWords(java.lang.String sentance)
          From a sentance get a list of words (in original order) without any punctuation, and all in lower case.
static boolean isNewPara(BibleEle doc)
          This is a helper method to detect an attribute of para=true in the first ref node in the document.
protected static int lastLetter(java.lang.String word)
          Where is the last letter in this word
static java.lang.String[] stripPunctuation(java.lang.String[] words)
          From a sentance get a list of words (in original order) without any punctuation, and all in lower case.
protected static java.lang.String stripPunctuationWord(java.lang.String word)
          Remove the punctuation from the ends of the word
static java.lang.String[] stripWords(java.lang.String[] words)
          From a sentance get a list of words (in original order) without any punctuation, and all in lower case.
protected static java.lang.String stripWords(java.lang.String first, java.lang.String last)
          Remove the punctuation from the ends of the word.
static java.lang.String[] tokenize(java.lang.String sentance)
          Take a string and tokenize it using " " and "--" as delimiters into an Array of Strings.
static void updatePassageTally(Bible version, com.eireneh.bible.passage.PassageTally tally, java.lang.String[] words)
          A basic version of getPassageTally(String[]) simply calls getPassage(String) in a loop for each word, adding the Verses to an PassageTally that is returned
static void updatePassageTallyFlat(Bible version, com.eireneh.bible.passage.PassageTally tally, java.lang.String[] words)
          This is similar to updatePassageTally() however if a verse matches many words it still only adds on for that verse in the given tally
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BookUtil

private BookUtil()
Ensure we can not be instansiated

Method Detail

updatePassageTally

public static void updatePassageTally(Bible version,
                                      com.eireneh.bible.passage.PassageTally tally,
                                      java.lang.String[] words)
                               throws BookException
A basic version of getPassageTally(String[]) simply calls getPassage(String) in a loop for each word, adding the Verses to an PassageTally that is returned


updatePassageTallyFlat

public static void updatePassageTallyFlat(Bible version,
                                          com.eireneh.bible.passage.PassageTally tally,
                                          java.lang.String[] words)
                                   throws BookException
This is similar to updatePassageTally() however if a verse matches many words it still only adds on for that verse in the given tally


getPassage

public static com.eireneh.bible.passage.Passage getPassage(Bible version,
                                                           java.lang.String[] words)
                                                    throws BookException
A basic version of getPassage(String[]) simply calls getPassage(String) in a loop for each word, adding the Verses to an Passage that is returned


isNewPara

public static boolean isNewPara(BibleEle doc)
This is a helper method to detect an attribute of para=true in the first ref node in the document. Now this code looks very badly written - it is very deeply nested. 8 levels of indentation is enough to give any code analysis tool a fit. However I think it is such simple code, and the alternative does not actually make it any simpler?...


tokenize

public static java.lang.String[] tokenize(java.lang.String sentance)
Take a string and tokenize it using " " and "--" as delimiters into an Array of Strings. There is a question mark over what to do with initial spaces. This algorithm disgards them, I'm not sure if this is the right thing to do.


getWords

public static java.lang.String[] getWords(java.lang.String sentance)
From a sentance get a list of words (in original order) without any punctuation, and all in lower case.


stripPunctuation

public static java.lang.String[] stripPunctuation(java.lang.String[] words)
From a sentance get a list of words (in original order) without any punctuation, and all in lower case.


stripPunctuationWord

protected static java.lang.String stripPunctuationWord(java.lang.String word)
Remove the punctuation from the ends of the word


stripWords

public static java.lang.String[] stripWords(java.lang.String[] words)
From a sentance get a list of words (in original order) without any punctuation, and all in lower case.


stripWords

protected static java.lang.String stripWords(java.lang.String first,
                                             java.lang.String last)
Remove the punctuation from the ends of the word. The special case is that if the first word ends "--" and the last word has no punctuation at the beginning, then the answer is "--" and not "-- ". We miss out the space because "--" is a special separator.


getCases

public static int[] getCases(java.lang.String[] words)
From a sentance get a list of words (in original order) without any punctuation, and all in lower case.


firstLetter

protected static final int firstLetter(java.lang.String word)
Where is the first letter in this word


lastLetter

protected static final int lastLetter(java.lang.String word)
Where is the last letter in this word