[jsword-svn] r2146 - in trunk/jsword/src: main/java/org/crosswire/common/util main/java/org/crosswire/jsword/book/sword main/java/org/crosswire/jsword/passage main/java/org/crosswire/jsword/versification test/java/org/crosswire/jsword/book/sword test/java/org/crosswire/jsword/passage
dmsmith at crosswire.org
dmsmith at crosswire.org
Thu Apr 7 13:04:54 MST 2011
Author: dmsmith
Date: 2011-04-07 13:04:54 -0700 (Thu, 07 Apr 2011)
New Revision: 2146
Added:
trunk/jsword/src/main/java/org/crosswire/common/util/Version.java
Modified:
trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/ConfigEntry.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/ConfigEntryTable.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/ConfigEntryType.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookMetaData.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordConstants.java
trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageEvent.java
trunk/jsword/src/main/java/org/crosswire/jsword/passage/Verse.java
trunk/jsword/src/main/java/org/crosswire/jsword/passage/VerseRange.java
trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleBook.java
trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleInfo.java
trunk/jsword/src/main/java/org/crosswire/jsword/versification/DivisionName.java
trunk/jsword/src/main/java/org/crosswire/jsword/versification/SectionNames.java
trunk/jsword/src/test/java/org/crosswire/jsword/book/sword/RawFileBackendTest.java
trunk/jsword/src/test/java/org/crosswire/jsword/passage/BibleInfoTest.java
trunk/jsword/src/test/java/org/crosswire/jsword/passage/PassageParentTst.java
trunk/jsword/src/test/java/org/crosswire/jsword/passage/PassageTally2Test.java
trunk/jsword/src/test/java/org/crosswire/jsword/passage/VerseRangeTest.java
trunk/jsword/src/test/java/org/crosswire/jsword/passage/VerseTest.java
Log:
Added support for version numbers like 1.0.1.
Added: trunk/jsword/src/main/java/org/crosswire/common/util/Version.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/common/util/Version.java (rev 0)
+++ trunk/jsword/src/main/java/org/crosswire/common/util/Version.java 2011-04-07 20:04:54 UTC (rev 2146)
@@ -0,0 +1,156 @@
+/**
+ * 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: 2011
+ * The copyright to this program is held by it's authors.
+ *
+ * ID: $Id$
+ */
+package org.crosswire.common.util;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Version is an immutable representation of dotted "number" consisting of 1 to 4 parts.
+ *
+ * <p>
+ * Here is the grammar for version strings:
+ *
+ * <pre>
+ * version ::= major('.'minor('.'micro('.'nano)?)?)?
+ * major ::= [0-9]+
+ * minor ::= [0-9]+
+ * micro ::= [0-9]+
+ * nano ::= [0-9]+
+ * </pre>
+ *
+ * @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 class Version implements Comparable<Version> {
+
+ /**
+ * The default version "1.0".
+ */
+ public static final Version defaultVersion = new Version("1.0");
+
+ /**
+ * Created a version identifier from the specified string.
+ *
+ * @param version String representation of the version identifier.
+ * @throws IllegalArgumentException If <code>version</code> is improperly
+ * formatted.
+ */
+ public Version(String version) {
+ if (version == null) {
+ throw new IllegalArgumentException("Null version not allowed.");
+ }
+ this.original = version;
+ this.parts = new int[] { -1, -1, -1, -1 };
+ Pattern regexp = Pattern.compile("^(\\d+)(?:.(\\d+))?(?:.(\\d+))?(?:.(\\d+))?$");
+ Matcher matcher = regexp.matcher(this.original);
+ if (matcher.matches()) {
+ int count = matcher.groupCount();
+ for (int i = 1; i <= count; i++) {
+ String part = matcher.group(i);
+ if (part == null) {
+ break;
+ }
+ parts[i - 1] = Integer.parseInt(part);
+ }
+ } else {
+ throw new IllegalArgumentException("invalid: " + version);
+ }
+ }
+
+ /**
+ * Returns the original string representation of this version identifier.
+ *
+ * @return The original string representation of this version identifier.
+ */
+ public String toString() {
+ return original;
+ }
+
+ /**
+ * Returns a hash code value for the object.
+ *
+ * @return An integer which is a hash code value for this object.
+ */
+ public int hashCode() {
+ return original.hashCode();
+ }
+
+ /**
+ * Compares this <code>Version object to another object.
+ *
+ * <p>
+ * A version is considered to be equal to another version if all the
+ * parts are equal.
+ *
+ * @param object The <code>Version</code> object to be compared.
+ * @return true if the two objects are equal.
+ */
+ public boolean equals(Version object) {
+ if (object == this) {
+ return true;
+ }
+
+ for (int i = 0; i < parts.length; i++) {
+ if (parts[i] != object.parts[i]) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * Compares this <code>Version</code> object to another object.
+ *
+ * <p>
+ * The comparison considers each of the parts (major, minor, micro, nano) in turn,
+ * comparing like with like. At any point the comparison is not equal, a result is
+ * known.
+ * </p>
+ *
+ * @param object The <code>Version</code> object to be compared.
+ * @return A negative integer, zero, or a positive integer if this object is
+ * less than, equal to, or greater than the specified
+ * <code>Version</code> object.
+ * @throws ClassCastException If the specified object is not a <code>Version</code>.
+ */
+ public int compareTo(Version object) {
+ if (object == this) {
+ return 0;
+ }
+
+ for (int i = 0; i < parts.length; i++) {
+ int result = parts[i] - object.parts[i];
+ if (result != 0) {
+ return result;
+ }
+ }
+
+ return 0;
+ }
+
+ private final String original;
+ private final int parts[];
+
+}
\ No newline at end of file
Property changes on: trunk/jsword/src/main/java/org/crosswire/common/util/Version.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/ConfigEntry.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/ConfigEntry.java 2011-04-05 01:15:52 UTC (rev 2145)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/ConfigEntry.java 2011-04-07 20:04:54 UTC (rev 2146)
@@ -26,7 +26,6 @@
import java.util.regex.Pattern;
import org.crosswire.common.util.Histogram;
-import org.crosswire.common.util.Language;
import org.crosswire.common.util.Logger;
import org.crosswire.common.util.StringUtil;
import org.crosswire.common.xml.XMLUtil;
@@ -299,11 +298,6 @@
// System.out.println(histogram.toString());
}
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
@Override
public boolean equals(Object obj) {
// Since this can not be null
@@ -321,21 +315,11 @@
return that.getName().equals(this.getName());
}
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
@Override
public int hashCode() {
return getName().hashCode();
}
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
@Override
public String toString() {
return getName();
@@ -392,8 +376,7 @@
}
/**
- * The conf value is the internal representation of the string. For
- * Language, this is the code, not the localized name. Add others as needed.
+ * The conf value is the internal representation of the string.
*
* @param aValue
* either value or values[i]
@@ -401,8 +384,8 @@
*/
private String getConfValue(Object aValue) {
if (aValue != null) {
- if (aValue instanceof Language) {
- return ((Language) value).getCode();
+ if (type != null) {
+ return type.unconvert(aValue);
}
return aValue.toString();
}
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/ConfigEntryTable.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/ConfigEntryTable.java 2011-04-05 01:15:52 UTC (rev 2145)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/ConfigEntryTable.java 2011-04-07 20:04:54 UTC (rev 2146)
@@ -285,7 +285,7 @@
* the value to match against
* @return true if there is a matching ConfigEntry matching the value
*/
- public boolean match(ConfigEntryType type, Object search) {
+ public boolean match(ConfigEntryType type, String search) {
ConfigEntry ce = table.get(type);
return ce != null && ce.match(search);
}
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/ConfigEntryType.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/ConfigEntryType.java 2011-04-05 01:15:52 UTC (rev 2145)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/ConfigEntryType.java 2011-04-07 20:04:54 UTC (rev 2146)
@@ -24,6 +24,7 @@
import java.util.regex.Pattern;
import org.crosswire.common.util.Language;
+import org.crosswire.common.util.Version;
import org.crosswire.jsword.book.BookCategory;
/**
@@ -303,6 +304,14 @@
public Object convert(String input) {
return new Language(input);
}
+
+ @Override
+ public String unconvert(Object internal) {
+ if (internal instanceof Language) {
+ return ((Language) internal).getCode();
+ }
+ return super.unconvert(internal);
+ }
},
/**
@@ -314,6 +323,14 @@
public Object convert(String input) {
return new Language(input);
}
+
+ @Override
+ public String unconvert(Object internal) {
+ if (internal instanceof Language) {
+ return ((Language) internal).getCode();
+ }
+ return super.unconvert(internal);
+ }
},
/**
@@ -343,12 +360,20 @@
@Override
public boolean isAllowed(String aValue) {
try {
- Float.parseFloat(aValue);
+ new Version(aValue);
return true;
- } catch (NumberFormatException e) {
+ } catch (IllegalArgumentException e) {
return false;
}
}
+ @Override
+ public Object convert(String input) {
+ try {
+ return new Version(input);
+ } catch (IllegalArgumentException e) {
+ return null;
+ }
+ }
},
/**
@@ -411,6 +436,14 @@
public Object convert(String input) {
return new Language(input);
}
+
+ @Override
+ public String unconvert(Object internal) {
+ if (internal instanceof Language) {
+ return ((Language) internal).getCode();
+ }
+ return super.unconvert(internal);
+ }
},
/**
@@ -452,9 +485,9 @@
},
/**
- * A list of prior "initials" for the current book. TODO(dms): when a user
- * installs a book with an obsoletes that matches an installed book, offer
- * the user the opportunity to delete the old book.
+ * A list of prior "initials" for the current book.
+ * TODO(dms): when a user installs a book with an obsoletes that matches
+ * an installed book, offer the user the opportunity to delete the old book.
*/
OBSOLETES("Obsoletes") {
@Override
@@ -661,6 +694,8 @@
*/
private ConfigEntryType(String name) {
this.name = name;
+ this.defaultValue = null;
+ this.picks = null;
}
/**
@@ -669,6 +704,7 @@
private ConfigEntryType(String name, String defaultValue) {
this.name = name;
this.defaultValue = convert(defaultValue);
+ this.picks = null;
}
/**
@@ -677,7 +713,9 @@
private ConfigEntryType(String name, int defaultPick, String... picks) {
this.name = name;
if (defaultPick >= 0 && defaultPick < picks.length) {
- this.defaultValue = picks[defaultPick];
+ this.defaultValue = convert(picks[defaultPick]);
+ } else {
+ this.defaultValue = null;
}
this.picks = picks;
}
@@ -820,6 +858,18 @@
}
/**
+ * Return the original representation of the object.
+ *
+ * @return the converted object
+ */
+ public String unconvert(Object internal) {
+ if (internal == null) {
+ return null;
+ }
+ return internal.toString();
+ }
+
+ /**
* Lookup method to convert from a String
*/
public static ConfigEntryType fromString(String name) {
@@ -851,17 +901,17 @@
/**
* The name of the ConfigEntryType
*/
- private String name;
+ private final String name;
/**
* The default for the ConfigEntryType
*/
- private Object defaultValue;
+ private final Object defaultValue;
/**
* The array of choices.
*/
- private String[] picks;
+ private final String[] picks;
/**
* Constants for direction
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 2011-04-05 01:15:52 UTC (rev 2145)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookMetaData.java 2011-04-07 20:04:54 UTC (rev 2146)
@@ -292,14 +292,14 @@
// This should return the dominate direction of the text, if it is BiDi,
// then we have to guess.
String dir = (String) getProperty(ConfigEntryType.DIRECTION);
- if (ConfigEntryType.DIRECTION_BIDI.equals(dir)) {
+ if (ConfigEntryType.DIRECTION_BIDI.equalsIgnoreCase(dir)) {
// When BiDi, return the dominate direction based upon the Book's
// Language not Direction
Language lang = (Language) getProperty(ConfigEntryType.LANG);
return lang.isLeftToRight();
}
- return ConfigEntryType.DIRECTION_LTOR.equals(dir);
+ return ConfigEntryType.DIRECTION_LTOR.equalsIgnoreCase(dir);
}
/*
@@ -351,15 +351,6 @@
putProperty(key.toString(), value);
}
- // Element ele = cet.toOSIS();
- // SAXEventProvider sep = new JDOMSAXEventProvider(new Document(ele));
- // try
- // {
- // System.out.println(XMLUtil.writeToString(sep));
- // }
- // catch(Exception e)
- // {
- // }
}
/**
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordConstants.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordConstants.java 2011-04-05 01:15:52 UTC (rev 2145)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordConstants.java 2011-04-07 20:04:54 UTC (rev 2146)
@@ -123,7 +123,7 @@
if (ord >= SwordConstants.ORDINAL_MAT11) {
// This is an NT verse
testament = SwordConstants.TESTAMENT_NEW;
- book = book - BibleBook.MALACHI.ordinal();
+ book = book - BibleBook.MAL.ordinal();
} else {
// This is an OT verse
testament = SwordConstants.TESTAMENT_OLD;
@@ -139,7 +139,7 @@
/**
* The start of the new testament
*/
- static final int ORDINAL_MAT11 = new Verse(BibleBook.MATTHEW, 1, 1, true).getOrdinal();
+ static final int ORDINAL_MAT11 = new Verse(BibleBook.MATT, 1, 1, true).getOrdinal();
/**
* array containing LUT of offsets in the chapter table.
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageEvent.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageEvent.java 2011-04-05 01:15:52 UTC (rev 2145)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageEvent.java 2011-04-07 20:04:54 UTC (rev 2146)
@@ -114,12 +114,12 @@
/**
* When the lower verse is null
*/
- public static final Verse VERSE_LOWEST = new Verse(BibleBook.GENESIS, 1, 1, true);
+ public static final Verse VERSE_LOWEST = new Verse(BibleBook.GEN, 1, 1, true);
/**
* When the upper verse is null
*/
- public static final Verse VERSE_HIGHEST = new Verse(BibleBook.REVELATION, 22, 21, true);
+ public static final Verse VERSE_HIGHEST = new Verse(BibleBook.REV, 22, 21, true);
/**
* The type of change
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/Verse.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/Verse.java 2011-04-05 01:15:52 UTC (rev 2145)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/Verse.java 2011-04-07 20:04:54 UTC (rev 2146)
@@ -856,7 +856,7 @@
/**
* The default verse
*/
- public static final Verse DEFAULT = new Verse(BibleBook.GENESIS, 1, 1, true);
+ public static final Verse DEFAULT = new Verse(BibleBook.GEN, 1, 1, true);
/**
* Allow the conversion to and from other number representations.
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/VerseRange.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/VerseRange.java 2011-04-05 01:15:52 UTC (rev 2145)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/VerseRange.java 2011-04-07 20:04:54 UTC (rev 2146)
@@ -1146,21 +1146,21 @@
static {
try {
- whole = new VerseRange(new Verse(BibleBook.GENESIS, 1, 1), new Verse(BibleBook.REVELATION, 22, 21));
+ whole = new VerseRange(new Verse(BibleBook.GEN, 1, 1), new Verse(BibleBook.REV, 22, 21));
} catch (NoSuchVerseException ex) {
assert false : ex;
whole = new VerseRange();
}
try {
- otRange = new VerseRange(new Verse(BibleBook.GENESIS, 1, 1), new Verse(BibleBook.MALACHI, 4, 6));
+ otRange = new VerseRange(new Verse(BibleBook.GEN, 1, 1), new Verse(BibleBook.MAL, 4, 6));
} catch (NoSuchVerseException ex) {
assert false : ex;
otRange = new VerseRange();
}
try {
- ntRange = new VerseRange(new Verse(BibleBook.MATTHEW, 1, 1), new Verse(BibleBook.REVELATION, 22, 21));
+ ntRange = new VerseRange(new Verse(BibleBook.MATT, 1, 1), new Verse(BibleBook.REV, 22, 21));
} catch (NoSuchVerseException ex) {
assert false : ex;
ntRange = new VerseRange();
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleBook.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleBook.java 2011-04-05 01:15:52 UTC (rev 2145)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleBook.java 2011-04-07 20:04:54 UTC (rev 2146)
@@ -11,73 +11,73 @@
*/
public enum BibleBook {
// Old Testament
- GENESIS("Gen"),
- EXODUS("Exod"),
- LEVITICUS("Lev"),
- NUMBERS("Num"),
- DEUTERONOMY("Deut"),
- JOSHUA("Josh"),
- JUDGES("Judg"),
+ GEN("Gen"),
+ EXOD("Exod"),
+ LEV("Lev"),
+ NUM("Num"),
+ DEUT("Deut"),
+ JOSH("Josh"),
+ JUDG("Judg"),
RUTH("Ruth"),
- SAMUEL1("1Sam"),
- SAMUEL2("2Sam"),
- KINGS1("1Kgs"),
- KINGS2("2Kgs"),
- CHRONICLES1("1Chr"),
- CHRONICLES2("2Chr"),
+ SAM1("1Sam"),
+ SAM2("2Sam"),
+ KGS1("1Kgs"),
+ KGS2("2Kgs"),
+ CHR1("1Chr"),
+ CHR2("2Chr"),
EZRA("Ezra"),
- NEHEMIAH("Neh"),
- ESTHER("Esth"),
+ NEH("Neh"),
+ ESTH("Esth"),
JOB("Job"),
- PSALMS("Ps"),
- PROVERBS("Prov"),
- ECCLESIASTES("Eccl"),
- SONGOFSOLOMON("Song"),
- ISAIAH("Isa"),
- JEREMIAH("Jer"),
- LAMENTATIONS("Lam"),
- EZEKIEL("Ezek"),
- DANIEL("Dan"),
- HOSEA("Hos"),
+ PS("Ps"),
+ PROV("Prov"),
+ ECCL("Eccl"),
+ SONG("Song"),
+ ISA("Isa"),
+ JER("Jer"),
+ LAM("Lam"),
+ EZEK("Ezek"),
+ DAN("Dan"),
+ HOS("Hos"),
JOEL("Joel"),
AMOS("Amos"),
- OBADIAH("Obad"),
+ OBAD("Obad"),
JONAH("Jonah"),
- MICAH("Mic"),
- NAHUM("Nah"),
- HABAKKUK("Hab"),
- ZEPHANIAH("Zeph"),
- HAGGAI("Hag"),
- ZECHARIAH("Zech"),
- MALACHI("Mal"),
+ MIC("Mic"),
+ NAH("Nah"),
+ HAB("Hab"),
+ ZEPH("Zeph"),
+ HAG("Hag"),
+ ZECH("Zech"),
+ MAL("Mal"),
// New Testament
- MATTHEW("Matt"),
+ MATT("Matt"),
MARK("Mark"),
LUKE("Luke"),
JOHN("John"),
ACTS("Acts"),
- ROMANS("Rom"),
- CORINTHIANS1("1Cor"),
- CORINTHIANS2("2Cor"),
- GALATIANS("Gal"),
- EPHESIANS("Eph"),
- PHILIPPIANS("Phil"),
- COLOSSIANS("Col"),
- THESSALONIANS1("1Thess"),
- THESSALONIANS2("2Thess"),
- TIMOTHY1("1Tim"),
- TIMOTHY2("2Tim"),
+ ROM("Rom"),
+ COR1("1Cor"),
+ COR2("2Cor"),
+ GAL("Gal"),
+ EPH("Eph"),
+ PHIL("Phil"),
+ COL("Col"),
+ THESS1("1Thess"),
+ THESS2("2Thess"),
+ TIM1("1Tim"),
+ TIM2("2Tim"),
TITUS("Titus"),
- PHILEMON("Phlm"),
- HEBREWS("Heb"),
- JAMES("Jas"),
- PETER1("1Pet"),
- PETER2("2Pet"),
+ PHLM("Phlm"),
+ HEB("Heb"),
+ JAS("Jas"),
+ PET1("1Pet"),
+ PET2("2Pet"),
JOHN1("1John"),
JOHN2("2John"),
JOHN3("3John"),
JUDE("Jude"),
- REVELATION("Rev"),
+ REV("Rev"),
// Apocrypha
TOB("Tob"),
JDT("Jdt"),
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleInfo.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleInfo.java 2011-04-05 01:15:52 UTC (rev 2145)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleInfo.java 2011-04-07 20:04:54 UTC (rev 2146)
@@ -234,7 +234,7 @@
// Therefore, subtract 2 instead of 1
int lastBook = ORDINAL_AT_START_OF_BOOK.length - 2;
// for (BibleBook book : BibleBook.values()) {
- for (BibleBook book: EnumSet.range(BibleBook.GENESIS, BibleBook.REVELATION)) {
+ for (BibleBook book: EnumSet.range(BibleBook.GEN, BibleBook.REV)) {
int b = book.ordinal();
if (b <= lastBook && ordinal >= ORDINAL_AT_START_OF_BOOK[b] && ordinal < ORDINAL_AT_START_OF_BOOK[b + 1]) {
int cib = BibleInfo.chaptersInBook(book);
@@ -247,7 +247,7 @@
}
assert false;
- return new Verse(BibleBook.GENESIS, 1, 1);
+ return new Verse(BibleBook.GEN, 1, 1);
}
/**
@@ -329,7 +329,7 @@
try {
// If the book is null, then patch to GENESIS
if (patchedBook == null) {
- patchedBook = BibleBook.GENESIS;
+ patchedBook = BibleBook.GEN;
}
// If they are too small
if (patchedChapter <= 0) {
@@ -344,7 +344,7 @@
patchedBook = BibleInfo.getNextBook(patchedBook);
if (patchedBook == null) {
- patchedBook = BibleBook.REVELATION;
+ patchedBook = BibleBook.REV;
patchedChapter = chaptersInBook(patchedBook);
patchedVerse = versesInChapter(patchedBook, patchedChapter);
return new Verse(patchedBook, patchedChapter, patchedVerse);
@@ -360,7 +360,7 @@
patchedBook = BibleInfo.getNextBook(patchedBook);
if (patchedBook == null) {
- patchedBook = BibleBook.REVELATION;
+ patchedBook = BibleBook.REV;
patchedChapter = chaptersInBook(patchedBook);
patchedVerse = versesInChapter(patchedBook, patchedChapter);
return new Verse(patchedBook, patchedChapter, patchedVerse);
@@ -371,7 +371,7 @@
return new Verse(patchedBook, patchedChapter, patchedVerse);
} catch (NoSuchKeyException ex) {
assert false : ex;
- return new Verse(BibleBook.GENESIS, 1, 1, true);
+ return new Verse(BibleBook.GEN, 1, 1, true);
}
}
@@ -826,7 +826,7 @@
out.println(" private static final short[] ORDINAL_AT_START_OF_BOOK =");
out.println(" {");
out.print(" ");
- for (BibleBook b: EnumSet.range(BibleBook.GENESIS, BibleBook.REVELATION)) {
+ for (BibleBook b: EnumSet.range(BibleBook.GEN, BibleBook.REV)) {
String vstr1 = " " + verseNum;
String vstr2 = vstr1.substring(vstr1.length() - 5);
out.print(vstr2 + ", ");
@@ -844,7 +844,7 @@
verseNum = 1;
out.println(" private static final short[][] ORDINAL_AT_START_OF_CHAPTER =");
out.println(" {");
- for (BibleBook b: EnumSet.range(BibleBook.GENESIS, BibleBook.REVELATION)) {
+ for (BibleBook b: EnumSet.range(BibleBook.GEN, BibleBook.REV)) {
out.println(" { ");
for (int c = 1; c <= BibleInfo.chaptersInBook(b); c++) {
String vstr1 = " " + verseNum;
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/versification/DivisionName.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/versification/DivisionName.java 2011-04-05 01:15:52 UTC (rev 2145)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/versification/DivisionName.java 2011-04-07 20:04:54 UTC (rev 2146)
@@ -37,7 +37,7 @@
@Override
public boolean contains(BibleBook book) {
int bookNum = book.ordinal();
- return bookNum >= BibleBook.GENESIS.ordinal() && bookNum <= BibleBook.REVELATION.ordinal();
+ return bookNum >= BibleBook.GEN.ordinal() && bookNum <= BibleBook.REV.ordinal();
}
@Override
@@ -62,7 +62,7 @@
@Override
public boolean contains(BibleBook book) {
int bookNum = book.ordinal();
- return bookNum >= BibleBook.GENESIS.ordinal() && bookNum <= BibleBook.MALACHI.ordinal();
+ return bookNum >= BibleBook.GEN.ordinal() && bookNum <= BibleBook.MAL.ordinal();
}
@Override
@@ -86,7 +86,7 @@
@Override
public boolean contains(BibleBook book) {
int bookNum = book.ordinal();
- return bookNum >= BibleBook.GENESIS.ordinal() && bookNum <= BibleBook.DEUTERONOMY.ordinal();
+ return bookNum >= BibleBook.GEN.ordinal() && bookNum <= BibleBook.DEUT.ordinal();
}
@Override
@@ -110,7 +110,7 @@
@Override
public boolean contains(BibleBook book) {
int bookNum = book.ordinal();
- return bookNum >= BibleBook.JOSHUA.ordinal() && bookNum <= BibleBook.ESTHER.ordinal();
+ return bookNum >= BibleBook.JOSH.ordinal() && bookNum <= BibleBook.ESTH.ordinal();
}
@Override
@@ -134,7 +134,7 @@
@Override
public boolean contains(BibleBook book) {
int bookNum = book.ordinal();
- return bookNum >= BibleBook.JOB.ordinal() && bookNum <= BibleBook.SONGOFSOLOMON.ordinal();
+ return bookNum >= BibleBook.JOB.ordinal() && bookNum <= BibleBook.SONG.ordinal();
}
@Override
@@ -159,7 +159,7 @@
@Override
public boolean contains(BibleBook book) {
int bookNum = book.ordinal();
- return bookNum == BibleBook.REVELATION.ordinal() || bookNum >= BibleBook.ISAIAH.ordinal() && bookNum <= BibleBook.MALACHI.ordinal();
+ return bookNum == BibleBook.REV.ordinal() || bookNum >= BibleBook.ISA.ordinal() && bookNum <= BibleBook.MAL.ordinal();
}
@Override
@@ -188,7 +188,7 @@
@Override
public boolean contains(BibleBook book) {
int bookNum = book.ordinal();
- return bookNum >= BibleBook.ISAIAH.ordinal() && bookNum <= BibleBook.DANIEL.ordinal();
+ return bookNum >= BibleBook.ISA.ordinal() && bookNum <= BibleBook.DAN.ordinal();
}
@Override
@@ -213,7 +213,7 @@
@Override
public boolean contains(BibleBook book) {
int bookNum = book.ordinal();
- return bookNum >= BibleBook.HOSEA.ordinal() && bookNum <= BibleBook.MALACHI.ordinal();
+ return bookNum >= BibleBook.HOS.ordinal() && bookNum <= BibleBook.MAL.ordinal();
}
@Override
@@ -239,7 +239,7 @@
@Override
public boolean contains(BibleBook book) {
int bookNum = book.ordinal();
- return bookNum >= BibleBook.GENESIS.ordinal() && bookNum <= BibleBook.REVELATION.ordinal();
+ return bookNum >= BibleBook.GEN.ordinal() && bookNum <= BibleBook.REV.ordinal();
}
@Override
@@ -263,7 +263,7 @@
@Override
public boolean contains(BibleBook book) {
int bookNum = book.ordinal();
- return bookNum >= BibleBook.MATTHEW.ordinal() && bookNum <= BibleBook.ACTS.ordinal();
+ return bookNum >= BibleBook.MATT.ordinal() && bookNum <= BibleBook.ACTS.ordinal();
}
@Override
@@ -288,7 +288,7 @@
@Override
public boolean contains(BibleBook book) {
int bookNum = book.ordinal();
- return bookNum >= BibleBook.ROMANS.ordinal() && bookNum <= BibleBook.JUDE.ordinal();
+ return bookNum >= BibleBook.ROM.ordinal() && bookNum <= BibleBook.JUDE.ordinal();
}
@Override
@@ -315,7 +315,7 @@
@Override
public boolean contains(BibleBook book) {
int bookNum = book.ordinal();
- return bookNum >= BibleBook.ROMANS.ordinal() && bookNum <= BibleBook.JUDE.ordinal();
+ return bookNum >= BibleBook.ROM.ordinal() && bookNum <= BibleBook.JUDE.ordinal();
}
@Override
@@ -341,7 +341,7 @@
@Override
public boolean contains(BibleBook book) {
int bookNum = book.ordinal();
- return bookNum >= BibleBook.ROMANS.ordinal() && bookNum <= BibleBook.JUDE.ordinal();
+ return bookNum >= BibleBook.ROM.ordinal() && bookNum <= BibleBook.JUDE.ordinal();
}
@Override
@@ -365,7 +365,7 @@
REVELATION {
@Override
public boolean contains(BibleBook book) {
- return book == BibleBook.REVELATION;
+ return book == BibleBook.REV;
}
@Override
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/versification/SectionNames.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/versification/SectionNames.java 2011-04-05 01:15:52 UTC (rev 2145)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/versification/SectionNames.java 2011-04-07 20:04:54 UTC (rev 2146)
@@ -37,7 +37,7 @@
@Override
public boolean contains(BibleBook book) {
int bookNum = book.ordinal();
- return bookNum >= BibleBook.GENESIS.ordinal() && bookNum <= BibleBook.REVELATION.ordinal();
+ return bookNum >= BibleBook.GEN.ordinal() && bookNum <= BibleBook.REV.ordinal();
}
@Override
@@ -62,7 +62,7 @@
@Override
public boolean contains(BibleBook book) {
int bookNum = book.ordinal();
- return bookNum >= BibleBook.GENESIS.ordinal() && bookNum <= BibleBook.MALACHI.ordinal();
+ return bookNum >= BibleBook.GEN.ordinal() && bookNum <= BibleBook.MAL.ordinal();
}
@Override
@@ -86,7 +86,7 @@
@Override
public boolean contains(BibleBook book) {
int bookNum = book.ordinal();
- return bookNum >= BibleBook.GENESIS.ordinal() && bookNum <= BibleBook.DEUTERONOMY.ordinal();
+ return bookNum >= BibleBook.GEN.ordinal() && bookNum <= BibleBook.DEUT.ordinal();
}
@Override
@@ -110,7 +110,7 @@
@Override
public boolean contains(BibleBook book) {
int bookNum = book.ordinal();
- return bookNum >= BibleBook.JOSHUA.ordinal() && bookNum <= BibleBook.ESTHER.ordinal();
+ return bookNum >= BibleBook.JOSH.ordinal() && bookNum <= BibleBook.ESTH.ordinal();
}
@Override
@@ -134,7 +134,7 @@
@Override
public boolean contains(BibleBook book) {
int bookNum = book.ordinal();
- return bookNum >= BibleBook.JOB.ordinal() && bookNum <= BibleBook.SONGOFSOLOMON.ordinal();
+ return bookNum >= BibleBook.JOB.ordinal() && bookNum <= BibleBook.SONG.ordinal();
}
@Override
@@ -159,7 +159,7 @@
@Override
public boolean contains(BibleBook book) {
int bookNum = book.ordinal();
- return bookNum == BibleBook.REVELATION.ordinal() || bookNum >= BibleBook.ISAIAH.ordinal() && bookNum <= BibleBook.MALACHI.ordinal();
+ return bookNum == BibleBook.REV.ordinal() || bookNum >= BibleBook.ISA.ordinal() && bookNum <= BibleBook.MAL.ordinal();
}
@Override
@@ -188,7 +188,7 @@
@Override
public boolean contains(BibleBook book) {
int bookNum = book.ordinal();
- return bookNum >= BibleBook.ISAIAH.ordinal() && bookNum <= BibleBook.DANIEL.ordinal();
+ return bookNum >= BibleBook.ISA.ordinal() && bookNum <= BibleBook.DAN.ordinal();
}
@Override
@@ -213,7 +213,7 @@
@Override
public boolean contains(BibleBook book) {
int bookNum = book.ordinal();
- return bookNum >= BibleBook.HOSEA.ordinal() && bookNum <= BibleBook.MALACHI.ordinal();
+ return bookNum >= BibleBook.HOS.ordinal() && bookNum <= BibleBook.MAL.ordinal();
}
@Override
@@ -239,7 +239,7 @@
@Override
public boolean contains(BibleBook book) {
int bookNum = book.ordinal();
- return bookNum >= BibleBook.GENESIS.ordinal() && bookNum <= BibleBook.REVELATION.ordinal();
+ return bookNum >= BibleBook.GEN.ordinal() && bookNum <= BibleBook.REV.ordinal();
}
@Override
@@ -263,7 +263,7 @@
@Override
public boolean contains(BibleBook book) {
int bookNum = book.ordinal();
- return bookNum >= BibleBook.MATTHEW.ordinal() && bookNum <= BibleBook.ACTS.ordinal();
+ return bookNum >= BibleBook.MATT.ordinal() && bookNum <= BibleBook.ACTS.ordinal();
}
@Override
@@ -288,7 +288,7 @@
@Override
public boolean contains(BibleBook book) {
int bookNum = book.ordinal();
- return bookNum >= BibleBook.ROMANS.ordinal() && bookNum <= BibleBook.JUDE.ordinal();
+ return bookNum >= BibleBook.ROM.ordinal() && bookNum <= BibleBook.JUDE.ordinal();
}
@Override
@@ -315,7 +315,7 @@
@Override
public boolean contains(BibleBook book) {
int bookNum = book.ordinal();
- return bookNum >= BibleBook.ROMANS.ordinal() && bookNum <= BibleBook.JUDE.ordinal();
+ return bookNum >= BibleBook.ROM.ordinal() && bookNum <= BibleBook.JUDE.ordinal();
}
@Override
@@ -341,7 +341,7 @@
@Override
public boolean contains(BibleBook book) {
int bookNum = book.ordinal();
- return bookNum >= BibleBook.ROMANS.ordinal() && bookNum <= BibleBook.JUDE.ordinal();
+ return bookNum >= BibleBook.ROM.ordinal() && bookNum <= BibleBook.JUDE.ordinal();
}
@Override
@@ -365,7 +365,7 @@
REVELATION {
@Override
public boolean contains(BibleBook book) {
- return book == BibleBook.REVELATION;
+ return book == BibleBook.REV;
}
@Override
Modified: trunk/jsword/src/test/java/org/crosswire/jsword/book/sword/RawFileBackendTest.java
===================================================================
--- trunk/jsword/src/test/java/org/crosswire/jsword/book/sword/RawFileBackendTest.java 2011-04-05 01:15:52 UTC (rev 2145)
+++ trunk/jsword/src/test/java/org/crosswire/jsword/book/sword/RawFileBackendTest.java 2011-04-07 20:04:54 UTC (rev 2146)
@@ -53,13 +53,13 @@
}
public void testSetRawText() throws NoSuchVerseException, IOException, BookException {
- Verse otVerse = new Verse(BibleBook.GENESIS, 3, 1);
- Verse otVerse2 = new Verse(BibleBook.LEVITICUS, 3, 5);
- Verse otVerse3 = new Verse(BibleBook.EXODUS, 6, 4);
- Verse otVerse4 = new Verse(BibleBook.JUDGES, 3, 1);
- Verse ntVerse = new Verse(BibleBook.PETER2, 1, 2);
- Verse ntVerse2 = new Verse(BibleBook.PETER1, 1, 2);
- Verse ntVerse3 = new Verse(BibleBook.REVELATION, 22, 21);
+ Verse otVerse = new Verse(BibleBook.GEN, 3, 1);
+ Verse otVerse2 = new Verse(BibleBook.LEV, 3, 5);
+ Verse otVerse3 = new Verse(BibleBook.EXOD, 6, 4);
+ Verse otVerse4 = new Verse(BibleBook.JUDG, 3, 1);
+ Verse ntVerse = new Verse(BibleBook.PET2, 1, 2);
+ Verse ntVerse2 = new Verse(BibleBook.PET1, 1, 2);
+ Verse ntVerse3 = new Verse(BibleBook.REV, 22, 21);
Verse ntVerse4 = new Verse(BibleBook.JOHN3, 1, 2);
backend.setRawText(otVerse, "Hello OT");
Modified: trunk/jsword/src/test/java/org/crosswire/jsword/passage/BibleInfoTest.java
===================================================================
--- trunk/jsword/src/test/java/org/crosswire/jsword/passage/BibleInfoTest.java 2011-04-05 01:15:52 UTC (rev 2145)
+++ trunk/jsword/src/test/java/org/crosswire/jsword/passage/BibleInfoTest.java 2011-04-07 20:04:54 UTC (rev 2146)
@@ -67,94 +67,94 @@
public void testGetLongBookName() throws Exception {
BookName.setCase(CaseType.SENTENCE);
- assertEquals("Genesis", BibleBook.GENESIS.getLongName());
- assertEquals("Revelation of John", BibleBook.REVELATION.getLongName());
+ assertEquals("Genesis", BibleBook.GEN.getLongName());
+ assertEquals("Revelation of John", BibleBook.REV.getLongName());
BookName.setCase(CaseType.LOWER);
- assertEquals("genesis", BibleBook.GENESIS.getLongName());
- assertEquals("revelation of john", BibleBook.REVELATION.getLongName());
+ assertEquals("genesis", BibleBook.GEN.getLongName());
+ assertEquals("revelation of john", BibleBook.REV.getLongName());
BookName.setCase(CaseType.UPPER);
- assertEquals("GENESIS", BibleBook.GENESIS.getLongName());
- assertEquals("REVELATION OF JOHN", BibleBook.REVELATION.getLongName());
+ assertEquals("GENESIS", BibleBook.GEN.getLongName());
+ assertEquals("REVELATION OF JOHN", BibleBook.REV.getLongName());
}
public void testGetShortBookName() throws Exception {
BookName.setCase(CaseType.SENTENCE);
- assertEquals("Gen", BibleBook.GENESIS.getShortName());
- assertEquals("Exo", BibleBook.EXODUS.getShortName());
- assertEquals("Judg", BibleBook.JUDGES.getShortName());
- assertEquals("Mal", BibleBook.MALACHI.getShortName());
- assertEquals("Mat", BibleBook.MATTHEW.getShortName());
- assertEquals("Phili", BibleBook.PHILIPPIANS.getShortName());
- assertEquals("Phile", BibleBook.PHILEMON.getShortName());
+ assertEquals("Gen", BibleBook.GEN.getShortName());
+ assertEquals("Exo", BibleBook.EXOD.getShortName());
+ assertEquals("Judg", BibleBook.JUDG.getShortName());
+ assertEquals("Mal", BibleBook.MAL.getShortName());
+ assertEquals("Mat", BibleBook.MATT.getShortName());
+ assertEquals("Phili", BibleBook.PHIL.getShortName());
+ assertEquals("Phile", BibleBook.PHLM.getShortName());
assertEquals("Jude", BibleBook.JUDE.getShortName());
- assertEquals("Rev", BibleBook.REVELATION.getShortName());
+ assertEquals("Rev", BibleBook.REV.getShortName());
BookName.setCase(CaseType.LOWER);
- assertEquals("gen", BibleBook.GENESIS.getShortName());
- assertEquals("exo", BibleBook.EXODUS.getShortName());
- assertEquals("judg", BibleBook.JUDGES.getShortName());
- assertEquals("mal", BibleBook.MALACHI.getShortName());
- assertEquals("mat", BibleBook.MATTHEW.getShortName());
- assertEquals("phili", BibleBook.PHILIPPIANS.getShortName());
- assertEquals("phile", BibleBook.PHILEMON.getShortName());
+ assertEquals("gen", BibleBook.GEN.getShortName());
+ assertEquals("exo", BibleBook.EXOD.getShortName());
+ assertEquals("judg", BibleBook.JUDG.getShortName());
+ assertEquals("mal", BibleBook.MAL.getShortName());
+ assertEquals("mat", BibleBook.MATT.getShortName());
+ assertEquals("phili", BibleBook.PHIL.getShortName());
+ assertEquals("phile", BibleBook.PHLM.getShortName());
assertEquals("jude", BibleBook.JUDE.getShortName());
- assertEquals("rev", BibleBook.REVELATION.getShortName());
+ assertEquals("rev", BibleBook.REV.getShortName());
BookName.setCase(CaseType.UPPER);
- assertEquals("GEN", BibleBook.GENESIS.getShortName());
- assertEquals("EXO", BibleBook.EXODUS.getShortName());
- assertEquals("JUDG", BibleBook.JUDGES.getShortName());
- assertEquals("MAL", BibleBook.MALACHI.getShortName());
- assertEquals("MAT", BibleBook.MATTHEW.getShortName());
- assertEquals("PHILI", BibleBook.PHILIPPIANS.getShortName());
- assertEquals("PHILE", BibleBook.PHILEMON.getShortName());
+ assertEquals("GEN", BibleBook.GEN.getShortName());
+ assertEquals("EXO", BibleBook.EXOD.getShortName());
+ assertEquals("JUDG", BibleBook.JUDG.getShortName());
+ assertEquals("MAL", BibleBook.MAL.getShortName());
+ assertEquals("MAT", BibleBook.MATT.getShortName());
+ assertEquals("PHILI", BibleBook.PHIL.getShortName());
+ assertEquals("PHILE", BibleBook.PHLM.getShortName());
assertEquals("JUDE", BibleBook.JUDE.getShortName());
- assertEquals("REV", BibleBook.REVELATION.getShortName());
+ assertEquals("REV", BibleBook.REV.getShortName());
}
public void testGetBookJogger() throws Exception {
- assertEquals("Gen", BibleBook.GENESIS.getOSIS());
- assertEquals("Exod", BibleBook.EXODUS.getOSIS());
- assertEquals("Rev", BibleBook.REVELATION.getOSIS());
+ assertEquals("Gen", BibleBook.GEN.getOSIS());
+ assertEquals("Exod", BibleBook.EXOD.getOSIS());
+ assertEquals("Rev", BibleBook.REV.getOSIS());
}
public void testGetBookNumber() {
- assertEquals(BibleBook.GENESIS, BibleBook.getBook("Genesis"));
- assertEquals(BibleBook.GENESIS, BibleBook.getBook("Gene"));
- assertEquals(BibleBook.GENESIS, BibleBook.getBook("Gen"));
- assertEquals(BibleBook.GENESIS, BibleBook.getBook("G"));
- assertEquals(BibleBook.GENESIS, BibleBook.getBook("g"));
- assertEquals(BibleBook.GENESIS, BibleBook.getBook("GEN"));
- assertEquals(BibleBook.GENESIS, BibleBook.getBook("genesis"));
- assertEquals(BibleBook.PSALMS, BibleBook.getBook("psa"));
- assertEquals(BibleBook.PSALMS, BibleBook.getBook("ps"));
- assertEquals(BibleBook.PSALMS, BibleBook.getBook("pss"));
- assertEquals(BibleBook.PSALMS, BibleBook.getBook("psalter"));
- assertEquals(BibleBook.ECCLESIASTES, BibleBook.getBook("ecc"));
- assertEquals(BibleBook.ECCLESIASTES, BibleBook.getBook("Qohelot"));
- assertEquals(BibleBook.SONGOFSOLOMON, BibleBook.getBook("son"));
- assertEquals(BibleBook.SONGOFSOLOMON, BibleBook.getBook("song"));
- assertEquals(BibleBook.SONGOFSOLOMON, BibleBook.getBook("song of solomon"));
- assertEquals(BibleBook.SONGOFSOLOMON, BibleBook.getBook("songofsolomon"));
- assertEquals(BibleBook.SONGOFSOLOMON, BibleBook.getBook("ss"));
- assertEquals(BibleBook.SONGOFSOLOMON, BibleBook.getBook("canticle"));
- assertEquals(BibleBook.SONGOFSOLOMON, BibleBook.getBook("can"));
- assertEquals(BibleBook.PHILIPPIANS, BibleBook.getBook("phi"));
- assertEquals(BibleBook.PHILIPPIANS, BibleBook.getBook("phil"));
- assertEquals(BibleBook.PHILIPPIANS, BibleBook.getBook("phili"));
- assertEquals(BibleBook.PHILEMON, BibleBook.getBook("phile"));
- assertEquals(BibleBook.REVELATION, BibleBook.getBook("revelations"));
- assertEquals(BibleBook.REVELATION, BibleBook.getBook("rev"));
+ assertEquals(BibleBook.GEN, BibleBook.getBook("Genesis"));
+ assertEquals(BibleBook.GEN, BibleBook.getBook("Gene"));
+ assertEquals(BibleBook.GEN, BibleBook.getBook("Gen"));
+ assertEquals(BibleBook.GEN, BibleBook.getBook("G"));
+ assertEquals(BibleBook.GEN, BibleBook.getBook("g"));
+ assertEquals(BibleBook.GEN, BibleBook.getBook("GEN"));
+ assertEquals(BibleBook.GEN, BibleBook.getBook("genesis"));
+ assertEquals(BibleBook.PS, BibleBook.getBook("psa"));
+ assertEquals(BibleBook.PS, BibleBook.getBook("ps"));
+ assertEquals(BibleBook.PS, BibleBook.getBook("pss"));
+ assertEquals(BibleBook.PS, BibleBook.getBook("psalter"));
+ assertEquals(BibleBook.ECCL, BibleBook.getBook("ecc"));
+ assertEquals(BibleBook.ECCL, BibleBook.getBook("Qohelot"));
+ assertEquals(BibleBook.SONG, BibleBook.getBook("son"));
+ assertEquals(BibleBook.SONG, BibleBook.getBook("song"));
+ assertEquals(BibleBook.SONG, BibleBook.getBook("song of solomon"));
+ assertEquals(BibleBook.SONG, BibleBook.getBook("songofsolomon"));
+ assertEquals(BibleBook.SONG, BibleBook.getBook("ss"));
+ assertEquals(BibleBook.SONG, BibleBook.getBook("canticle"));
+ assertEquals(BibleBook.SONG, BibleBook.getBook("can"));
+ assertEquals(BibleBook.PHIL, BibleBook.getBook("phi"));
+ assertEquals(BibleBook.PHIL, BibleBook.getBook("phil"));
+ assertEquals(BibleBook.PHIL, BibleBook.getBook("phili"));
+ assertEquals(BibleBook.PHLM, BibleBook.getBook("phile"));
+ assertEquals(BibleBook.REV, BibleBook.getBook("revelations"));
+ assertEquals(BibleBook.REV, BibleBook.getBook("rev"));
assertEquals(null, BibleBook.getBook("1"));
}
public void testIn() throws Exception {
- assertEquals(1533, BibleInfo.versesInBook(BibleBook.GENESIS));
- assertEquals(404, BibleInfo.versesInBook(BibleBook.REVELATION));
+ assertEquals(1533, BibleInfo.versesInBook(BibleBook.GEN));
+ assertEquals(404, BibleInfo.versesInBook(BibleBook.REV));
// Counts using loops
int viw_b = 0;
@@ -163,7 +163,7 @@
// For all the books
// for (BibleBook b : BibleBook.values()) {
- for (BibleBook b: EnumSet.range(BibleBook.GENESIS, BibleBook.REVELATION)) {
+ for (BibleBook b: EnumSet.range(BibleBook.GEN, BibleBook.REV)) {
// Count and check the verses in this book
int vib = 0;
for (int c = 1; c <= BibleInfo.chaptersInBook(b); c++) {
@@ -191,7 +191,7 @@
int first_verse_ord = 1;
int last_verse_ord = 1;
// for (BibleBook b : BibleBook.values()) {
- for (BibleBook b: EnumSet.range(BibleBook.GENESIS, BibleBook.REVELATION)) {
+ for (BibleBook b: EnumSet.range(BibleBook.GEN, BibleBook.REV)) {
for (int c = 1; c <= BibleInfo.chaptersInBook(b); c++) {
last_verse_ord = first_verse_ord + BibleInfo.versesInChapter(b, c) - 1;
@@ -215,7 +215,7 @@
} catch (NoSuchVerseException ex) {
}
// for (BibleBook b : BibleBook.values()) {
- for (BibleBook b: EnumSet.range(BibleBook.GENESIS, BibleBook.REVELATION)) {
+ for (BibleBook b: EnumSet.range(BibleBook.GEN, BibleBook.REV)) {
try {
BibleInfo.validate(b, 0, 1);
fail();
@@ -260,12 +260,12 @@
public void testPatch() throws Exception {
int all = 1;
// for (BibleBook b : BibleBook.values()) {
- for (BibleBook b: EnumSet.range(BibleBook.GENESIS, BibleBook.REVELATION)) {
+ for (BibleBook b: EnumSet.range(BibleBook.GEN, BibleBook.REV)) {
int cib = BibleInfo.chaptersInBook(b);
for (int c = 1; c <= cib; c++) {
int vic = BibleInfo.versesInChapter(b, c);
for (int v = 1; v <= vic; v++) {
- Verse pv = BibleInfo.patch(BibleBook.GENESIS, 1, all);
+ Verse pv = BibleInfo.patch(BibleBook.GEN, 1, all);
assertEquals(b, pv.getBook());
assertEquals(c, pv.getChapter());
@@ -274,11 +274,11 @@
}
}
}
- Verse gen11 = new Verse(BibleBook.GENESIS, 1, 1);
- assertEquals(gen11, BibleInfo.patch(BibleBook.GENESIS, 1, 1));
- assertEquals(gen11, BibleInfo.patch(BibleBook.GENESIS, 1, 0));
- assertEquals(gen11, BibleInfo.patch(BibleBook.GENESIS, 0, 1));
- assertEquals(gen11, BibleInfo.patch(BibleBook.GENESIS, 0, 0));
+ Verse gen11 = new Verse(BibleBook.GEN, 1, 1);
+ assertEquals(gen11, BibleInfo.patch(BibleBook.GEN, 1, 1));
+ assertEquals(gen11, BibleInfo.patch(BibleBook.GEN, 1, 0));
+ assertEquals(gen11, BibleInfo.patch(BibleBook.GEN, 0, 1));
+ assertEquals(gen11, BibleInfo.patch(BibleBook.GEN, 0, 0));
assertEquals(gen11, BibleInfo.patch(null, 1, 1));
assertEquals(gen11, BibleInfo.patch(null, 1, 0));
assertEquals(gen11, BibleInfo.patch(null, 0, 1));
@@ -288,12 +288,12 @@
public void testVerseCount() throws Exception {
int count_up = 0;
int count_down = 31102;
- Verse gen11 = new Verse(BibleBook.GENESIS, 1, 1);
- Verse gen110 = new Verse(BibleBook.GENESIS, 1, 10);
- Verse exo11 = new Verse(BibleBook.EXODUS, 1, 1);
- Verse rev99 = new Verse(BibleBook.REVELATION, 22, 21);
+ Verse gen11 = new Verse(BibleBook.GEN, 1, 1);
+ Verse gen110 = new Verse(BibleBook.GEN, 1, 10);
+ Verse exo11 = new Verse(BibleBook.EXOD, 1, 1);
+ Verse rev99 = new Verse(BibleBook.REV, 22, 21);
// for (BibleBook b : BibleBook.values()) {
- for (BibleBook b: EnumSet.range(BibleBook.GENESIS, BibleBook.REVELATION)) {
+ for (BibleBook b: EnumSet.range(BibleBook.GEN, BibleBook.REV)) {
for (int c = 1; c <= BibleInfo.chaptersInBook(b); c++) {
for (int v = 1; v <= BibleInfo.versesInChapter(b, c); v++) {
Verse curVerse = new Verse(b, c, v);
@@ -309,13 +309,13 @@
assertEquals(BibleInfo.versesInBook(b), new Verse(b, BibleInfo.chaptersInBook(b), BibleInfo.versesInChapter(b, BibleInfo.chaptersInBook(b))).subtract(new Verse(b, 1, 1)) + 1 );
}
- assertEquals(BibleInfo.versesInBook(BibleBook.GENESIS), exo11.subtract(gen11));
+ assertEquals(BibleInfo.versesInBook(BibleBook.GEN), exo11.subtract(gen11));
assertEquals(9, gen110.subtract(gen11));
}
public void testNames() {
- assertEquals(0, BibleBook.GENESIS.ordinal());
- assertEquals(65, BibleBook.REVELATION.ordinal());
+ assertEquals(0, BibleBook.GEN.ordinal());
+ assertEquals(65, BibleBook.REV.ordinal());
}
/**
Modified: trunk/jsword/src/test/java/org/crosswire/jsword/passage/PassageParentTst.java
===================================================================
--- trunk/jsword/src/test/java/org/crosswire/jsword/passage/PassageParentTst.java 2011-04-05 01:15:52 UTC (rev 2145)
+++ trunk/jsword/src/test/java/org/crosswire/jsword/passage/PassageParentTst.java 2011-04-07 20:04:54 UTC (rev 2146)
@@ -125,21 +125,21 @@
empty.optimizeReads();
}
- gen11_1 = RestrictionType.NONE.toRange(new Verse(BibleBook.GENESIS, 1, 1), 1);
- gen11_2 = RestrictionType.NONE.toRange(new Verse(BibleBook.GENESIS, 1, 1), 2);
- gen12_1 = RestrictionType.NONE.toRange(new Verse(BibleBook.GENESIS, 1, 2), 1);
- exo21_1 = RestrictionType.NONE.toRange(new Verse(BibleBook.EXODUS, 2, 1), 1);
- exo21_2 = RestrictionType.NONE.toRange(new Verse(BibleBook.EXODUS, 2, 1), 2);
- exo22_1 = RestrictionType.NONE.toRange(new Verse(BibleBook.EXODUS, 2, 2), 1);
+ gen11_1 = RestrictionType.NONE.toRange(new Verse(BibleBook.GEN, 1, 1), 1);
+ gen11_2 = RestrictionType.NONE.toRange(new Verse(BibleBook.GEN, 1, 1), 2);
+ gen12_1 = RestrictionType.NONE.toRange(new Verse(BibleBook.GEN, 1, 2), 1);
+ exo21_1 = RestrictionType.NONE.toRange(new Verse(BibleBook.EXOD, 2, 1), 1);
+ exo21_2 = RestrictionType.NONE.toRange(new Verse(BibleBook.EXOD, 2, 1), 2);
+ exo22_1 = RestrictionType.NONE.toRange(new Verse(BibleBook.EXOD, 2, 2), 1);
- gen11 = new Verse(BibleBook.GENESIS, 1, 1);
- gen12 = new Verse(BibleBook.GENESIS, 1, 2);
- gen13 = new Verse(BibleBook.GENESIS, 1, 3);
- gen15 = new Verse(BibleBook.GENESIS, 1, 5);
- exo21 = new Verse(BibleBook.EXODUS, 2, 1);
- exo22 = new Verse(BibleBook.EXODUS, 2, 2);
- exo23 = new Verse(BibleBook.EXODUS, 2, 3);
- exo3b = new Verse(BibleBook.EXODUS, 3, 11);
+ gen11 = new Verse(BibleBook.GEN, 1, 1);
+ gen12 = new Verse(BibleBook.GEN, 1, 2);
+ gen13 = new Verse(BibleBook.GEN, 1, 3);
+ gen15 = new Verse(BibleBook.GEN, 1, 5);
+ exo21 = new Verse(BibleBook.EXOD, 2, 1);
+ exo22 = new Verse(BibleBook.EXOD, 2, 2);
+ exo23 = new Verse(BibleBook.EXOD, 2, 3);
+ exo3b = new Verse(BibleBook.EXOD, 3, 11);
rev99 = VerseFactory.fromString("Rev 22:21");
}
@@ -279,12 +279,12 @@
public void testReadChaptersInPassage() throws Exception {
// for (int i=0; i<3; i++)
{
- assertEquals(1, gen1_135.chaptersInPassage(BibleBook.GENESIS));
- assertEquals(0, exo2a_3b.chaptersInPassage(BibleBook.GENESIS));
- assertEquals(0, gen1_135.chaptersInPassage(BibleBook.EXODUS));
- assertEquals(2, exo2a_3b.chaptersInPassage(BibleBook.EXODUS));
- assertEquals(0, gen1_135.chaptersInPassage(BibleBook.LEVITICUS));
- assertEquals(0, exo2a_3b.chaptersInPassage(BibleBook.LEVITICUS));
+ assertEquals(1, gen1_135.chaptersInPassage(BibleBook.GEN));
+ assertEquals(0, exo2a_3b.chaptersInPassage(BibleBook.GEN));
+ assertEquals(0, gen1_135.chaptersInPassage(BibleBook.EXOD));
+ assertEquals(2, exo2a_3b.chaptersInPassage(BibleBook.EXOD));
+ assertEquals(0, gen1_135.chaptersInPassage(BibleBook.LEV));
+ assertEquals(0, exo2a_3b.chaptersInPassage(BibleBook.LEV));
assertEquals(1, gen1_135.chaptersInPassage(null));
assertEquals(2, exo2a_3b.chaptersInPassage(null));
}
@@ -293,26 +293,26 @@
public void testReadVersesInPassage() throws Exception {
// for (int i=0; i<1; i++)
{
- assertEquals(3, gen1_135.versesInPassage(BibleBook.GENESIS, 1));
- assertEquals(0, exo2a_3b.versesInPassage(BibleBook.GENESIS, 1));
- assertEquals(0, gen1_135.versesInPassage(BibleBook.GENESIS, 2));
- assertEquals(0, exo2a_3b.versesInPassage(BibleBook.GENESIS, 2));
- assertEquals(0, gen1_135.versesInPassage(BibleBook.EXODUS, 1));
- assertEquals(0, exo2a_3b.versesInPassage(BibleBook.EXODUS, 1));
- assertEquals(0, gen1_135.versesInPassage(BibleBook.EXODUS, 2));
- assertEquals(10, exo2a_3b.versesInPassage(BibleBook.EXODUS, 2));
- assertEquals(0, gen1_135.versesInPassage(BibleBook.EXODUS, 3));
- assertEquals(11, exo2a_3b.versesInPassage(BibleBook.EXODUS, 3));
- assertEquals(0, gen1_135.versesInPassage(BibleBook.EXODUS, 4));
- assertEquals(0, exo2a_3b.versesInPassage(BibleBook.EXODUS, 4));
- assertEquals(0, gen1_135.versesInPassage(BibleBook.LEVITICUS, 1));
- assertEquals(0, exo2a_3b.versesInPassage(BibleBook.LEVITICUS, 1));
- assertEquals(3, gen1_135.versesInPassage(BibleBook.GENESIS, 0));
- assertEquals(0, exo2a_3b.versesInPassage(BibleBook.GENESIS, 0));
- assertEquals(0, gen1_135.versesInPassage(BibleBook.EXODUS, 0));
- assertEquals(21, exo2a_3b.versesInPassage(BibleBook.EXODUS, 0));
- assertEquals(0, gen1_135.versesInPassage(BibleBook.LEVITICUS, 0));
- assertEquals(0, exo2a_3b.versesInPassage(BibleBook.LEVITICUS, 0));
+ assertEquals(3, gen1_135.versesInPassage(BibleBook.GEN, 1));
+ assertEquals(0, exo2a_3b.versesInPassage(BibleBook.GEN, 1));
+ assertEquals(0, gen1_135.versesInPassage(BibleBook.GEN, 2));
+ assertEquals(0, exo2a_3b.versesInPassage(BibleBook.GEN, 2));
+ assertEquals(0, gen1_135.versesInPassage(BibleBook.EXOD, 1));
+ assertEquals(0, exo2a_3b.versesInPassage(BibleBook.EXOD, 1));
+ assertEquals(0, gen1_135.versesInPassage(BibleBook.EXOD, 2));
+ assertEquals(10, exo2a_3b.versesInPassage(BibleBook.EXOD, 2));
+ assertEquals(0, gen1_135.versesInPassage(BibleBook.EXOD, 3));
+ assertEquals(11, exo2a_3b.versesInPassage(BibleBook.EXOD, 3));
+ assertEquals(0, gen1_135.versesInPassage(BibleBook.EXOD, 4));
+ assertEquals(0, exo2a_3b.versesInPassage(BibleBook.EXOD, 4));
+ assertEquals(0, gen1_135.versesInPassage(BibleBook.LEV, 1));
+ assertEquals(0, exo2a_3b.versesInPassage(BibleBook.LEV, 1));
+ assertEquals(3, gen1_135.versesInPassage(BibleBook.GEN, 0));
+ assertEquals(0, exo2a_3b.versesInPassage(BibleBook.GEN, 0));
+ assertEquals(0, gen1_135.versesInPassage(BibleBook.EXOD, 0));
+ assertEquals(21, exo2a_3b.versesInPassage(BibleBook.EXOD, 0));
+ assertEquals(0, gen1_135.versesInPassage(BibleBook.LEV, 0));
+ assertEquals(0, exo2a_3b.versesInPassage(BibleBook.LEV, 0));
assertEquals(3, gen1_135.versesInPassage(null, 1));
assertEquals(0, exo2a_3b.versesInPassage(null, 1));
assertEquals(0, gen1_135.versesInPassage(null, 2));
@@ -623,37 +623,37 @@
}
public void testWriteChaptersInPassage() throws Exception {
- assertEquals(gen1_135.chaptersInPassage(BibleBook.GENESIS), 1);
- assertEquals(exo2a_3b.chaptersInPassage(BibleBook.GENESIS), 0);
- assertEquals(gen1_135.chaptersInPassage(BibleBook.EXODUS), 0);
- assertEquals(exo2a_3b.chaptersInPassage(BibleBook.EXODUS), 2);
- assertEquals(gen1_135.chaptersInPassage(BibleBook.LEVITICUS), 0);
- assertEquals(exo2a_3b.chaptersInPassage(BibleBook.LEVITICUS), 0);
+ assertEquals(gen1_135.chaptersInPassage(BibleBook.GEN), 1);
+ assertEquals(exo2a_3b.chaptersInPassage(BibleBook.GEN), 0);
+ assertEquals(gen1_135.chaptersInPassage(BibleBook.EXOD), 0);
+ assertEquals(exo2a_3b.chaptersInPassage(BibleBook.EXOD), 2);
+ assertEquals(gen1_135.chaptersInPassage(BibleBook.LEV), 0);
+ assertEquals(exo2a_3b.chaptersInPassage(BibleBook.LEV), 0);
assertEquals(gen1_135.chaptersInPassage(null), 1);
assertEquals(exo2a_3b.chaptersInPassage(null), 2);
}
public void testWriteVersesInPassage() throws Exception {
- assertEquals(gen1_135.versesInPassage(BibleBook.GENESIS, 1), 3);
- assertEquals(exo2a_3b.versesInPassage(BibleBook.GENESIS, 1), 0);
- assertEquals(gen1_135.versesInPassage(BibleBook.GENESIS, 2), 0);
- assertEquals(exo2a_3b.versesInPassage(BibleBook.GENESIS, 2), 0);
- assertEquals(gen1_135.versesInPassage(BibleBook.EXODUS, 1), 0);
- assertEquals(exo2a_3b.versesInPassage(BibleBook.EXODUS, 1), 0);
- assertEquals(gen1_135.versesInPassage(BibleBook.EXODUS, 2), 0);
- assertEquals(exo2a_3b.versesInPassage(BibleBook.EXODUS, 2), 10);
- assertEquals(gen1_135.versesInPassage(BibleBook.EXODUS, 3), 0);
- assertEquals(exo2a_3b.versesInPassage(BibleBook.EXODUS, 3), 11);
- assertEquals(gen1_135.versesInPassage(BibleBook.EXODUS, 4), 0);
- assertEquals(exo2a_3b.versesInPassage(BibleBook.EXODUS, 4), 0);
- assertEquals(gen1_135.versesInPassage(BibleBook.LEVITICUS, 1), 0);
- assertEquals(exo2a_3b.versesInPassage(BibleBook.LEVITICUS, 1), 0);
- assertEquals(gen1_135.versesInPassage(BibleBook.GENESIS, 0), 3);
- assertEquals(exo2a_3b.versesInPassage(BibleBook.GENESIS, 0), 0);
- assertEquals(gen1_135.versesInPassage(BibleBook.EXODUS, 0), 0);
- assertEquals(exo2a_3b.versesInPassage(BibleBook.EXODUS, 0), 21);
- assertEquals(gen1_135.versesInPassage(BibleBook.LEVITICUS, 0), 0);
- assertEquals(exo2a_3b.versesInPassage(BibleBook.LEVITICUS, 0), 0);
+ assertEquals(gen1_135.versesInPassage(BibleBook.GEN, 1), 3);
+ assertEquals(exo2a_3b.versesInPassage(BibleBook.GEN, 1), 0);
+ assertEquals(gen1_135.versesInPassage(BibleBook.GEN, 2), 0);
+ assertEquals(exo2a_3b.versesInPassage(BibleBook.GEN, 2), 0);
+ assertEquals(gen1_135.versesInPassage(BibleBook.EXOD, 1), 0);
+ assertEquals(exo2a_3b.versesInPassage(BibleBook.EXOD, 1), 0);
+ assertEquals(gen1_135.versesInPassage(BibleBook.EXOD, 2), 0);
+ assertEquals(exo2a_3b.versesInPassage(BibleBook.EXOD, 2), 10);
+ assertEquals(gen1_135.versesInPassage(BibleBook.EXOD, 3), 0);
+ assertEquals(exo2a_3b.versesInPassage(BibleBook.EXOD, 3), 11);
+ assertEquals(gen1_135.versesInPassage(BibleBook.EXOD, 4), 0);
+ assertEquals(exo2a_3b.versesInPassage(BibleBook.EXOD, 4), 0);
+ assertEquals(gen1_135.versesInPassage(BibleBook.LEV, 1), 0);
+ assertEquals(exo2a_3b.versesInPassage(BibleBook.LEV, 1), 0);
+ assertEquals(gen1_135.versesInPassage(BibleBook.GEN, 0), 3);
+ assertEquals(exo2a_3b.versesInPassage(BibleBook.GEN, 0), 0);
+ assertEquals(gen1_135.versesInPassage(BibleBook.EXOD, 0), 0);
+ assertEquals(exo2a_3b.versesInPassage(BibleBook.EXOD, 0), 21);
+ assertEquals(gen1_135.versesInPassage(BibleBook.LEV, 0), 0);
+ assertEquals(exo2a_3b.versesInPassage(BibleBook.LEV, 0), 0);
assertEquals(gen1_135.versesInPassage(null, 1), 3);
assertEquals(exo2a_3b.versesInPassage(null, 1), 0);
assertEquals(gen1_135.versesInPassage(null, 2), 0);
Modified: trunk/jsword/src/test/java/org/crosswire/jsword/passage/PassageTally2Test.java
===================================================================
--- trunk/jsword/src/test/java/org/crosswire/jsword/passage/PassageTally2Test.java 2011-04-05 01:15:52 UTC (rev 2145)
+++ trunk/jsword/src/test/java/org/crosswire/jsword/passage/PassageTally2Test.java 2011-04-07 20:04:54 UTC (rev 2146)
@@ -79,21 +79,21 @@
*/
@Override
protected void setUp() throws Exception {
- gen11_1 = RestrictionType.NONE.toRange(new Verse(BibleBook.GENESIS, 1, 1), 1);
- gen11_2 = RestrictionType.NONE.toRange(new Verse(BibleBook.GENESIS, 1, 1), 2);
- gen12_1 = RestrictionType.NONE.toRange(new Verse(BibleBook.GENESIS, 1, 2), 1);
- exo21_1 = RestrictionType.NONE.toRange(new Verse(BibleBook.EXODUS, 2, 1), 1);
- exo21_2 = RestrictionType.NONE.toRange(new Verse(BibleBook.EXODUS, 2, 1), 2);
- exo22_1 = RestrictionType.NONE.toRange(new Verse(BibleBook.EXODUS, 2, 2), 1);
+ gen11_1 = RestrictionType.NONE.toRange(new Verse(BibleBook.GEN, 1, 1), 1);
+ gen11_2 = RestrictionType.NONE.toRange(new Verse(BibleBook.GEN, 1, 1), 2);
+ gen12_1 = RestrictionType.NONE.toRange(new Verse(BibleBook.GEN, 1, 2), 1);
+ exo21_1 = RestrictionType.NONE.toRange(new Verse(BibleBook.EXOD, 2, 1), 1);
+ exo21_2 = RestrictionType.NONE.toRange(new Verse(BibleBook.EXOD, 2, 1), 2);
+ exo22_1 = RestrictionType.NONE.toRange(new Verse(BibleBook.EXOD, 2, 2), 1);
- gen11 = new Verse(BibleBook.GENESIS, 1, 1);
- gen12 = new Verse(BibleBook.GENESIS, 1, 2);
- gen13 = new Verse(BibleBook.GENESIS, 1, 3);
- gen15 = new Verse(BibleBook.GENESIS, 1, 5);
- exo21 = new Verse(BibleBook.EXODUS, 2, 1);
- exo22 = new Verse(BibleBook.EXODUS, 2, 2);
- exo23 = new Verse(BibleBook.EXODUS, 2, 3);
- exo3b = new Verse(BibleBook.EXODUS, 3, 11);
+ gen11 = new Verse(BibleBook.GEN, 1, 1);
+ gen12 = new Verse(BibleBook.GEN, 1, 2);
+ gen13 = new Verse(BibleBook.GEN, 1, 3);
+ gen15 = new Verse(BibleBook.GEN, 1, 5);
+ exo21 = new Verse(BibleBook.EXOD, 2, 1);
+ exo22 = new Verse(BibleBook.EXOD, 2, 2);
+ exo23 = new Verse(BibleBook.EXOD, 2, 3);
+ exo3b = new Verse(BibleBook.EXOD, 3, 11);
gen1_135 = (Passage) keyf.getKey("Gen 1:1, Gen 1:3, Gen 1:5");
gen123_1 = (Passage) keyf.getKey("Gen 1:1, Gen 2:1, Gen 3:1");
Modified: trunk/jsword/src/test/java/org/crosswire/jsword/passage/VerseRangeTest.java
===================================================================
--- trunk/jsword/src/test/java/org/crosswire/jsword/passage/VerseRangeTest.java 2011-04-05 01:15:52 UTC (rev 2145)
+++ trunk/jsword/src/test/java/org/crosswire/jsword/passage/VerseRangeTest.java 2011-04-07 20:04:54 UTC (rev 2146)
@@ -73,32 +73,32 @@
*/
@Override
protected void setUp() throws Exception {
- gen11_1 = RestrictionType.NONE.toRange(new Verse(BibleBook.GENESIS, 1, 1), 1);
- gen11_2 = RestrictionType.NONE.toRange(new Verse(BibleBook.GENESIS, 1, 1), 2);
- gen11_9 = RestrictionType.NONE.toRange(new Verse(BibleBook.GENESIS, 1, 1), 31);
- gen11_a = RestrictionType.NONE.toRange(new Verse(BibleBook.GENESIS, 1, 1), 32);
- gen12_1 = RestrictionType.NONE.toRange(new Verse(BibleBook.GENESIS, 1, 2), 1);
- gen_all = RestrictionType.NONE.toRange(new Verse(BibleBook.GENESIS, 1, 1), 1533);
- gen_ex1 = RestrictionType.NONE.toRange(new Verse(BibleBook.GENESIS, 1, 1), 1534);
- gen_exo = RestrictionType.NONE.toRange(new Verse(BibleBook.GENESIS, 1, 1), 2746);
- gen_rev = RestrictionType.NONE.toRange(new Verse(BibleBook.GENESIS, 1, 1), 31102);
- rev99_9 = RestrictionType.NONE.toRange(new Verse(BibleBook.REVELATION, 22, 1), 21);
- rev11_9 = RestrictionType.NONE.toRange(new Verse(BibleBook.REVELATION, 1, 1), 404);
- rev99_1 = RestrictionType.NONE.toRange(new Verse(BibleBook.REVELATION, 22, 21), 1);
+ gen11_1 = RestrictionType.NONE.toRange(new Verse(BibleBook.GEN, 1, 1), 1);
+ gen11_2 = RestrictionType.NONE.toRange(new Verse(BibleBook.GEN, 1, 1), 2);
+ gen11_9 = RestrictionType.NONE.toRange(new Verse(BibleBook.GEN, 1, 1), 31);
+ gen11_a = RestrictionType.NONE.toRange(new Verse(BibleBook.GEN, 1, 1), 32);
+ gen12_1 = RestrictionType.NONE.toRange(new Verse(BibleBook.GEN, 1, 2), 1);
+ gen_all = RestrictionType.NONE.toRange(new Verse(BibleBook.GEN, 1, 1), 1533);
+ gen_ex1 = RestrictionType.NONE.toRange(new Verse(BibleBook.GEN, 1, 1), 1534);
+ gen_exo = RestrictionType.NONE.toRange(new Verse(BibleBook.GEN, 1, 1), 2746);
+ gen_rev = RestrictionType.NONE.toRange(new Verse(BibleBook.GEN, 1, 1), 31102);
+ rev99_9 = RestrictionType.NONE.toRange(new Verse(BibleBook.REV, 22, 1), 21);
+ rev11_9 = RestrictionType.NONE.toRange(new Verse(BibleBook.REV, 1, 1), 404);
+ rev99_1 = RestrictionType.NONE.toRange(new Verse(BibleBook.REV, 22, 21), 1);
- gen11 = new Verse(BibleBook.GENESIS, 1, 1);
- gen12 = new Verse(BibleBook.GENESIS, 1, 2);
- gen19 = new Verse(BibleBook.GENESIS, 1, 31);
- gen21 = new Verse(BibleBook.GENESIS, 2, 1);
- gen22 = new Verse(BibleBook.GENESIS, 2, 2);
- gen99 = new Verse(BibleBook.GENESIS, 50, 26);
- exo11 = new Verse(BibleBook.EXODUS, 1, 1);
- rev11 = new Verse(BibleBook.REVELATION, 1, 1);
- rev12 = new Verse(BibleBook.REVELATION, 1, 2);
- rev21 = new Verse(BibleBook.REVELATION, 2, 1);
- rev22 = new Verse(BibleBook.REVELATION, 2, 2);
- rev99 = new Verse(BibleBook.REVELATION, 22, 21);
- rev91 = new Verse(BibleBook.REVELATION, 22, 1);
+ gen11 = new Verse(BibleBook.GEN, 1, 1);
+ gen12 = new Verse(BibleBook.GEN, 1, 2);
+ gen19 = new Verse(BibleBook.GEN, 1, 31);
+ gen21 = new Verse(BibleBook.GEN, 2, 1);
+ gen22 = new Verse(BibleBook.GEN, 2, 2);
+ gen99 = new Verse(BibleBook.GEN, 50, 26);
+ exo11 = new Verse(BibleBook.EXOD, 1, 1);
+ rev11 = new Verse(BibleBook.REV, 1, 1);
+ rev12 = new Verse(BibleBook.REV, 1, 2);
+ rev21 = new Verse(BibleBook.REV, 2, 1);
+ rev22 = new Verse(BibleBook.REV, 2, 2);
+ rev99 = new Verse(BibleBook.REV, 22, 21);
+ rev91 = new Verse(BibleBook.REV, 22, 1);
}
/*
@@ -226,7 +226,7 @@
assertEquals(gen_all, new VerseRange(gen99, gen11));
assertEquals(gen_ex1, new VerseRange(gen11, exo11));
assertEquals(gen_ex1, new VerseRange(exo11, gen11));
- assertEquals(gen11_1, new VerseRange(gen11, new Verse(BibleBook.GENESIS, 1, 1)));
+ assertEquals(gen11_1, new VerseRange(gen11, new Verse(BibleBook.GEN, 1, 1)));
}
public void testNewViaVerseIntIntBoolean() {
Modified: trunk/jsword/src/test/java/org/crosswire/jsword/passage/VerseTest.java
===================================================================
--- trunk/jsword/src/test/java/org/crosswire/jsword/passage/VerseTest.java 2011-04-05 01:15:52 UTC (rev 2145)
+++ trunk/jsword/src/test/java/org/crosswire/jsword/passage/VerseTest.java 2011-04-07 20:04:54 UTC (rev 2146)
@@ -64,22 +64,22 @@
@Override
protected void setUp() throws Exception {
BookName.setFullBookName(false);
- gen11 = new Verse(BibleBook.GENESIS, 1, 1);
- gen11a = new Verse(BibleBook.GENESIS, 1, 1);
- gen12 = new Verse(BibleBook.GENESIS, 1, 2);
- gen21 = new Verse(BibleBook.GENESIS, 2, 1);
- gen22 = new Verse(BibleBook.GENESIS, 2, 2);
- rev11 = new Verse(BibleBook.REVELATION, 1, 1);
- rev12 = new Verse(BibleBook.REVELATION, 1, 2);
- rev21 = new Verse(BibleBook.REVELATION, 2, 1);
- rev22 = new Verse(BibleBook.REVELATION, 2, 2);
- rev99 = new Verse(BibleBook.REVELATION, 22, 21);
+ gen11 = new Verse(BibleBook.GEN, 1, 1);
+ gen11a = new Verse(BibleBook.GEN, 1, 1);
+ gen12 = new Verse(BibleBook.GEN, 1, 2);
+ gen21 = new Verse(BibleBook.GEN, 2, 1);
+ gen22 = new Verse(BibleBook.GEN, 2, 2);
+ rev11 = new Verse(BibleBook.REV, 1, 1);
+ rev12 = new Verse(BibleBook.REV, 1, 2);
+ rev21 = new Verse(BibleBook.REV, 2, 1);
+ rev22 = new Verse(BibleBook.REV, 2, 2);
+ rev99 = new Verse(BibleBook.REV, 22, 21);
jude1 = new Verse(BibleBook.JUDE, 1, 1);
jude2 = new Verse(BibleBook.JUDE, 1, 2);
jude9 = new Verse(BibleBook.JUDE, 1, 25);
- ssa11 = new Verse(BibleBook.SAMUEL2, 1, 1);
- pro11 = new Verse(BibleBook.PROVERBS, 1, 1);
- ch111 = new Verse(BibleBook.CHRONICLES1, 1, 1);
+ ssa11 = new Verse(BibleBook.SAM2, 1, 1);
+ pro11 = new Verse(BibleBook.PROV, 1, 1);
+ ch111 = new Verse(BibleBook.CHR1, 1, 1);
}
/*
@@ -224,35 +224,35 @@
public void testNewViaIntIntIntBoolean() {
assertEquals(gen11, new Verse(null, 1, 1, true));
- assertEquals(gen11, new Verse(BibleBook.GENESIS, 0, 1, true));
- assertEquals(gen11, new Verse(BibleBook.GENESIS, 1, 0, true));
- assertEquals(rev99, new Verse(BibleBook.REVELATION, 22, 22, true));
- assertEquals(rev99, new Verse(BibleBook.REVELATION, 23, 21, true));
- assertEquals(rev99, new Verse(BibleBook.REVELATION, 23, 22, true));
- assertEquals(rev99, new Verse(BibleBook.GENESIS, 999999, 0, true));
- assertEquals(rev99, new Verse(BibleBook.GENESIS, 0, 999999, true));
+ assertEquals(gen11, new Verse(BibleBook.GEN, 0, 1, true));
+ assertEquals(gen11, new Verse(BibleBook.GEN, 1, 0, true));
+ assertEquals(rev99, new Verse(BibleBook.REV, 22, 22, true));
+ assertEquals(rev99, new Verse(BibleBook.REV, 23, 21, true));
+ assertEquals(rev99, new Verse(BibleBook.REV, 23, 22, true));
+ assertEquals(rev99, new Verse(BibleBook.GEN, 999999, 0, true));
+ assertEquals(rev99, new Verse(BibleBook.GEN, 0, 999999, true));
try {
new Verse(null, 1, 1);
fail();
} catch (NoSuchVerseException ex) {
}
try {
- new Verse(BibleBook.GENESIS, 0, 1);
+ new Verse(BibleBook.GEN, 0, 1);
fail();
} catch (NoSuchVerseException ex) {
}
try {
- new Verse(BibleBook.GENESIS, 1, 0);
+ new Verse(BibleBook.GEN, 1, 0);
fail();
} catch (NoSuchVerseException ex) {
}
try {
- new Verse(BibleBook.GENESIS, 1, 32);
+ new Verse(BibleBook.GEN, 1, 32);
fail();
} catch (NoSuchVerseException ex) {
}
try {
- new Verse(BibleBook.GENESIS, 51, 1);
+ new Verse(BibleBook.GEN, 51, 1);
fail();
} catch (NoSuchVerseException ex) {
}
@@ -262,22 +262,22 @@
} catch (IllegalArgumentException ex) {
}
try {
- new Verse(BibleBook.GENESIS, 0, 1, false);
+ new Verse(BibleBook.GEN, 0, 1, false);
fail();
} catch (IllegalArgumentException ex) {
}
try {
- new Verse(BibleBook.GENESIS, 1, 0, false);
+ new Verse(BibleBook.GEN, 1, 0, false);
fail();
} catch (IllegalArgumentException ex) {
}
try {
- new Verse(BibleBook.GENESIS, 1, 32, false);
+ new Verse(BibleBook.GEN, 1, 32, false);
fail();
} catch (IllegalArgumentException ex) {
}
try {
- new Verse(BibleBook.GENESIS, 51, 1, false);
+ new Verse(BibleBook.GEN, 51, 1, false);
fail();
} catch (IllegalArgumentException ex) {
}
@@ -347,15 +347,15 @@
}
public void testGetBook() {
- assertEquals(gen11.getBook(), BibleBook.GENESIS);
- assertEquals(gen12.getBook(), BibleBook.GENESIS);
- assertEquals(gen21.getBook(), BibleBook.GENESIS);
- assertEquals(gen22.getBook(), BibleBook.GENESIS);
- assertEquals(rev11.getBook(), BibleBook.REVELATION);
- assertEquals(rev12.getBook(), BibleBook.REVELATION);
- assertEquals(rev21.getBook(), BibleBook.REVELATION);
- assertEquals(rev22.getBook(), BibleBook.REVELATION);
- assertEquals(rev99.getBook(), BibleBook.REVELATION);
+ assertEquals(gen11.getBook(), BibleBook.GEN);
+ assertEquals(gen12.getBook(), BibleBook.GEN);
+ assertEquals(gen21.getBook(), BibleBook.GEN);
+ assertEquals(gen22.getBook(), BibleBook.GEN);
+ assertEquals(rev11.getBook(), BibleBook.REV);
+ assertEquals(rev12.getBook(), BibleBook.REV);
+ assertEquals(rev21.getBook(), BibleBook.REV);
+ assertEquals(rev22.getBook(), BibleBook.REV);
+ assertEquals(rev99.getBook(), BibleBook.REV);
}
public void testGetChapter() {
More information about the jsword-svn
mailing list