[jsword-svn] jsword/java/jsword/org/crosswire/jsword/book s
jswordcvs at crosswire.org
jswordcvs at crosswire.org
Sat Oct 9 14:45:07 MST 2004
Update of /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book
In directory www.crosswire.org:/tmp/cvs-serv30045/java/jsword/org/crosswire/jsword/book
Modified Files:
BookMetaData.java Book.java StudyTool.java BookType.java
Added Files:
IndexStatus.java
Removed Files:
Search.java
Log Message:
indexing updates
--- Search.java DELETED ---
Index: BookType.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/BookType.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** BookType.java 21 Sep 2004 17:46:23 -0000 1.6
--- BookType.java 9 Oct 2004 21:45:05 -0000 1.7
***************
*** 3,7 ****
import java.io.Serializable;
-
/**
* An Enumeration of the possible types of Book.
--- 3,6 ----
Index: StudyTool.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/StudyTool.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** StudyTool.java 27 Jul 2004 21:42:36 -0000 1.8
--- StudyTool.java 9 Oct 2004 21:45:05 -0000 1.9
***************
*** 43,48 ****
public Collection getTranslations(Book bible, String word) throws BookException
{
! Search search = new Search(word, false);
! Key key = bible.find(search);
BookData data = bible.getData(key);
--- 43,47 ----
public Collection getTranslations(Book bible, String word) throws BookException
{
! Key key = bible.find(word);
BookData data = bible.getData(key);
***************
*** 92,97 ****
public Collection getTranslations(Book bible, Strongs number) throws BookException
{
! Search search = new Search(number, false);
! Key key = bible.find(search);
BookData data = bible.getData(key);
--- 91,95 ----
public Collection getTranslations(Book bible, Strongs number) throws BookException
{
! Key key = bible.find(number.getOLBName());
BookData data = bible.getData(key);
--- NEW FILE: IndexStatus.java ---
package org.crosswire.jsword.book;
import java.io.Serializable;
/**
* An Enumeration of the possible types of Book.
*
* <p>NOTE(joe): consider giving each a number (1,2,4,8) and allowing combinations
*
* <p><table border='1' cellPadding='3' cellSpacing='0'>
* <tr><td bgColor='white' class='TableRowColor'><font size='-7'>
*
* Distribution Licence:<br />
* JSword 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.<br />
* 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.<br />
* The License is available on the internet
* <a href='http://www.gnu.org/copyleft/gpl.html'>here</a>, or by writing to:
* Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* MA 02111-1307, USA<br />
* The copyright to this program is held by it's authors.
* </font></td></tr></table>
* @see gnu.gpl.Licence
* @author Joe Walker [joe at eireneh dot com]
* @version $Id: IndexStatus.java,v 1.1 2004/10/09 21:45:05 joe Exp $
*/
public class IndexStatus implements Serializable
{
/**
* There is a complete and ready to use search index
*/
public static final IndexStatus DONE = new IndexStatus("Indexed"); //$NON-NLS-1$
/**
* There is no search index, and no plans to create one
*/
public static final IndexStatus UNDONE = new IndexStatus("No Index"); //$NON-NLS-1$
/**
* This Book has been scheduled for index creation
*/
public static final IndexStatus SCHEDULED = new IndexStatus("Scheduled"); //$NON-NLS-1$
/**
* An index is currently being generated for this Book
*/
public static final IndexStatus CREATING = new IndexStatus("Creating"); //$NON-NLS-1$
/**
* All the known values
*/
private static final IndexStatus[] VALUES =
{
DONE,
UNDONE,
SCHEDULED,
CREATING,
};
/**
* @param name The name of the BookType
*/
private IndexStatus(String name)
{
this.name = name;
}
/**
* Lookup method to convert from a String
*/
public static IndexStatus fromString(String name)
{
for (int i = 0; i < VALUES.length; i++)
{
IndexStatus o = VALUES[i];
if (o.name.equalsIgnoreCase(name))
{
return o;
}
}
// cannot get here
assert false;
return null;
}
/**
* Lookup method to convert from an integer
*/
public static IndexStatus fromInteger(int i)
{
return VALUES[i];
}
/**
* Prevent subclasses from overriding canonical identity based Object methods
* @see java.lang.Object#equals(java.lang.Object)
*/
public final boolean equals(Object o)
{
return super.equals(o);
}
/**
* Prevent subclasses from overriding canonical identity based Object methods
* @see java.lang.Object#hashCode()
*/
public final int hashCode()
{
return super.hashCode();
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
public String toString()
{
return name;
}
/**
* The name of the BookType
*/
private String name;
// Support for serialization
private static int nextObj;
private final int obj = nextObj++;
Object readResolve()
{
return VALUES[obj];
}
/**
* SERIALUID(dms): A placeholder for the ultimate version id.
*/
private static final long serialVersionUID = 1L;
}
Index: Book.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/Book.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** Book.java 21 Sep 2004 17:46:23 -0000 1.20
--- Book.java 9 Oct 2004 21:45:05 -0000 1.21
***************
*** 63,66 ****
* @throws BookException If anything goes wrong with this method
*/
! public Key find(Search search) throws BookException;
}
--- 63,66 ----
* @throws BookException If anything goes wrong with this method
*/
! public Key find(String search) throws BookException;
}
Index: BookMetaData.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/BookMetaData.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** BookMetaData.java 5 Oct 2004 22:03:09 -0000 1.21
--- BookMetaData.java 9 Oct 2004 21:45:05 -0000 1.22
***************
*** 1,4 ****
--- 1,5 ----
package org.crosswire.jsword.book;
+ import java.beans.PropertyChangeListener;
import java.util.Map;
***************
*** 106,110 ****
* Calculated field: The name of the name, which could be helpful to
* distinguish similar Books available through 2 BookDrivers.
! * @return The name name
*/
public String getDriverName();
--- 107,111 ----
* Calculated field: The name of the name, which could be helpful to
* distinguish similar Books available through 2 BookDrivers.
! * @return The driver name
*/
public String getDriverName();
***************
*** 116,120 ****
* @return true if the orientation for the dominate language is LeftToRight.
*/
-
public boolean isLeftToRight();
--- 117,120 ----
***************
*** 123,132 ****
* The returned Properties will be read-only so any attempts to alter it
* will fail.
- * This method is designed to support finding out more about a book
- * rather than as a covert method of
*/
public Map getProperties();
/**
* The key for the type in the properties map
*/
--- 123,159 ----
* The returned Properties will be read-only so any attempts to alter it
* will fail.
*/
public Map getProperties();
/**
+ * Has anyone generated a search index for this Book?
+ * @see org.crosswire.jsword.book.search.IndexManager
+ */
+ public IndexStatus getIndexStatus();
+
+ /**
+ * This method does not alter the index status, however it is for Indexers
+ * that are responsible for indexing and have changed the status themselves.
+ * @see org.crosswire.jsword.book.search.IndexManager
+ */
+ public void setIndexStatus(IndexStatus status);
+
+ /**
+ * Adds a <code>PropertyChangeListener</code> to the listener list.
+ * The listener is registered for all properties. However the only one likely
+ * to change at the time of writing is the Index Status.
+ * <p>A <code>PropertyChangeEvent</code> will get fired in response
+ * to setting a bound property, such as <code>setIndexStatus</code>.
+ * @param li the <code>PropertyChangeListener</code> to be added
+ */
+ public void addPropertyChangeListener(PropertyChangeListener li);
+
+ /**
+ * Removes a <code>PropertyChangeListener</code> from the listener list.
+ * @param li the <code>PropertyChangeListener</code> to be removed
+ */
+ public void removePropertyChangeListener(PropertyChangeListener li);
+
+ /**
* The key for the type in the properties map
*/
***************
*** 158,160 ****
--- 185,191 ----
public static final String KEY_INITIALS = "Initials"; //$NON-NLS-1$
+ /**
+ * The key for the indexed status in the properties map
+ */
+ public static final String KEY_INDEXSTATUS = "IndexStatus"; //$NON-NLS-1$
}
More information about the jsword-svn
mailing list