[jsword-svn] r1221 - in trunk: jsword/src/main/java/org/crosswire/jsword/book jsword/src/main/java/org/crosswire/jsword/examples jsword/src/main/java/org/crosswire/jsword/index/lucene jsword/src/main/java/org/crosswire/jsword/passage jsword-limbo/src/main/java/org/crosswire/bibledesktop/passage
dmsmith at www.crosswire.org
dmsmith at www.crosswire.org
Tue Dec 19 15:50:05 MST 2006
Author: dmsmith
Date: 2006-12-19 15:50:05 -0700 (Tue, 19 Dec 2006)
New Revision: 1221
Modified:
trunk/jsword-limbo/src/main/java/org/crosswire/bibledesktop/passage/PassageListCellRenderer.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/Book.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/BookData.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/DataPolice.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/OSISUtil.java
trunk/jsword/src/main/java/org/crosswire/jsword/examples/APIExamples.java
trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/LuceneIndex.java
trunk/jsword/src/main/java/org/crosswire/jsword/passage/AbstractKeyList.java
trunk/jsword/src/main/java/org/crosswire/jsword/passage/AbstractPassage.java
trunk/jsword/src/main/java/org/crosswire/jsword/passage/DefaultLeafKeyList.java
trunk/jsword/src/main/java/org/crosswire/jsword/passage/Key.java
trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageTally.java
trunk/jsword/src/main/java/org/crosswire/jsword/passage/ReadOnlyKeyList.java
trunk/jsword/src/main/java/org/crosswire/jsword/passage/ReadOnlyPassage.java
trunk/jsword/src/main/java/org/crosswire/jsword/passage/SynchronizedPassage.java
trunk/jsword/src/main/java/org/crosswire/jsword/passage/Verse.java
trunk/jsword/src/main/java/org/crosswire/jsword/passage/VerseRange.java
Log:
Made indexing more generic.
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/Book.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/Book.java 2006-12-19 21:10:44 UTC (rev 1220)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/Book.java 2006-12-19 22:50:05 UTC (rev 1221)
@@ -56,7 +56,7 @@
/**
* Retrieval: Add to the given document some mark-up for the specified
* Verses.
- * @param key The verses to search for
+ * @param key The item to locate
* @return The found Book data
* @throws BookException If anything goes wrong with this method
*/
@@ -64,7 +64,7 @@
/**
* Returns the raw text that getData(Key key) builds into OSIS.
- * @param key The verses to search for
+ * @param key The item to locate
* @return The found Book data
* @throws BookException If anything goes wrong with this method
*/
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/BookData.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/BookData.java 2006-12-19 21:10:44 UTC (rev 1220)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/BookData.java 2006-12-19 22:50:05 UTC (rev 1221)
@@ -69,18 +69,17 @@
}
/**
- * Return the verse's text without any extra-biblical material.
- * @return The Bible text without markup
+ * Return the text without any extra material.
+ * @return The Book's text without markup
*/
- public String getVerseText()
+ public String getCanonicalText()
{
- return OSISUtil.getVerseText(getOsis());
+ return OSISUtil.getCanonicalText(getOsis());
}
/**
* A simplified plain text version of the data in this document with all
* the markup stripped out. This is not as simple as it seems.
- * TODO(DMS): push this into OSISUtil
* @return The text without markup
*/
public String getPlainText()
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/DataPolice.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/DataPolice.java 2006-12-19 21:10:44 UTC (rev 1220)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/DataPolice.java 2006-12-19 22:50:05 UTC (rev 1221)
@@ -51,7 +51,7 @@
}
/**
- * Set the current verse to enhance error reports
+ * Set the current item to enhance error reports
*/
public static void setKey(Key key)
{
@@ -59,7 +59,7 @@
}
/**
- * Report a message against the current verse
+ * Report a message against the current item
*/
public static void report(String message)
{
@@ -83,7 +83,7 @@
}
/**
- * the last known verse
+ * the last known item
*/
private static Key key;
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/OSISUtil.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/OSISUtil.java 2006-12-19 21:10:44 UTC (rev 1220)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/OSISUtil.java 2006-12-19 22:50:05 UTC (rev 1221)
@@ -506,7 +506,7 @@
}
/**
- * Get the verse text from an osis document consisting of a single verse.
+ * Get the canonical text from an osis document consisting of a single fragment.
* The document is assumed to be valid OSIS2.0 XML. While xml valid
* is rigidly defined as meaning that an xml parser can validate the document,
* it does not mean that the document is valid OSIS. This is a semantic
@@ -521,14 +521,14 @@
* <p>The osisText element contains a div element that is either
* a container or a milestone. Again, JSword is providing the
* div element and it will be provided as a container. It is this div
- * that "contains" the verse element.</p>
- * <p>The verse element may either be
+ * that "contains" the actual fragment.</p>
+ * <p>A verse element may either be
* a container or a milestone. Sword OSIS books differ in whether
* they provide the verse element. Most do not. The few that do are
* using the container model, but it has been proposed that milestones
* are the best practice.</p>
*
- * <p>The verse may contain elements that are not a part of the
+ * <p>The fragment may contain elements that are not a part of the
* original text. These are things such as notes.</p>
*
* <p>Milestones require special handling. Beginning milestones
@@ -539,9 +539,9 @@
* as if they were container elements.</p>
*
* @param root the whole osis document.
- * @return The Bible text without markup
+ * @return The canonical text without markup
*/
- public static String getVerseText(Element root)
+ public static String getCanonicalText(Element root)
{
StringBuffer buffer = new StringBuffer();
@@ -549,7 +549,7 @@
Element div = osisText.getChild(OSISUtil.OSIS_ELEMENT_DIV);
Iterator dit = div.getContent().iterator();
- String sid = null;
+ String sID = null;
Object data = null;
Element ele = null;
while (dit.hasNext())
@@ -558,18 +558,18 @@
if (data instanceof Element)
{
ele = (Element) data;
- if (ele.getName().equals(OSISUtil.OSIS_ELEMENT_VERSE))
- {
- sid = ele.getAttributeValue(OSISUtil.OSIS_ATTR_SID);
- if (sid != null)
+// if (ele.getName().equals(OSISUtil.OSIS_ELEMENT_VERSE))
+// {
+ sID = ele.getAttributeValue(OSISUtil.OSIS_ATTR_SID);
+ if (sID != null)
{
- getVerseContent(dit, buffer);
+ getCanonicalContent(ele.getName(), sID, dit, buffer);
}
else
{
- getVerseContent(ele.getContent().iterator(), buffer);
+ getCanonicalContent(ele.getName(), null, ele.getContent().iterator(), buffer);
}
- }
+// }
}
else if (data instanceof Text)
{
@@ -616,23 +616,23 @@
return buffer.toString().trim();
}
- private static void getVerseContent(Iterator iter, StringBuffer buffer)
+ private static void getCanonicalContent(String sName, String sID, Iterator iter, StringBuffer buffer)
{
Object data = null;
Element ele = null;
String eleName = null;
+ String eID = null;
while (iter.hasNext())
{
data = iter.next();
if (data instanceof Element)
{
ele = (Element) data;
- // If the verse is done then quit.
- // This should be a verse eID=, that matches sID, but it does not matter.
- // Since this gets the text of one verse, any verse element that follows
- // is the end of the previous verse.
+ // If the milestoned element is done then quit.
+ // This should be a eID=, that matches sID, from the same element.
eleName = ele.getName();
- if (eleName.equals(OSISUtil.OSIS_ELEMENT_VERSE))
+ eID = ele.getAttributeValue(OSISUtil.OSIS_ATTR_SID);
+ if (eID != null && eID.equals(sID) && eleName.equals(sName))
{
break;
}
@@ -640,7 +640,7 @@
// Ignore extra-biblical text
if (!EXTRA_BIBLICAL_ELEMENTS.contains(eleName))
{
- OSISUtil.getVerseContent(ele.getContent().iterator(), buffer);
+ OSISUtil.getCanonicalContent(sName, sID, ele.getContent().iterator(), buffer);
}
}
else if (data instanceof Text)
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/examples/APIExamples.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/examples/APIExamples.java 2006-12-19 21:10:44 UTC (rev 1220)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/examples/APIExamples.java 2006-12-19 22:50:05 UTC (rev 1221)
@@ -80,7 +80,7 @@
Key key = bible.getKey("Gen 1 1"); //$NON-NLS-1$
BookData data = bible.getData(key);
- String text = data.getVerseText();
+ String text = data.getCanonicalText();
System.out.println("The plain text of Gen 1:1 is " + text); //$NON-NLS-1$
}
@@ -247,7 +247,7 @@
{
Verse verse = (Verse) iter.next();
BookData data = bible.getData(verse);
- System.out.println('|' + BibleInfo.getBookName(verse.getBook()) + '|' + verse.getChapter() + '|' + verse.getVerse() + '|' + data.getVerseText());
+ System.out.println('|' + BibleInfo.getBookName(verse.getBook()) + '|' + verse.getChapter() + '|' + verse.getVerse() + '|' + data.getCanonicalText());
}
}
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/LuceneIndex.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/LuceneIndex.java 2006-12-19 21:10:44 UTC (rev 1220)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/LuceneIndex.java 2006-12-19 22:50:05 UTC (rev 1221)
@@ -56,13 +56,11 @@
import org.crosswire.jsword.index.search.SearchModifier;
import org.crosswire.jsword.passage.AbstractPassage;
import org.crosswire.jsword.passage.Key;
-import org.crosswire.jsword.passage.KeyUtil;
import org.crosswire.jsword.passage.NoSuchKeyException;
import org.crosswire.jsword.passage.NoSuchVerseException;
import org.crosswire.jsword.passage.PassageTally;
import org.crosswire.jsword.passage.Verse;
import org.crosswire.jsword.passage.VerseFactory;
-import org.crosswire.jsword.versification.BibleInfo;
/**
* Implement the SearchEngine using Lucene as the search engine.
@@ -127,7 +125,7 @@
IndexWriter writer = new IndexWriter(tempPath.getCanonicalPath(), new SimpleAnalyzer(), true);
List errors = new ArrayList();
- generateSearchIndexImpl(job, errors, writer, book.getGlobalKeyList());
+ generateSearchIndexImpl(job, errors, writer, book.getGlobalKeyList(), 0);
job.setSectionName(Msg.OPTIMIZING.toString());
job.setWork(95);
@@ -321,23 +319,23 @@
/**
* Dig down into a Key indexing as we go.
*/
- private void generateSearchIndexImpl(Progress job, List errors, IndexWriter writer, Key key) throws BookException, IOException
+ private void generateSearchIndexImpl(Progress job, List errors, IndexWriter writer, Key key, int count) throws BookException, IOException
{
- int bookNum = 0;
- int oldBookNum = -1;
+ String oldRootName = ""; //$NON-NLS-1$
int percent = 0;
- String name = ""; //$NON-NLS-1$
+ String rootName = ""; //$NON-NLS-1$
String text = ""; //$NON-NLS-1$
BookData data = null;
Key subkey = null;
- Verse verse = null;
Document doc = null;
+ int size = key.getCardinality();
+ int subCount = count;
for (Iterator it = key.iterator(); it.hasNext(); )
{
subkey = (Key) it.next();
if (subkey.canHaveChildren())
{
- generateSearchIndexImpl(job, errors, writer, subkey);
+ generateSearchIndexImpl(job, errors, writer, subkey, subCount);
}
else
{
@@ -352,7 +350,7 @@
continue;
}
- text = data.getVerseText();
+ text = data.getCanonicalText();
// Do the actual indexing
if (text != null && text.length() > 0)
@@ -364,26 +362,16 @@
}
// report progress
- verse = KeyUtil.getVerse(subkey);
-
- try
+ rootName = subkey.getRootName();
+ if (!rootName.equals(oldRootName))
{
- percent = 95 * verse.getOrdinal() / BibleInfo.versesInBible();
- bookNum = verse.getBook();
- if (oldBookNum != bookNum)
- {
- name = BibleInfo.getBookName(bookNum);
- oldBookNum = bookNum;
- }
+ oldRootName = rootName;
+ job.setSectionName(Msg.INDEXING.toString(rootName));
}
- catch (NoSuchVerseException ex)
- {
- log.error("Failed to get book name from verse: " + verse, ex); //$NON-NLS-1$
- assert false;
- name = subkey.getName();
- }
- job.setSectionName(Msg.INDEXING.toString(name));
+ subCount++;
+ percent = 95 * subCount / size;
+
job.setWork(percent);
// This could take a long time ...
@@ -415,12 +403,12 @@
* sharing indexes.
*/
/**
- * The Lucene field for the verse name
+ * The Lucene field for the osisID
*/
protected static final String FIELD_NAME = "key"; //$NON-NLS-1$
/**
- * The Lucene field for the verse contents
+ * The Lucene field for the text contents
*/
protected static final String FIELD_BODY = "content"; //$NON-NLS-1$
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/AbstractKeyList.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/AbstractKeyList.java 2006-12-19 21:10:44 UTC (rev 1220)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/AbstractKeyList.java 2006-12-19 22:50:05 UTC (rev 1221)
@@ -137,6 +137,14 @@
}
/* (non-Javadoc)
+ * @see org.crosswire.jsword.passage.Key#getRootName()
+ */
+ public String getRootName()
+ {
+ return getName();
+ }
+
+ /* (non-Javadoc)
* @see org.crosswire.jsword.passage.Key#getOSISRef()
*/
public String getOsisRef()
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/AbstractPassage.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/AbstractPassage.java 2006-12-19 21:10:44 UTC (rev 1220)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/AbstractPassage.java 2006-12-19 22:50:05 UTC (rev 1221)
@@ -206,6 +206,18 @@
return getName();
}
+ public String getRootName()
+ {
+ Iterator it = rangeIterator(RestrictionType.NONE);
+ while (it.hasNext())
+ {
+ VerseRange range = (VerseRange) it.next();
+ return range.getRootName();
+ }
+
+ return getName();
+ }
+
/* (non-Javadoc)
* @see org.crosswire.jsword.passage.Passage#getOSISName()
*/
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/DefaultLeafKeyList.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/DefaultLeafKeyList.java 2006-12-19 21:10:44 UTC (rev 1220)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/DefaultLeafKeyList.java 2006-12-19 22:50:05 UTC (rev 1221)
@@ -69,7 +69,7 @@
}
/* (non-Javadoc)
- * @see org.crosswire.jsword.book.Key#getText()
+ * @see org.crosswire.jsword.passage.Key#getName()
*/
public String getName()
{
@@ -85,6 +85,14 @@
}
/* (non-Javadoc)
+ * @see org.crosswire.jsword.passage.Key#getRootName()
+ */
+ public String getRootName()
+ {
+ return getName();
+ }
+
+ /* (non-Javadoc)
* @see org.crosswire.jsword.passage.Key#getOSISRef()
*/
public String getOsisRef()
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/Key.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/Key.java 2006-12-19 21:10:44 UTC (rev 1220)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/Key.java 2006-12-19 22:50:05 UTC (rev 1221)
@@ -47,6 +47,15 @@
String getName();
/**
+ * A Human readable version of the Key's top level name.
+ * For Biblical passages this uses short books names. For
+ * a dictionary it might return A-Z.
+ *
+ * @return a String containing a description of the Key
+ */
+ String getRootName();
+
+ /**
* Translate the Key into a human readable string, with the
* assumption that the specified Key has just been output, so if we
* are in the same region, we do not need to display the region name, and
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageTally.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageTally.java 2006-12-19 21:10:44 UTC (rev 1220)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageTally.java 2006-12-19 22:50:05 UTC (rev 1221)
@@ -146,9 +146,8 @@
return order;
}
- /**
- * Get a copy of ourselves.
- * @return A complete copy of ourselves
+ /* (non-Javadoc)
+ * @see org.crosswire.jsword.passage.AbstractPassage#clone()
*/
public Object clone()
{
@@ -160,19 +159,16 @@
return copy;
}
- /**
- * Simply bounce to getName() to help String concatenation.
- * @return a String containing a description of the verses
+ /* (non-Javadoc)
+ * @see org.crosswire.jsword.passage.AbstractPassage#toString()
*/
public String toString()
{
return getName(0);
}
- /**
- * A Human readable version of the PassageTally.
- * Uses short books names, and the shortest possible rendering eg "Mat 3:1-4"
- * @return a String containing a description of the verses
+ /* (non-Javadoc)
+ * @see org.crosswire.jsword.passage.AbstractPassage#getName()
*/
public String getName()
{
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/ReadOnlyKeyList.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/ReadOnlyKeyList.java 2006-12-19 21:10:44 UTC (rev 1220)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/ReadOnlyKeyList.java 2006-12-19 22:50:05 UTC (rev 1221)
@@ -150,6 +150,14 @@
}
/* (non-Javadoc)
+ * @see org.crosswire.jsword.passage.Key#getRootName()
+ */
+ public String getRootName()
+ {
+ return keys.getRootName();
+ }
+
+ /* (non-Javadoc)
* @see org.crosswire.jsword.passage.Key#getName(org.crosswire.jsword.passage.Key)
*/
public String getName(Key base)
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/ReadOnlyPassage.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/ReadOnlyPassage.java 2006-12-19 21:10:44 UTC (rev 1220)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/ReadOnlyPassage.java 2006-12-19 22:50:05 UTC (rev 1221)
@@ -167,6 +167,14 @@
}
/* (non-Javadoc)
+ * @see org.crosswire.jsword.passage.Key#getRootName()
+ */
+ public String getRootName()
+ {
+ return ref.getRootName();
+ }
+
+ /* (non-Javadoc)
* @see org.crosswire.jsword.passage.Passage#getOSISName()
*/
public String getOsisRef()
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/SynchronizedPassage.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/SynchronizedPassage.java 2006-12-19 21:10:44 UTC (rev 1220)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/SynchronizedPassage.java 2006-12-19 22:50:05 UTC (rev 1221)
@@ -81,7 +81,7 @@
/* (non-Javadoc)
* @see org.crosswire.jsword.passage.Key#getChildCount()
*/
- public int getChildCount()
+ public synchronized int getChildCount()
{
return ref.getChildCount();
}
@@ -97,7 +97,7 @@
/* (non-Javadoc)
* @see org.crosswire.jsword.passage.Key#canHaveChildren()
*/
- public boolean canHaveChildren()
+ public synchronized boolean canHaveChildren()
{
return ref.canHaveChildren();
}
@@ -150,6 +150,11 @@
return ref.getName(base);
}
+ public synchronized String getRootName()
+ {
+ return ref.getRootName();
+ }
+
/* (non-Javadoc)
* @see org.crosswire.jsword.passage.Passage#getOSISName()
*/
@@ -161,7 +166,7 @@
/* (non-Javadoc)
* @see org.crosswire.jsword.passage.Key#getOSISId()
*/
- public String getOsisID()
+ public synchronized String getOsisID()
{
return ref.getOsisID();
}
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/Verse.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/Verse.java 2006-12-19 21:10:44 UTC (rev 1220)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/Verse.java 2006-12-19 22:50:05 UTC (rev 1221)
@@ -143,10 +143,8 @@
set(ordinal);
}
- /**
- * Translate the Passage into a human readable string. This is
- * simply an alias for getName();
- * @return The string representation
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
*/
/* @Override */
public String toString()
@@ -154,9 +152,8 @@
return getName();
}
- /**
- * Translate the Passage into a human readable string
- * @return The string representation
+ /* (non-Javadoc)
+ * @see org.crosswire.jsword.passage.Key#getName()
*/
public String getName()
{
@@ -187,10 +184,8 @@
}
}
- /**
- * Translate the Passage into a human readable string
- * @param base The verse to use to cut down unnecessary output.
- * @return The string representation
+ /* (non-Javadoc)
+ * @see org.crosswire.jsword.passage.Key#getName(org.crosswire.jsword.passage.Key)
*/
public String getName(Key base)
{
@@ -245,11 +240,25 @@
}
}
- /**
- * The OSIS defined specification for this Verse.
- * Uses short books names, with "." as a verse part separator.
- * @return a String containing the OSIS description of the verses
+ /* (non-Javadoc)
+ * @see org.crosswire.jsword.passage.Key#getRootName()
*/
+ public String getRootName()
+ {
+ try
+ {
+ return BibleInfo.getBookName(book);
+ }
+ catch (NoSuchKeyException ex)
+ {
+ assert false : ex;
+ return "!Error!"; //$NON-NLS-1$
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.crosswire.jsword.passage.Key#getOsisRef()
+ */
public String getOsisRef()
{
try
@@ -275,13 +284,8 @@
return getOsisRef();
}
- /**
- * Get a copy of ourselves. Points to note:
- * Call clone() not new() on member Objects, and on us.
- * Do not use Copy Constructors! - they do not inherit well.
- * Think about this needing to be synchronized
- * If this is not cloneable then writing cloneable children is harder
- * @return A complete copy of ourselves
+ /* (non-Javadoc)
+ * @see java.lang.Object#clone()
*/
/* @Override */
public Object clone()
@@ -304,12 +308,8 @@
return copy;
}
- /**
- * Is this Object equal to us. Points to note:
- * If you override equals(), you must override hashCode() too.
- * If you are doing this it is a good idea to be immutable.
- * @param obj The thing to test against
- * @return True/False is we are or are not equal to obj
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
*/
/* @Override */
public boolean equals(Object obj)
@@ -348,11 +348,8 @@
return true;
}
- /**
- * This returns the ordinal number of the verse
- * so <code>new Verse("Rev 22:21").hashCode() = 31104</code>.
- * <p><b>However should should not reply on this being true</b>
- * @return The hashing number
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
*/
/* @Override */
public int hashCode()
@@ -360,10 +357,8 @@
return getOrdinal();
}
- /**
- * Compare this to a given object
- * @param obj The thing to compare against
- * @return 1 means he is earlier than me, -1 means he is later ...
+ /* (non-Javadoc)
+ * @see java.lang.Comparable#compareTo(T)
*/
public int compareTo(Object obj)
{
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/VerseRange.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/VerseRange.java 2006-12-19 21:10:44 UTC (rev 1220)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/VerseRange.java 2006-12-19 22:50:05 UTC (rev 1221)
@@ -127,19 +127,16 @@
verseCount = calcVerseCount(start, end);
}
- /**
- * Fetch a more sensible shortened version of the name
- * @return A string like 'Gen 1:1-2'
+ /* (non-Javadoc)
+ * @see org.crosswire.jsword.passage.Key#getName()
*/
public String getName()
{
return getName(null);
}
- /**
- * Fetch a more sensible shortened version of the name
- * @param base A reference to allow things like Gen 1:1,3,5 as an output
- * @return A string like 'Gen 1:1-2'
+ /* (non-Javadoc)
+ * @see org.crosswire.jsword.passage.Key#getName(org.crosswire.jsword.passage.Key)
*/
public String getName(Key base)
{
@@ -236,11 +233,17 @@
}
}
- /**
- * The OSIS defined reference specification for this VerseRange.
- * Uses osis books names, with "." as a verse part separator.
- * @return a String containing the OSIS description of the verses
+ /* (non-Javadoc)
+ * @see org.crosswire.jsword.passage.Key#getRootName()
*/
+ public String getRootName()
+ {
+ return start.getRootName();
+ }
+
+ /* (non-Javadoc)
+ * @see org.crosswire.jsword.passage.Key#getOsisRef()
+ */
public String getOsisRef()
{
try
@@ -293,11 +296,8 @@
}
}
- /**
- * The OSIS defined id specification for this VerseRange.
- * Uses osis books names, with "." as a verse part separator.
- * Each verse is separated by a space.
- * @return a String containing the OSIS description of the verses
+ /* (non-Javadoc)
+ * @see org.crosswire.jsword.passage.Key#getOsisID()
*/
public String getOsisID()
{
@@ -357,10 +357,8 @@
return buf.toString();
}
- /**
- * This just clones getName which seems the most sensible
- * type of string to return.
- * @return A string like 'Gen 1:1-2'
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
*/
public String toString()
{
Modified: trunk/jsword-limbo/src/main/java/org/crosswire/bibledesktop/passage/PassageListCellRenderer.java
===================================================================
--- trunk/jsword-limbo/src/main/java/org/crosswire/bibledesktop/passage/PassageListCellRenderer.java 2006-12-19 21:10:44 UTC (rev 1220)
+++ trunk/jsword-limbo/src/main/java/org/crosswire/bibledesktop/passage/PassageListCellRenderer.java 2006-12-19 22:50:05 UTC (rev 1221)
@@ -89,7 +89,7 @@
if (text == null)
{
BookData bdata = bible.getData(range);
- String simple = bdata.getVerseText();
+ String simple = bdata.getCanonicalText();
text = "<html><b>" + range.getName() + "</b> " + simple; //$NON-NLS-1$ //$NON-NLS-2$
hash.put(range, text);
}
More information about the jsword-svn
mailing list