[jsword-svn] r1047 - in trunk:
biblemapper/src/main/java/org/crosswire/biblemapper/swing
common/src/main/java/org/crosswire/common/activate
common/src/main/java/org/crosswire/common/config
common/src/main/java/org/crosswire/common/progress
common/src/main/java/org/crosswire/common/util
common/src/main/java/org/crosswire/common/xml jsword/.settings
jsword/src/main/java/org/crosswire/jsword/book
jsword/src/main/java/org/crosswire/jsword/book/sword
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/src/test/java/org/crosswire/jsword/book
jsword-limbo/src/main/java/org/crosswire/bibledesktop/passage
jsword-limbo/src/main/java/org/crosswire/jsword/book/basic
jsword-limbo/src/main/java/org/crosswire/jsword/book/search/ser
jsword-limbo/src/main/java/org/crosswire/jsword/book/stub
jsword-support/tools/checkstyle jsword-web
dmsmith at crosswire.org
dmsmith at crosswire.org
Tue Mar 14 06:21:52 MST 2006
Author: dmsmith
Date: 2006-03-14 06:20:54 -0700 (Tue, 14 Mar 2006)
New Revision: 1047
Modified:
trunk/biblemapper/src/main/java/org/crosswire/biblemapper/swing/CliMapper.java
trunk/common/src/main/java/org/crosswire/common/activate/Activator.java
trunk/common/src/main/java/org/crosswire/common/config/Config.java
trunk/common/src/main/java/org/crosswire/common/progress/JobManager.java
trunk/common/src/main/java/org/crosswire/common/util/CollectionUtil.java
trunk/common/src/main/java/org/crosswire/common/util/Convert.java
trunk/common/src/main/java/org/crosswire/common/util/EmptyIterator.java
trunk/common/src/main/java/org/crosswire/common/util/Filter.java
trunk/common/src/main/java/org/crosswire/common/util/Histogram.java
trunk/common/src/main/java/org/crosswire/common/xml/XMLFeatureSet.java
trunk/jsword-limbo/src/main/java/org/crosswire/bibledesktop/passage/BibleTreeNode.java
trunk/jsword-limbo/src/main/java/org/crosswire/bibledesktop/passage/BookTreeNode.java
trunk/jsword-limbo/src/main/java/org/crosswire/bibledesktop/passage/ChapterTreeNode.java
trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/basic/Verifier.java
trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/search/ser/SerIndex.java
trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/stub/StubDictionaryKeyFactory.java
trunk/jsword-support/tools/checkstyle/custom.xml
trunk/jsword-web/build.xml
trunk/jsword/.settings/org.eclipse.jdt.core.prefs
trunk/jsword/src/main/java/org/crosswire/jsword/book/Book.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/BlockType.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookMetaData.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordDictionary.java
trunk/jsword/src/main/java/org/crosswire/jsword/examples/APIExamples.java
trunk/jsword/src/main/java/org/crosswire/jsword/examples/BibleToOsis.java
trunk/jsword/src/main/java/org/crosswire/jsword/examples/DictToOsis.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/BitwisePassage.java
trunk/jsword/src/main/java/org/crosswire/jsword/passage/KeyUtil.java
trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageKeyFactory.java
trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageTally.java
trunk/jsword/src/main/java/org/crosswire/jsword/passage/RangedPassage.java
trunk/jsword/src/main/java/org/crosswire/jsword/passage/RocketPassage.java
trunk/jsword/src/main/java/org/crosswire/jsword/passage/VerseBase.java
trunk/jsword/src/main/java/org/crosswire/jsword/passage/VerseRange.java
trunk/jsword/src/test/java/org/crosswire/jsword/book/ReadEverything.java
Log:
More Java 5 migration changes.
Modified: trunk/biblemapper/src/main/java/org/crosswire/biblemapper/swing/CliMapper.java
===================================================================
--- trunk/biblemapper/src/main/java/org/crosswire/biblemapper/swing/CliMapper.java 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/biblemapper/src/main/java/org/crosswire/biblemapper/swing/CliMapper.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -23,7 +23,6 @@
import java.io.FileOutputStream;
import java.io.PrintWriter;
-import java.util.Iterator;
import java.util.List;
import org.crosswire.jsword.book.Book;
@@ -33,6 +32,7 @@
import org.crosswire.jsword.book.search.parse.IndexSearcher;
import org.crosswire.jsword.book.search.parse.PhraseParamWord;
import org.crosswire.jsword.passage.BibleInfo;
+import org.crosswire.jsword.passage.Key;
import org.crosswire.jsword.passage.NoSuchVerseException;
import org.crosswire.jsword.passage.PassageTally;
import org.crosswire.jsword.passage.Verse;
@@ -116,10 +116,9 @@
total.trimVerses(LINKS_PER_CHAPTER);
scrunchTally(total);
- Iterator it = total.iterator();
- while (it.hasNext())
+ for (Key key : total)
{
- Verse link = (Verse) it.next();
+ Verse link = (Verse) key;
VerseRange chap = new VerseRange(link, new Verse(link.getBook(), link.getChapter(), BibleInfo.versesInChapter(link.getBook(), link.getChapter())));
Element el = new Element("link");
el.setAttribute("book", ""+link.getBook());
Modified: trunk/common/src/main/java/org/crosswire/common/activate/Activator.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/activate/Activator.java 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/common/src/main/java/org/crosswire/common/activate/Activator.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -66,7 +66,12 @@
amount.reduceMemoryUsage();
}
- public enum Kill {
+ /**
+ * Enumeration of how memory is returned.
+ *
+ */
+ public enum Kill
+ {
/** Try as hard as possible to conserve memory */
EVERYTHING
{
Modified: trunk/common/src/main/java/org/crosswire/common/config/Config.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/config/Config.java 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/common/src/main/java/org/crosswire/common/config/Config.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -166,7 +166,7 @@
{
List<String> paths = new ArrayList<String>();
- for (Choice choice: models)
+ for (Choice choice : models)
{
String path = getPath(choice.getFullPath());
Modified: trunk/common/src/main/java/org/crosswire/common/progress/JobManager.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/progress/JobManager.java 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/common/src/main/java/org/crosswire/common/progress/JobManager.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -174,7 +174,7 @@
// list of jobs so we need to fire before delete.
if (listeners != null)
{
- for (WorkListener worker: temp)
+ for (WorkListener worker : temp)
{
worker.workProgressed(ev);
}
Modified: trunk/common/src/main/java/org/crosswire/common/util/CollectionUtil.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/CollectionUtil.java 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/common/src/main/java/org/crosswire/common/util/CollectionUtil.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -26,7 +26,6 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -83,11 +82,9 @@
public static Map<String, String> properties2Map(Properties prop)
{
Map<String, String> propMap = new HashMap<String, String>();
- Iterator it = prop.entrySet().iterator();
- while (it.hasNext())
+ for (Map.Entry entry : prop.entrySet())
{
- Map.Entry entry = (Map.Entry) it.next();
- propMap.put((String)entry.getKey(), (String)entry.getValue());
+ propMap.put((String) entry.getKey(), (String) entry.getValue());
}
return propMap;
}
Modified: trunk/common/src/main/java/org/crosswire/common/util/Convert.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/Convert.java 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/common/src/main/java/org/crosswire/common/util/Convert.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -210,7 +210,7 @@
{
StringBuffer retcode = new StringBuffer();
- for (Map.Entry<String, String> entry: commands.entrySet())
+ for (Map.Entry<String, String> entry : commands.entrySet())
{
retcode.append(entry.getKey());
retcode.append('=');
Modified: trunk/common/src/main/java/org/crosswire/common/util/EmptyIterator.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/EmptyIterator.java 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/common/src/main/java/org/crosswire/common/util/EmptyIterator.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -29,6 +29,8 @@
* An <code>EmptyIterator</code> is an <code>Iterator</code> that iterates
* over nothing.
*
+ * @param <T> the return type for next
+ *
* @see gnu.lgpl.License for license details.
* The copyright to this program is held by it's authors.
* @author DM Smith [ dmsmith555 at yahoo dot com]
Modified: trunk/common/src/main/java/org/crosswire/common/util/Filter.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/Filter.java 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/common/src/main/java/org/crosswire/common/util/Filter.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -25,6 +25,8 @@
/**
* A method of filtering Objects.
*
+ * @param <T> type to test
+ *
* @see gnu.lgpl.License for license details.
* The copyright to this program is held by it's authors.
* @author DM Smith [dmsmith555 at yahoo dot com]
Modified: trunk/common/src/main/java/org/crosswire/common/util/Histogram.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/Histogram.java 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/common/src/main/java/org/crosswire/common/util/Histogram.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -72,7 +72,7 @@
public String toString()
{
StringBuffer buf = new StringBuffer();
- for (Map.Entry<String, Counter> entry: hist.entrySet())
+ for (Map.Entry<String, Counter> entry : hist.entrySet())
{
buf.append(entry.getKey());
buf.append('\t');
Modified: trunk/common/src/main/java/org/crosswire/common/xml/XMLFeatureSet.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/xml/XMLFeatureSet.java 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/common/src/main/java/org/crosswire/common/xml/XMLFeatureSet.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -83,7 +83,7 @@
{
features.get(states.get(feature)).setState(state);
}
-
+
public void setFeatureStates(String... argv)
{
// process arguments
@@ -151,6 +151,9 @@
}
}
+ /**
+ * A holder of the boolean state for a feature.
+ */
private class XMLFeatureState
{
public XMLFeatureState(XMLFeature feature, boolean state)
@@ -163,7 +166,7 @@
{
this(feature, false);
}
-
+
/**
* @return Returns the feature.
*/
Modified: trunk/jsword/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/jsword/.settings/org.eclipse.jdt.core.prefs 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/jsword/.settings/org.eclipse.jdt.core.prefs 2006-03-14 13:20:54 UTC (rev 1047)
@@ -1,4 +1,4 @@
-#Fri Mar 03 18:41:50 EST 2006
+#Tue Mar 14 08:14:46 EST 2006
eclipse.preferences.version=1
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
@@ -54,6 +54,7 @@
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/Book.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/Book.java 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/Book.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -87,7 +87,7 @@
* @throws BookException If anything goes wrong with this method
*/
Key find(String request) throws BookException;
-
+
/**
* The name of the book, for example "King James Version" or
* "Bible in Basic English" or "Greek".
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/BlockType.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/BlockType.java 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/BlockType.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -55,6 +55,6 @@
{
return indicator;
}
-
+
private char indicator;
}
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookMetaData.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookMetaData.java 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookMetaData.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -305,8 +305,8 @@
* Sword only recognizes two encodings for its modules: UTF-8 and LATIN1
* Sword uses MS Windows cp1252 for Latin 1 not the standard. Arrgh!
*/
- private static String ENCODING_UTF8 = "UTF-8"; //$NON-NLS-1$
- private static String ENCODING_LATIN1 = "WINDOWS-1252"; //$NON-NLS-1$
+ private static final String ENCODING_UTF8 = "UTF-8"; //$NON-NLS-1$
+ private static final String ENCODING_LATIN1 = "WINDOWS-1252"; //$NON-NLS-1$
/**
* The language strings need to be converted to Java charsets
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordDictionary.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordDictionary.java 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordDictionary.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -73,9 +73,8 @@
set = backend.readIndex();
map = new HashMap<String, Key>();
- for (Iterator it = set.iterator(); it.hasNext(); )
+ for (Key key : set)
{
- Key key = (Key) it.next();
map.put(key.getName(), key);
}
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/examples/APIExamples.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/examples/APIExamples.java 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/examples/APIExamples.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -240,12 +240,11 @@
public void export() throws NoSuchKeyException, BookException
{
Book bible = Books.installed().getBook(BIBLE_NAME);
- Key key = bible.getKey("Gen"); //$NON-NLS-1$
+ Key keys = bible.getKey("Gen"); //$NON-NLS-1$
// Get a verse iterator
- Iterator iter = key.iterator();
- while (iter.hasNext())
+ for (Key key : keys)
{
- Verse verse = (Verse) iter.next();
+ Verse verse = (Verse) key;
BookData data = bible.getData(verse);
System.out.println('|' + BibleInfo.getBookName(verse.getBook()) + '|' + verse.getChapter() + '|' + verse.getVerse() + '|' + data.getVerseText());
}
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/examples/BibleToOsis.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/examples/BibleToOsis.java 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/examples/BibleToOsis.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -1,3 +1,24 @@
+/**
+ * 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: APIExamples.java 1046 2006-03-12 21:31:48 -0500 (Sun, 12 Mar 2006) dmsmith $
+ */
package org.crosswire.jsword.examples;
import java.io.FileNotFoundException;
@@ -10,7 +31,6 @@
import java.text.MessageFormat;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
@@ -30,6 +50,13 @@
import org.crosswire.jsword.passage.NoSuchVerseException;
import org.crosswire.jsword.passage.Verse;
+/**
+ * Start of a mechanism to extract a Bible module to OSIS.
+ *
+ * @see gnu.lgpl.License for license details.
+ * The copyright to this program is held by it's authors.
+ * @author DM Smith [dmsmith555 at yahoo dot com]
+ */
public class BibleToOsis
{
/**
@@ -56,11 +83,10 @@
int lastChapter = -1;
StringBuffer buf = new StringBuffer();
boolean inPreVerse = false;
-
try
{
- Key key = bible.getKey(range);
+ Key keys = bible.getKey(range);
openOutputFile(bmd.getInitials(), !BY_CHAPTER);
buildDocumentOpen(buf, bmd, range, !BY_CHAPTER);
@@ -70,10 +96,9 @@
}
// Get a verse iterator
- Iterator iter = key.iterator();
- while (iter.hasNext())
+ for (Key key : keys)
{
- Verse verse = (Verse) iter.next();
+ Verse verse = (Verse) key;
String raw = bible.getRawData(verse);
String osisID = verse.getOsisID();
@@ -122,7 +147,7 @@
}
/* Output the verse */
-
+
/*
* If the "raw" verse contains a "preverse" pull it out.
* If there were a former preverse then close the "section" div
@@ -143,7 +168,7 @@
foundPreVerse = true;
preVerseText = raw.substring(start, end);
raw = raw.replace(preVerseText, ""); //$NON-NLS-1$
- preVerseText = preVerseText.substring(preVerseStart.length(), preVerseText.length()-preVerseEnd.length());
+ preVerseText = preVerseText.substring(preVerseStart.length(), preVerseText.length() - preVerseEnd.length());
}
}
}
@@ -215,16 +240,20 @@
StringBuffer sbuf = new StringBuffer();
int l = s.length();
int ch = -1;
- int b, sumb = 0;
- for (int i = 0, more = -1; i < l; i++ )
+ int b = 0;
+ int sumb = 0;
+ int i = 0;
+ int more = -1;
+ for (i = 0; i < l; i++)
{
/* Get next byte b from URL segment s */
- switch (ch = s.charAt(i))
+ ch = s.charAt(i);
+ switch (ch)
{
case '%':
- ch = s.charAt( ++i);
+ ch = s.charAt(++i);
int hb = (Character.isDigit((char) ch) ? ch - '0' : 10 + Character.toLowerCase((char) ch) - 'a') & 0xF;
- ch = s.charAt( ++i);
+ ch = s.charAt(++i);
int lb = (Character.isDigit((char) ch) ? ch - '0' : 10 + Character.toLowerCase((char) ch) - 'a') & 0xF;
b = (hb << 4) | lb;
break;
@@ -238,7 +267,7 @@
if ((b & 0xc0) == 0x80)
{ // 10xxxxxx (continuation byte)
sumb = (sumb << 6) | (b & 0x3f); // Add 6 bits to sumb
- if ( --more == 0)
+ if (--more == 0)
{
sbuf.append((char) sumb); // Add char to sbuf
}
@@ -248,27 +277,32 @@
sbuf.append((char) b); // Store in sbuf
}
else if ((b & 0xe0) == 0xc0)
- { // 110xxxxx (yields 5 bits)
+ {
+ // 110xxxxx (yields 5 bits)
sumb = b & 0x1f;
more = 1; // Expect 1 more byte
}
else if ((b & 0xf0) == 0xe0)
- { // 1110xxxx (yields 4 bits)
+ {
+ // 1110xxxx (yields 4 bits)
sumb = b & 0x0f;
more = 2; // Expect 2 more bytes
}
else if ((b & 0xf8) == 0xf0)
- { // 11110xxx (yields 3 bits)
+ {
+ // 11110xxx (yields 3 bits)
sumb = b & 0x07;
more = 3; // Expect 3 more bytes
}
else if ((b & 0xfc) == 0xf8)
- { // 111110xx (yields 2 bits)
+ {
+ // 111110xx (yields 2 bits)
sumb = b & 0x03;
more = 4; // Expect 4 more bytes
}
- else
- /* if ((b & 0xfe) == 0xfc) */{ // 1111110x (yields 1 bit)
+ else /* if ((b & 0xfe) == 0xfc) */
+ {
+ // 1111110x (yields 1 bit)
sumb = b & 0x01;
more = 5; // Expect 5 more bytes
}
@@ -360,7 +394,7 @@
MessageFormat msgFormat = new MessageFormat("</verse>"); //$NON-NLS-1$
msgFormat.format(new Object[] { osisID }, buf, pos);
}
-
+
private void openOutputFile(String newFilename, boolean open) throws IOException
{
if (open)
@@ -455,7 +489,7 @@
fixed = fixed.replaceAll("x-Strongs", "strong"); //$NON-NLS-1$ //$NON-NLS-2$
fixed = fixed.replaceAll("x-Robinson", "robinson"); //$NON-NLS-1$ //$NON-NLS-2$
fixed = fixed.replaceAll("split(ID|id)=\"", "type=\"x-split\" subType=\"x-"); //$NON-NLS-1$ //$NON-NLS-2$
- if ( !whole.equals(fixed))
+ if (!whole.equals(fixed))
{
input = input.replace(whole, fixed); //$NON-NLS-1$
}
@@ -476,7 +510,7 @@
int j = number.intValue();
if (i != j)
{
- for (; i < j; i++)
+ for ( ; i < j; i++)
{
System.out.println(osisID + " missing src=" + i); //$NON-NLS-1$
}
@@ -1094,37 +1128,45 @@
// of the form T-xxx.
// Find the <w> element with src+1, if it is N-xxx, then
// merge this to that element, removing the G3588 one.
- for (Map.Entry<Integer, String> entry: wMap.entrySet())
+ for (Map.Entry<Integer, String> entry : wMap.entrySet())
{
String definiteArticle = entry.getValue() + "</w>"; //$NON-NLS-1$
- if (input.contains(definiteArticle) && definiteArticle.contains("G3588")) //$NON-NLS-1$
+ if (!(input.contains(definiteArticle) && definiteArticle.contains("G3588"))) //$NON-NLS-1$
{
- Matcher morphTMatcher = morphTPattern.matcher(definiteArticle);
- if (morphTMatcher.find())
- {
- String tType = morphTMatcher.group(1);
- Integer here = entry.getKey();
- Integer next = new Integer(here.intValue() + 1);
- String found = wMap.get(next);
- if (found != null)
- {
- Matcher morphNMatcher = morphNPattern.matcher(found);
- if (morphNMatcher.find())
- {
- String nType = morphNMatcher.group(1);
- if (tType.equals(nType) && input.contains("src=\"" + next + "\"")) //$NON-NLS-1$ //$NON-NLS-2$
- {
- String changed = found;
- changed = changed.replace("src=\"", "src=\"" + here + " "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- changed = changed.replace("lemma=\"", "lemma=\"strongs:3588 "); //$NON-NLS-1$ //$NON-NLS-2$
- changed = changed.replace("morph=\"", "morph=\"robinson:T-" + tType + " "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- input = input.replace(definiteArticle, ""); //$NON-NLS-1$
- input = input.replace(found, changed);
- }
- }
- }
- }
+ continue;
}
+
+ Matcher morphTMatcher = morphTPattern.matcher(definiteArticle);
+ if (!morphTMatcher.find())
+ {
+ continue;
+ }
+
+ String tType = morphTMatcher.group(1);
+ Integer here = entry.getKey();
+ Integer next = new Integer(here.intValue() + 1);
+ String found = wMap.get(next);
+ if (found == null)
+ {
+ continue;
+ }
+
+ Matcher morphNMatcher = morphNPattern.matcher(found);
+ if (!morphNMatcher.find())
+ {
+ continue;
+ }
+
+ String nType = morphNMatcher.group(1);
+ if (tType.equals(nType) && input.contains("src=\"" + next + "\"")) //$NON-NLS-1$ //$NON-NLS-2$
+ {
+ String changed = found;
+ changed = changed.replace("src=\"", "src=\"" + here + " "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ changed = changed.replace("lemma=\"", "lemma=\"strongs:3588 "); //$NON-NLS-1$ //$NON-NLS-2$
+ changed = changed.replace("morph=\"", "morph=\"robinson:T-" + tType + " "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ input = input.replace(definiteArticle, ""); //$NON-NLS-1$
+ input = input.replace(found, changed);
+ }
}
dup.removeAll(split);
@@ -1163,7 +1205,7 @@
private static String nameDate = "type=\"strongsMarkup\"[ ]+name=\"([^\"]*)\"[ ]+date=\"([^\"]*)\""; //$NON-NLS-1$
private static Pattern nameDatePattern = Pattern.compile(nameDate);
-
+
private Writer writer;
private String filename;
}
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/examples/DictToOsis.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/examples/DictToOsis.java 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/examples/DictToOsis.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -1,3 +1,24 @@
+/**
+ * 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: APIExamples.java 1046 2006-03-12 21:31:48 -0500 (Sun, 12 Mar 2006) dmsmith $
+ */
package org.crosswire.jsword.examples;
import java.io.FileNotFoundException;
@@ -20,6 +41,13 @@
import org.crosswire.jsword.passage.Key;
import org.xml.sax.SAXException;
+/**
+ * Start of a mechanism to extract a Dictionary module to OSIS.
+ *
+ * @see gnu.lgpl.License for license details.
+ * The copyright to this program is held by it's authors.
+ * @author DM Smith [dmsmith555 at yahoo dot com]
+ */
public class DictToOsis
{
/**
@@ -41,7 +69,6 @@
Book book = books.getBook(name);
BookMetaData bmd = book.getBookMetaData();
StringBuffer buf = new StringBuffer();
-
try
{
@@ -50,7 +77,7 @@
buildDocumentOpen(buf, bmd);
// Get a verse iterator
- for (Key key: keys)
+ for (Key key : keys)
{
BookData bdata = book.getData(key);
SAXEventProvider osissep = bdata.getSAXEventProvider();
@@ -132,5 +159,4 @@
}
private static FieldPosition pos = new FieldPosition(0);
-
}
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-03-13 02:31:48 UTC (rev 1046)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/LuceneIndex.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -319,12 +319,10 @@
String name = ""; //$NON-NLS-1$
String text = ""; //$NON-NLS-1$
BookData data = null;
- Key subkey = null;
Verse verse = null;
Document doc = null;
- for (Iterator it = key.iterator(); it.hasNext(); )
+ for (Key subkey : key)
{
- subkey = (Key) it.next();
if (subkey.canHaveChildren())
{
generateSearchIndexImpl(job, errors, writer, subkey);
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/AbstractKeyList.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/AbstractKeyList.java 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/AbstractKeyList.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -45,9 +45,8 @@
*/
public boolean contains(Key key)
{
- for (Iterator it = iterator(); it.hasNext(); )
+ for (Key temp : key)
{
- Key temp = (Key) it.next();
if (key.equals(temp))
{
return true;
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/AbstractPassage.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/AbstractPassage.java 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/AbstractPassage.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -291,10 +291,8 @@
{
int count = 0;
- Iterator it = iterator();
- while (it.hasNext())
+ for (Iterator iter = iterator(); iter.hasNext(); iter.next())
{
- it.next();
count++;
}
@@ -326,10 +324,9 @@
int current_book = 0;
int book_count = 0;
- Iterator it = iterator();
- while (it.hasNext())
+ for (Key key : this)
{
- Verse verse = (Verse) it.next();
+ Verse verse = (Verse) key;
if (current_book != verse.getBook())
{
current_book = verse.getBook();
@@ -353,10 +350,9 @@
int current_chapter = 0;
int chapter_count = 0;
- Iterator it = iterator();
- while (it.hasNext())
+ for (Key key : this)
{
- Verse verse = (Verse) it.next();
+ Verse verse = (Verse) key;
if ((book == 0 || verse.getBook() == book) && current_chapter != verse.getChapter())
{
@@ -377,10 +373,9 @@
int verse_count = 0;
- Iterator it = iterator();
- while (it.hasNext())
+ for (Key key : this)
{
- Verse verse = (Verse) it.next();
+ Verse verse = (Verse) key;
if ((book == 0 || verse.getBook() == book) && (chapter == 0 || verse.getChapter() == chapter))
{
@@ -438,7 +433,7 @@
/* (non-Javadoc)
* @see org.crosswire.jsword.passage.Passage#rangeIterator()
*/
- public Iterator rangeIterator(RestrictionType restrict)
+ public Iterator<Key> rangeIterator(RestrictionType restrict)
{
return new VerseRangeIterator(iterator(), restrict);
}
@@ -806,10 +801,9 @@
{
int index = 0;
- for (Iterator it = iterator(); it.hasNext(); )
+ for (Key key : this)
{
- Verse verse = (Verse) it.next();
- if (verse.equals(that))
+ if (key.equals(that))
{
return index;
}
@@ -1128,12 +1122,12 @@
/**
* Skip over verses that are part of a range
*/
- protected static final class VerseRangeIterator implements Iterator
+ protected static final class VerseRangeIterator implements Iterator<Key>
{
/**
* iterate, amalgumating Verses into VerseRanges
*/
- protected VerseRangeIterator(Iterator it, RestrictionType restrict)
+ protected VerseRangeIterator(Iterator<Key> it, RestrictionType restrict)
{
this.it = it;
this.restrict = restrict;
@@ -1157,9 +1151,9 @@
/* (non-Javadoc)
* @see java.util.Iterator#next()
*/
- public Object next() throws NoSuchElementException
+ public Key next() throws NoSuchElementException
{
- Object retcode = next_range;
+ Key retcode = next_range;
if (retcode == null)
{
@@ -1279,10 +1273,9 @@
out.writeInt(BITWISE);
BitSet store = new BitSet(BibleInfo.versesInBible());
- Iterator it = iterator();
- while (it.hasNext())
+ for (Key key : this)
{
- Verse verse = (Verse) it.next();
+ Verse verse = (Verse) key;
store.set(verse.getOrdinal() - 1);
}
@@ -1296,10 +1289,9 @@
out.writeInt(countVerses());
// write the verse ordinals in a loop
- Iterator it = iterator();
- while (it.hasNext())
+ for (Key key : this)
{
- Verse verse = (Verse) it.next();
+ Verse verse = (Verse) key;
out.writeInt(verse.getOrdinal());
}
}
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/BitwisePassage.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/BitwisePassage.java 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/BitwisePassage.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -124,7 +124,7 @@
* @see org.crosswire.jsword.passage.AbstractPassage#rangeIterator()
*/
@Override
- public Iterator rangeIterator(RestrictionType restrict)
+ public Iterator<Key> rangeIterator(RestrictionType restrict)
{
return new VerseRangeIterator(iterator(), restrict);
}
@@ -267,10 +267,10 @@
{
thatStore = new BitSet(BibleInfo.versesInBible() + 1);
- Iterator it = that.iterator();
- while (it.hasNext())
+ for (Key vkey : that)
{
- int ord = ((Verse) it.next()).getOrdinal();
+ Verse verse = (Verse) vkey;
+ int ord = verse.getOrdinal();
if (store.get(ord))
{
thatStore.set(ord);
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/KeyUtil.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/KeyUtil.java 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/KeyUtil.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -21,8 +21,6 @@
*/
package org.crosswire.jsword.passage;
-import java.util.Iterator;
-
import org.crosswire.common.util.Logger;
/**
@@ -48,9 +46,8 @@
*/
public static void visit(Key key, KeyVisitor visitor)
{
- for (Iterator it = key.iterator(); it.hasNext(); )
+ for (Key subkey : key)
{
- Key subkey = (Key) it.next();
if (subkey.canHaveChildren())
{
visitor.visitBranch(subkey);
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageKeyFactory.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageKeyFactory.java 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageKeyFactory.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -294,10 +294,9 @@
index += toBinary(buffer, index, AbstractPassage.BITWISE, AbstractPassage.METHOD_COUNT);
- Iterator it = ref.iterator();
- while (it.hasNext())
+ for (Key key : ref)
{
- Verse verse = (Verse) it.next();
+ Verse verse = (Verse) key;
int ord = verse.getOrdinal();
// Which byte should we be altering
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageTally.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageTally.java 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageTally.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -324,7 +324,7 @@
* @return A range Iterator
*/
@Override
- public Iterator rangeIterator(RestrictionType restrict)
+ public Iterator<Key> rangeIterator(RestrictionType restrict)
{
if (order == ORDER_BIBLICAL)
{
@@ -456,11 +456,9 @@
}
else
{
- Iterator it = that.iterator();
-
- while (it.hasNext())
+ for (Key key : that)
{
- Verse verse = (Verse) it.next();
+ Verse verse = (Verse) key;
increment(verse.getOrdinal(), 1);
}
@@ -490,11 +488,9 @@
}
else
{
- Iterator it = that.iterator();
-
- while (it.hasNext())
+ for (Key key : that)
{
- Verse verse = (Verse) it.next();
+ Verse verse = (Verse) key;
increment(verse.getOrdinal(), -1);
}
}
@@ -532,11 +528,9 @@
}
else
{
- Iterator it = that.iterator();
-
- while (it.hasNext())
+ for (Key vkey : that)
{
- Verse verse = (Verse) it.next();
+ Verse verse = (Verse) vkey;
kill(verse.getOrdinal());
}
}
@@ -1069,12 +1063,12 @@
* Iterate over the Ranges in order of their rank in the tally
* @author Joe Walker
*/
- private static final class OrderedVerseRangeIterator implements Iterator
+ private static final class OrderedVerseRangeIterator implements Iterator<Key>
{
/**
* Find the first unused verse
*/
- public OrderedVerseRangeIterator(Iterator vit, int[] board)
+ public OrderedVerseRangeIterator(Iterator<Key> vit, int[] board)
{
TreeSet<TalliedVerseRange> output = new TreeSet<TalliedVerseRange>();
@@ -1113,7 +1107,7 @@
/* (non-Javadoc)
* @see java.util.Iterator#next()
*/
- public Object next() throws NoSuchElementException
+ public Key next() throws NoSuchElementException
{
last = (TalliedVerseRange) it.next();
return last.range;
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/RangedPassage.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/RangedPassage.java 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/RangedPassage.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -60,7 +60,7 @@
*/
protected RangedPassage()
{
- store = new TreeSet<VerseRange>();
+ store = new TreeSet<Key>();
}
/**
@@ -80,7 +80,7 @@
{
super(refs);
- store = new TreeSet<VerseRange>();
+ store = new TreeSet<Key>();
addVerses(refs);
normalize();
}
@@ -98,7 +98,7 @@
// copy.store = (SortedSet) store.clone();
// However SortedSet is not Clonable so I can't
// Watch out for this, I'm not sure if it breaks anything.
- copy.store = new TreeSet<VerseRange>();
+ copy.store = new TreeSet<Key>();
copy.store.addAll(store);
return copy;
@@ -148,7 +148,7 @@
* @see org.crosswire.jsword.passage.Passage#rangeIterator(int)
*/
@Override
- public Iterator rangeIterator(RestrictionType restrict)
+ public Iterator<Key> rangeIterator(RestrictionType restrict)
{
if (restrict.equals(RestrictionType.NONE))
{
@@ -236,7 +236,7 @@
boolean removed = false;
// This allows us to modify store which iterating through a copy
- SortedSet<VerseRange> new_store = new TreeSet<VerseRange>();
+ SortedSet<Key> new_store = new TreeSet<Key>();
new_store.addAll(store);
Iterator it = new_store.iterator();
@@ -283,7 +283,7 @@
optimizeWrites();
- SortedSet<VerseRange> new_store = new TreeSet<VerseRange>();
+ SortedSet<Key> new_store = new TreeSet<Key>();
Iterator that_it = null;
if (that instanceof RangedPassage)
@@ -340,7 +340,7 @@
VerseRange last = null;
VerseRange next = null;
- SortedSet<VerseRange> new_store = new TreeSet<VerseRange>();
+ SortedSet<Key> new_store = new TreeSet<Key>();
Iterator it = rangeIterator(RestrictionType.NONE);
while (it.hasNext())
@@ -438,7 +438,7 @@
/**
* Loop over the VerseRanges and check that they do not require digging into
*/
- private static final class VerseRangeIterator implements Iterator
+ private static final class VerseRangeIterator implements Iterator<Key>
{
/**
* Simple ctor
@@ -468,7 +468,7 @@
/* (non-Javadoc)
* @see java.util.Iterator#next()
*/
- public Object next()
+ public Key next()
{
if (next == null)
{
@@ -492,7 +492,7 @@
/**
* The next object is correct, use that one
*/
- private Object replyNext()
+ private Key replyNext()
{
VerseRange reply = next;
next = null;
@@ -502,7 +502,7 @@
/**
* The next object is too big, so cut it up
*/
- private Object splitNext()
+ private Key splitNext()
{
Iterator chop = next.rangeIterator(restrict);
VerseRange first = (VerseRange) chop.next();
@@ -554,7 +554,7 @@
{
optimizeWrites();
- store = new TreeSet<VerseRange>();
+ store = new TreeSet<Key>();
readObjectSupport(in);
}
@@ -566,5 +566,5 @@
/**
* The place the real data is stored
*/
- private transient SortedSet<VerseRange> store;
+ private transient SortedSet<Key> store;
}
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/RocketPassage.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/RocketPassage.java 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/RocketPassage.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -152,7 +152,7 @@
* @see org.crosswire.jsword.passage.Passage#rangeIterator(int)
*/
@Override
- public Iterator rangeIterator(RestrictionType restrict)
+ public Iterator<Key> rangeIterator(RestrictionType restrict)
{
if (ranged != null)
{
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/VerseBase.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/VerseBase.java 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/VerseBase.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -33,11 +33,6 @@
*/
public interface VerseBase extends Cloneable, Serializable, Key
{
- /**
- * Translate the Passage into a human readable string
- * @return The string representation
- */
- String getName();
/**
* Translate the Passage into a human readable string, with the
@@ -50,13 +45,6 @@
String getName(Verse base);
/**
- * The OSIS defined specification for this Verse/VerseRange.
- * Uses short books names, with "." as a verse part separator.
- * @return a String containing the OSIS description of the verses
- */
- String getOsisRef();
-
- /**
* Create an array of Verses.
* See note on verseElements()
* @return The array of verses that this makes up
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/VerseRange.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/VerseRange.java 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/VerseRange.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -791,7 +791,7 @@
* Enumerate over the verse in this range
* @return A verse iterator
*/
- public Iterator verseIterator()
+ public Iterator<Key> verseIterator()
{
return new VerseIterator(this);
}
@@ -987,7 +987,7 @@
/**
* Iterate over the Verses in the VerseRange
*/
- private static final class VerseIterator implements Iterator
+ private static final class VerseIterator implements Iterator<Key>
{
/**
* Ctor
@@ -1009,7 +1009,7 @@
/* (non-Javadoc)
* @see java.util.Iterator#next()
*/
- public Object next() throws NoSuchElementException
+ public Key next() throws NoSuchElementException
{
if (next > last)
{
Modified: trunk/jsword/src/test/java/org/crosswire/jsword/book/ReadEverything.java
===================================================================
--- trunk/jsword/src/test/java/org/crosswire/jsword/book/ReadEverything.java 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/jsword/src/test/java/org/crosswire/jsword/book/ReadEverything.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -87,10 +87,8 @@
long start = System.currentTimeMillis();
int entries = 0;
- Iterator it = set.iterator();
- while (it.hasNext())
+ for (Key subset : set)
{
- Key subset = (Key) it.next();
if (subset.canHaveChildren())
{
testReadSingle(bmd, book, subset);
Modified: trunk/jsword-limbo/src/main/java/org/crosswire/bibledesktop/passage/BibleTreeNode.java
===================================================================
--- trunk/jsword-limbo/src/main/java/org/crosswire/bibledesktop/passage/BibleTreeNode.java 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/jsword-limbo/src/main/java/org/crosswire/bibledesktop/passage/BibleTreeNode.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -22,11 +22,11 @@
package org.crosswire.bibledesktop.passage;
import java.util.Enumeration;
-import java.util.Iterator;
import javax.swing.tree.TreeNode;
import org.crosswire.jsword.passage.BibleInfo;
+import org.crosswire.jsword.passage.Key;
import org.crosswire.jsword.passage.NoSuchVerseException;
import org.crosswire.jsword.passage.Passage;
import org.crosswire.jsword.passage.Verse;
@@ -64,10 +64,9 @@
int currentBook = 0;
int bookCount = 0;
- Iterator it = ref.iterator();
- while (it.hasNext())
+ for (Key key : ref)
{
- Verse verse = (Verse) it.next();
+ Verse verse = (Verse) key;
if (currentBook != verse.getBook())
{
currentBook = verse.getBook();
Modified: trunk/jsword-limbo/src/main/java/org/crosswire/bibledesktop/passage/BookTreeNode.java
===================================================================
--- trunk/jsword-limbo/src/main/java/org/crosswire/bibledesktop/passage/BookTreeNode.java 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/jsword-limbo/src/main/java/org/crosswire/bibledesktop/passage/BookTreeNode.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -21,11 +21,10 @@
*/
package org.crosswire.bibledesktop.passage;
-import java.util.Iterator;
-
import javax.swing.tree.TreeNode;
import org.crosswire.jsword.passage.BibleInfo;
+import org.crosswire.jsword.passage.Key;
import org.crosswire.jsword.passage.NoSuchVerseException;
import org.crosswire.jsword.passage.Passage;
import org.crosswire.jsword.passage.Verse;
@@ -67,10 +66,9 @@
int currentRef = 0;
int count = 0;
- Iterator it = ref.iterator();
- while (it.hasNext())
+ for (Key key : ref)
{
- Verse verse = (Verse) it.next();
+ Verse verse = (Verse) key;
if ((book == 0 || verse.getBook() == book)
&& currentRef != verse.getChapter())
Modified: trunk/jsword-limbo/src/main/java/org/crosswire/bibledesktop/passage/ChapterTreeNode.java
===================================================================
--- trunk/jsword-limbo/src/main/java/org/crosswire/bibledesktop/passage/ChapterTreeNode.java 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/jsword-limbo/src/main/java/org/crosswire/bibledesktop/passage/ChapterTreeNode.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -21,11 +21,10 @@
*/
package org.crosswire.bibledesktop.passage;
-import java.util.Iterator;
-
import javax.swing.tree.TreeNode;
import org.crosswire.jsword.passage.BibleInfo;
+import org.crosswire.jsword.passage.Key;
import org.crosswire.jsword.passage.NoSuchVerseException;
import org.crosswire.jsword.passage.Passage;
import org.crosswire.jsword.passage.Verse;
@@ -66,10 +65,9 @@
int verse_count = 0;
- Iterator it = ref.iterator();
- while (it.hasNext())
+ for (Key key : ref)
{
- Verse verse = (Verse) it.next();
+ Verse verse = (Verse) key;
if ((book == 0 || verse.getBook() == book)
&& (chapter == 0 || verse.getChapter() == chapter))
Modified: trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/basic/Verifier.java
===================================================================
--- trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/basic/Verifier.java 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/basic/Verifier.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -109,9 +109,8 @@
// For every verse in the Bible
int percent = 0;
- for (Iterator it = key.iterator(); it.hasNext(); )
+ for (Key subkey : key)
{
- Key subkey = (Key) it.next();
if (subkey.canHaveChildren())
{
Modified: trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/search/ser/SerIndex.java
===================================================================
--- trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/search/ser/SerIndex.java 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/search/ser/SerIndex.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -260,9 +260,8 @@
// loop through all the verses
int percent = 0;
- for (Iterator it = key.iterator(); it.hasNext(); )
+ for (Key sublist : key)
{
- Key sublist = (Key) it.next();
if (sublist.canHaveChildren())
{
generateSearchIndexImpl(job, sublist, matchmap);
Modified: trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/stub/StubDictionaryKeyFactory.java
===================================================================
--- trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/stub/StubDictionaryKeyFactory.java 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/stub/StubDictionaryKeyFactory.java 2006-03-14 13:20:54 UTC (rev 1047)
@@ -21,8 +21,6 @@
*/
package org.crosswire.jsword.book.stub;
-import java.util.Iterator;
-
import org.crosswire.jsword.passage.DefaultKeyList;
import org.crosswire.jsword.passage.DefaultLeafKeyList;
import org.crosswire.jsword.passage.Key;
@@ -69,9 +67,8 @@
{
DefaultKeyList reply = new DefaultKeyList();
- for (Iterator it = set.iterator(); it.hasNext();)
+ for (Key key : set)
{
- Key key = (Key) it.next();
if (key.getName().equals(name))
{
reply.addAll(key);
Modified: trunk/jsword-support/tools/checkstyle/custom.xml
===================================================================
--- trunk/jsword-support/tools/checkstyle/custom.xml 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/jsword-support/tools/checkstyle/custom.xml 2006-03-14 13:20:54 UTC (rev 1047)
@@ -111,11 +111,19 @@
<property name="option" value="space"/>
</module>
<module name="MethodParamPad"/>
+ <module name="WhitespaceAfter"/>
+ <module name="WhitespaceAround">
+ <!-- All but: GENERIC_START, GENERIC_END, WILDCARD_TYPE, -->
+ <property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN, TYPE_EXTENSION_AND"/>
+ </module>
<module name="NoWhitespaceAfter">
- <property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS"/><!-- ARRAY_INIT, -->
+ <property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS, GENERIC_START, GENERIC_END"/><!-- ARRAY_INIT, -->
<property name="allowLineBreaks" value="false"/>
</module>
- <module name="NoWhitespaceBefore"/>
+ <module name="NoWhitespaceBefore">
+ <property name="tokens" value="SEMI, POST_DEC, POST_INC, GENERIC_START, GENERIC_END"/>
+ <property name="allowLineBreaks" value="false"/>
+ </module>
<module name="OperatorWrap"/> <!-- ? -->
<module name="ParenPad">
<property name="option" value="nospace"/>
@@ -124,8 +132,6 @@
<property name="option" value="nospace"/>
</module>
<module name="TabCharacter"/>
- <module name="WhitespaceAfter"/>
- <module name="WhitespaceAround"/>
<!-- End of whitespace rules -->
<!-- Modifier Checks -->
@@ -299,7 +305,7 @@
<module name="TodoComment"/>
<module name="UncommentedMain">
- <property name="excludedClasses" value="\.(Desktop|APIExamples|XalanProcess)$"/>
+ <property name="excludedClasses" value="\.(Desktop|APIExamples|XalanProcess|XMLProcess|BibleToOsis|DictToOsis)$"/>
</module>
<module name="UpperEll"/>
<module name="ArrayTypeStyle"/>
Modified: trunk/jsword-web/build.xml
===================================================================
--- trunk/jsword-web/build.xml 2006-03-13 02:31:48 UTC (rev 1046)
+++ trunk/jsword-web/build.xml 2006-03-14 13:20:54 UTC (rev 1047)
@@ -87,7 +87,8 @@
</target>
<!--=======================================================================-->
- <target name="tools" depends="java2html,checkstyle,javancss,findbugs,pmd,cpd,jdepend"/>
+ <!-- <target name="tools" depends="java2html,checkstyle,javancss,findbugs,pmd,cpd,jdepend"/> -->
+ <target name="tools" depends="checkstyle,findbugs,pmd,cpd,jdepend"/>
<!--=======================================================================-->
<target name="install"
More information about the jsword-svn
mailing list