[jsword-svn] r1250 - in trunk: common/src/main/java/org/crosswire/common/progress jsword/src/main/java/org/crosswire/jsword/book jsword/src/main/java/org/crosswire/jsword/book/filter/thml jsword/src/main/java/org/crosswire/jsword/index/lucene jsword/src/main/java/org/crosswire/jsword/passage jsword/src/main/java/org/crosswire/jsword/util
dmsmith at www.crosswire.org
dmsmith at www.crosswire.org
Tue Mar 13 20:01:57 MST 2007
Author: dmsmith
Date: 2007-03-13 20:01:57 -0700 (Tue, 13 Mar 2007)
New Revision: 1250
Modified:
trunk/common/src/main/java/org/crosswire/common/progress/Job.java
trunk/common/src/main/java/org/crosswire/common/progress/Progress.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/BookCategory.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/FontTag.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/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/SynchronizedPassage.java
trunk/jsword/src/main/java/org/crosswire/jsword/util/Project.java
Log:
Potential bug fixes.
Modified: trunk/common/src/main/java/org/crosswire/common/progress/Job.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/progress/Job.java 2007-03-14 02:59:46 UTC (rev 1249)
+++ trunk/common/src/main/java/org/crosswire/common/progress/Job.java 2007-03-14 03:01:57 UTC (rev 1250)
@@ -134,7 +134,7 @@
}
}
predictSection(statedesc);
-
+
current.put(statedesc, new Integer((int) (System.currentTimeMillis() - start)));
}
Modified: trunk/common/src/main/java/org/crosswire/common/progress/Progress.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/progress/Progress.java 2007-03-14 02:59:46 UTC (rev 1249)
+++ trunk/common/src/main/java/org/crosswire/common/progress/Progress.java 2007-03-14 03:01:57 UTC (rev 1250)
@@ -1,5 +1,33 @@
+/**
+ * Distribution License:
+ * JSword is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License, version 2.1 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 Lesser General Public License for more details.
+ *
+ * The License is available on the internet at:
+ * http://www.gnu.org/copyleft/lgpl.html
+ * or by writing to:
+ * Free Software Foundation, Inc.
+ * 59 Temple Place - Suite 330
+ * Boston, MA 02111-1307, USA
+ *
+ * Copyright: 2005
+ * The copyright to this program is held by it's authors.
+ *
+ * ID: $Id:$
+ */
package org.crosswire.common.progress;
+/**
+ * A Generic way of keeping track of Threads and monitoring their progress.
+ *
+ * @see gnu.lgpl.License for license details.<br>
+ * The copyright to this program is held by it's authors.
+ * @author DM Smith [dmsmith555 at yahoo dot com]
+ */
public interface Progress
{
/**
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/BookCategory.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/BookCategory.java 2007-03-14 02:59:46 UTC (rev 1249)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/BookCategory.java 2007-03-14 03:01:57 UTC (rev 1250)
@@ -66,6 +66,11 @@
/**
* Books that are not any of the above
*/
+ public static final BookCategory GENERAL_BOOK = new BookCategory("General Book"); //$NON-NLS-1$
+
+ /**
+ * Books that are not any of the above
+ */
public static final BookCategory OTHER = new BookCategory("Other"); //$NON-NLS-1$
/**
@@ -110,6 +115,22 @@
}
/* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public final boolean equals(Object o)
+ {
+ return super.equals(o);
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ public final int hashCode()
+ {
+ return super.hashCode();
+ }
+
+ /* (non-Javadoc)
* @see java.lang.Object#toString()
*/
public String toString()
@@ -139,6 +160,7 @@
DAILY_DEVOTIONS,
GLOSSARY,
QUESTIONABLE,
+ GENERAL_BOOK,
OTHER,
};
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/FontTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/FontTag.java 2007-03-14 02:59:46 UTC (rev 1249)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/FontTag.java 2007-03-14 03:01:57 UTC (rev 1250)
@@ -70,7 +70,7 @@
}
String type = buf.toString();
- if (type != null)
+ if (type.length() > 0)
{
seg.setAttribute(OSISUtil.OSIS_ATTR_TYPE, type);
}
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 2007-03-14 02:59:46 UTC (rev 1249)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/LuceneIndex.java 2007-03-14 03:01:57 UTC (rev 1250)
@@ -146,7 +146,7 @@
IndexWriter fsWriter = new IndexWriter(tempPath.getCanonicalPath(), analyzer, true);
fsWriter.addIndexes(new Directory[] { ramDir });
fsWriter.close();
-
+
writer.close();
job.setCancelable(false);
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/AbstractKeyList.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/AbstractKeyList.java 2007-03-14 02:59:46 UTC (rev 1249)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/AbstractKeyList.java 2007-03-14 03:01:57 UTC (rev 1250)
@@ -165,6 +165,36 @@
}
/* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ /* @Override */
+ public boolean equals(Object obj)
+ {
+ // Since this can not be null
+ if (obj == null)
+ {
+ return false;
+ }
+
+ // Check that that is the same as this
+ // Don't use instanceOf since that breaks inheritance
+ if (!obj.getClass().equals(this.getClass()))
+ {
+ return false;
+ }
+
+ return compareTo(obj) == 0;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode()
+ {
+ return getName().hashCode();
+ }
+
+ /* (non-Javadoc)
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/
public int compareTo(Object obj)
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/Key.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/Key.java 2007-03-14 02:59:46 UTC (rev 1249)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/Key.java 2007-03-14 03:01:57 UTC (rev 1250)
@@ -181,4 +181,17 @@
* @return A complete copy of ourselves
*/
Object clone();
+ /**
+ * This needs to be declared here so that it is visible as a method
+ * on a derived Key.
+ * @return true if equal
+ */
+ boolean equals(Object obj);
+
+ /**
+ * This needs to be declared here so that it is visible as a method
+ * on a derived Key.
+ * @return the hashcode
+ */
+ int hashCode();
}
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageTally.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageTally.java 2007-03-14 02:59:46 UTC (rev 1249)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageTally.java 2007-03-14 03:01:57 UTC (rev 1250)
@@ -1017,6 +1017,37 @@
}
/* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ord;
+ result = prime * result + tally;
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final TalliedVerse other = (TalliedVerse) obj;
+ if (tally != other.tally)
+ return false;
+ if (ord != other.ord)
+ return false;
+ return true;
+ }
+
+ /* (non-Javadoc)
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/
public int compareTo(Object obj)
@@ -1148,6 +1179,42 @@
}
/* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + tally;
+ result = prime * result + ((range == null) ? 0 : range.hashCode());
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final TalliedVerseRange other = (TalliedVerseRange) obj;
+ if (tally != other.tally)
+ return false;
+ if (range == null)
+ {
+ if (other.range != null)
+ return false;
+ }
+ else if (!range.equals(other.range))
+ return false;
+ return true;
+ }
+
+ /* (non-Javadoc)
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/
public int compareTo(Object obj)
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/ReadOnlyKeyList.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/ReadOnlyKeyList.java 2007-03-14 02:59:46 UTC (rev 1249)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/ReadOnlyKeyList.java 2007-03-14 03:01:57 UTC (rev 1250)
@@ -182,6 +182,22 @@
}
/* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode()
+ {
+ return keys.hashCode();
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj)
+ {
+ return keys.equals(obj);
+ }
+
+ /* (non-Javadoc)
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/
public int compareTo(Object o)
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/SynchronizedPassage.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/SynchronizedPassage.java 2007-03-14 02:59:46 UTC (rev 1249)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/SynchronizedPassage.java 2007-03-14 03:01:57 UTC (rev 1250)
@@ -367,6 +367,22 @@
}
/* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ public synchronized int hashCode()
+ {
+ return ref.hashCode();
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public synchronized boolean equals(Object obj)
+ {
+ return ref.equals(obj);
+ }
+
+ /* (non-Javadoc)
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/
public synchronized int compareTo(Object o)
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/util/Project.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/util/Project.java 2007-03-14 02:59:46 UTC (rev 1249)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/util/Project.java 2007-03-14 03:01:57 UTC (rev 1250)
@@ -172,7 +172,7 @@
*/
private URL migrateUserProjectDir(URL oldPath, URL newPath)
{
- if (oldPath.equals(newPath))
+ if (oldPath.toExternalForm().equals(newPath.toExternalForm()))
{
return newPath;
}
More information about the jsword-svn
mailing list