| SectionNames.java |
1 /**
2 * Distribution License:
3 * JSword is free software; you can redistribute it and/or modify it under
4 * the terms of the GNU Lesser General Public License, version 2.1 or later
5 * as published by the Free Software Foundation. This program is distributed
6 * in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
7 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
8 * See the GNU Lesser General Public License for more details.
9 *
10 * The License is available on the internet at:
11 * http://www.gnu.org/copyleft/lgpl.html
12 * or by writing to:
13 * Free Software Foundation, Inc.
14 * 59 Temple Place - Suite 330
15 * Boston, MA 02111-1307, USA
16 *
17 * Copyright: 2005-2011
18 * The copyright to this program is held by it's authors.
19 *
20 */
21 package org.crosswire.jsword.versification;
22
23 import org.crosswire.jsword.JSMsg;
24
25 /**
26 * SectionNames deals with traditional sections of the Bible.
27 *
28 * @see gnu.lgpl.License for license details.<br>
29 * The copyright to this program is held by it's authors.
30 * @author Joe Walker [joe at eireneh dot com]
31 * @author DM Smith
32 * @deprecated Use org.crosswire.jsword.versification.DivisonName instead.
33 */
34 @Deprecated
35 public enum SectionNames {
36 /** BIBLE consists of the entire/whole Bible (Gen - Rev) **/
37 BIBLE {
38 @Override
39 public boolean contains(BibleBook book) {
40 int bookNum = book.ordinal();
41 return bookNum >= BibleBook.GEN.ordinal() && bookNum <= BibleBook.REV.ordinal();
42 }
43
44 @Override
45 public int getSize() {
46 return 66;
47 }
48
49 @Override
50 public String getName() {
51 // TRANSLATOR: The entire/whole Bible (Gen - Rev)
52 return JSMsg.gettext("The Whole Bible");
53 }
54
55 @Override
56 public String getRange() {
57 return "Gen-Rev";
58 }
59
60 },
61 /** OLD_TESTAMENT consists of the old testament (Gen - Rev) **/
62 OLD_TESTAMENT {
63 @Override
64 public boolean contains(BibleBook book) {
65 int bookNum = book.ordinal();
66 return bookNum >= BibleBook.GEN.ordinal() && bookNum <= BibleBook.MAL.ordinal();
67 }
68
69 @Override
70 public int getSize() {
71 return 39;
72 }
73
74 @Override
75 public String getName() {
76 // TRANSLATOR: The old testament (Gen - Mal)
77 return JSMsg.gettext("Old Testament");
78 }
79
80 @Override
81 public String getRange() {
82 return "Gen-Mal";
83 }
84 },
85 /** PENTATEUCH consists of the 5 books of Moses (Gen - Deu) **/
86 PENTATEUCH {
87 @Override
88 public boolean contains(BibleBook book) {
89 int bookNum = book.ordinal();
90 return bookNum >= BibleBook.GEN.ordinal() && bookNum <= BibleBook.DEUT.ordinal();
91 }
92
93 @Override
94 public int getSize() {
95 return 5;
96 }
97
98 @Override
99 public String getName() {
100 // TRANSLATOR: Pentateuch is the first 5 books of the Bible.
101 return JSMsg.gettext("Pentateuch");
102 }
103
104 @Override
105 public String getRange() {
106 return "Gen-Deu";
107 }
108 },
109 /** HISTORY consists of the history in the Old Testament of Israel */
110 HISTORY {
111 @Override
112 public boolean contains(BibleBook book) {
113 int bookNum = book.ordinal();
114 return bookNum >= BibleBook.JOSH.ordinal() && bookNum <= BibleBook.ESTH.ordinal();
115 }
116
117 @Override
118 public int getSize() {
119 return 12;
120 }
121
122 @Override
123 public String getName() {
124 // TRANSLATOR: History are the books of the Old Testament that give the history of Israel
125 return JSMsg.gettext("History");
126 }
127
128 @Override
129 public String getRange() {
130 return "Jos-Est";
131 }
132 },
133 /** POETRY consists of the poetic works (Job-Song) */
134 POETRY {
135 @Override
136 public boolean contains(BibleBook book) {
137 int bookNum = book.ordinal();
138 return bookNum >= BibleBook.JOB.ordinal() && bookNum <= BibleBook.SONG.ordinal();
139 }
140
141 @Override
142 public int getSize() {
143 return 5;
144 }
145
146 @Override
147 public String getName() {
148 // TRANSLATOR: The poetic works of the Bible consisting of:
149 // Job, Psalms, Proverbs, Ecclesiastes, and Song of Solomon
150 return JSMsg.gettext("Poetry");
151 }
152
153 @Override
154 public String getRange() {
155 return "Job-Song";
156 }
157 },
158 /** PROPHECY consists of the Deu 28, major prophets, minor prophets, Revelation (Isa-Mal, Rev) */
159 PROPHECY {
160 @Override
161 public boolean contains(BibleBook book) {
162 int bookNum = book.ordinal();
163 return bookNum == BibleBook.REV.ordinal() || bookNum >= BibleBook.ISA.ordinal() && bookNum <= BibleBook.MAL.ordinal();
164 }
165
166 @Override
167 public int getSize() {
168 return 18;
169 }
170
171 @Override
172 public String getName() {
173 // TRANSLATOR: A division of the Bible containing prophecy:
174 // Deuteronomy 28
175 // Major Prophets: Isaiah, Jeremiah, Lamentations, Ezekiel, Daniel
176 // Minor Prophets: Hosea, Joel, Amos, Obadiah, Jonah, Micah, Nahum,
177 // Habakkuk, Zephaniah, Haggai, Zechariah, Malachi
178 // Revelation
179 return JSMsg.gettext("All Prophecy");
180 }
181
182 @Override
183 public String getRange() {
184 return "Deu 28,Isa-Mal,Rev";
185 }
186 },
187 /** MAJOR_PROPHETS consists of the major prophets (Isa-Dan) */
188 MAJOR_PROPHETS {
189 @Override
190 public boolean contains(BibleBook book) {
191 int bookNum = book.ordinal();
192 return bookNum >= BibleBook.ISA.ordinal() && bookNum <= BibleBook.DAN.ordinal();
193 }
194
195 @Override
196 public int getSize() {
197 return 5;
198 }
199
200 @Override
201 public String getName() {
202 // TRANSLATOR: A division of the Bible containing the major prophets (Isa-Dan)
203 // Isaiah, Jeremiah, Lamentations, Ezekiel, Daniel
204 return JSMsg.gettext("Major Prophets");
205 }
206
207 @Override
208 public String getRange() {
209 return "Isa-Dan";
210 }
211 },
212 /** MINOR_PROPHETS consists of the minor prophets (Hos-Mal) */
213 MINOR_PROPHETS {
214 @Override
215 public boolean contains(BibleBook book) {
216 int bookNum = book.ordinal();
217 return bookNum >= BibleBook.HOS.ordinal() && bookNum <= BibleBook.MAL.ordinal();
218 }
219
220 @Override
221 public int getSize() {
222 return 12;
223 }
224
225 @Override
226 public String getName() {
227 // TRANSLATOR: A division of the Bible containing the minor prophets (Hos-Mal)
228 // Hosea, Joel, Amos, Obadiah, Jonah, Micah, Nahum,
229 // Habakkuk, Zephaniah, Haggai, Zechariah, Malachi
230 return JSMsg.gettext("Minor Prophets");
231 }
232
233 @Override
234 public String getRange() {
235 return "Hos-Mal";
236 }
237 },
238 /** NEW_TESTAMENT consists of the new testament (Mat - Rev) **/
239 NEW_TESTAMENT {
240 @Override
241 public boolean contains(BibleBook book) {
242 int bookNum = book.ordinal();
243 return bookNum >= BibleBook.GEN.ordinal() && bookNum <= BibleBook.REV.ordinal();
244 }
245
246 @Override
247 public int getSize() {
248 return 27;
249 }
250
251 @Override
252 public String getName() {
253 // TRANSLATOR: The New Testament (Mat - Rev)
254 return JSMsg.gettext("New Testament");
255 }
256
257 @Override
258 public String getRange() {
259 return "Mat-Rev";
260 }
261 },
262 /** GOSPELS_AND_ACTS consists of the 4 Gospels and Acts (Mat-Acts) */
263 GOSPELS_AND_ACTS {
264 @Override
265 public boolean contains(BibleBook book) {
266 int bookNum = book.ordinal();
267 return bookNum >= BibleBook.MATT.ordinal() && bookNum <= BibleBook.ACTS.ordinal();
268 }
269
270 @Override
271 public int getSize() {
272 return 5;
273 }
274
275 @Override
276 public String getName() {
277 // TRANSLATOR: A division of the Bible containing the 4 Gospels and Acts (Mat-Acts)
278 // Matthew, Mark, Luke, John, Acts
279 return JSMsg.gettext("Gospels and Acts");
280 }
281
282 @Override
283 public String getRange() {
284 return "Mat-Acts";
285 }
286 },
287 /** LETTERS consists of the letters/epistles (Rom-Jud) */
288 LETTERS {
289 @Override
290 public boolean contains(BibleBook book) {
291 int bookNum = book.ordinal();
292 return bookNum >= BibleBook.ROM.ordinal() && bookNum <= BibleBook.JUDE.ordinal();
293 }
294
295 @Override
296 public int getSize() {
297 return 21;
298 }
299
300 @Override
301 public String getName() {
302 // TRANSLATOR: A division of the Bible containing the letters/epistles (Rom-Jud)
303 // Pauline: Romans, 1&2 Corinthians, Galatians, Ephesians, Philippians, Colossians,
304 // 1&2 Thessalonians, 1&2 Timothy, Titus, Philemon, Hebrews
305 // General: James, 1-2 Peter, 1-3 John, Jude
306 return JSMsg.gettext("Letters");
307 }
308
309 @Override
310 public String getRange() {
311 return "Rom-Jud";
312 }
313 },
314 /** LETTERS consists of the Pauline letters/epistles (Rom-Heb) */
315 PAULINE_LETTERS {
316 @Override
317 public boolean contains(BibleBook book) {
318 int bookNum = book.ordinal();
319 return bookNum >= BibleBook.ROM.ordinal() && bookNum <= BibleBook.JUDE.ordinal();
320 }
321
322 @Override
323 public int getSize() {
324 return 14;
325 }
326
327 @Override
328 public String getName() {
329 // TRANSLATOR: A division of the Bible containing the Pauline letters/epistles (Rom-Heb)
330 // Romans, 1-2 Corinthians, Galatians, Ephesians, Philippians, Colossians,
331 // 1-2 Thessalonians, 1-2 Timothy, Titus, Philemon, Hebrews
332 return JSMsg.gettext("Letters to People");
333 }
334
335 @Override
336 public String getRange() {
337 return "Rom-Heb";
338 }
339 },
340 /** LETTERS consists of the general letters/epistles (Jas-Jud) */
341 GENERAL_LETTERS {
342 @Override
343 public boolean contains(BibleBook book) {
344 int bookNum = book.ordinal();
345 return bookNum >= BibleBook.ROM.ordinal() && bookNum <= BibleBook.JUDE.ordinal();
346 }
347
348 @Override
349 public int getSize() {
350 return 7;
351 }
352
353 @Override
354 public String getName() {
355 // TRANSLATOR: A division of the Bible containing the general letters/epistles (Jas-Jud)
356 // James, 1-2 Peter, 1-3 John, Jude
357 return JSMsg.gettext("Letters from People");
358 }
359
360 @Override
361 public String getRange() {
362 return "Jas-Jud";
363 }
364 },
365 /** REVELATION consists of the book of Revelation (Rev) */
366 REVELATION {
367 @Override
368 public boolean contains(BibleBook book) {
369 return book == BibleBook.REV;
370 }
371
372 @Override
373 public int getSize() {
374 return 1;
375 }
376
377 @Override
378 public String getName() {
379 // TRANSLATOR: A division of the Bible containing the book of Revelation (Rev)
380 return JSMsg.gettext("Revelation");
381 }
382
383 @Override
384 public String getRange() {
385 return "Rev";
386 }
387 };
388
389 /**
390 * Determine whether the book is contained within the section.
391 * @param book
392 * @return true if the book is contained within the division
393 */
394 public abstract boolean contains(BibleBook book);
395
396 /**
397 * Get the number of whole books in the section.
398 * @return the number of whole books in the section
399 */
400 public abstract int getSize();
401
402 /**
403 * Obtain a localized string description of the section.
404 * @return the localized name.
405 */
406 public abstract String getName();
407
408 /**
409 * Obtain a string representation of the scope of the section.
410 * @return the localized name.
411 */
412 public abstract String getRange();
413
414 @Override
415 public String toString() {
416 return getName();
417 }
418
419 /**
420 * Determine the section to which this book belongs.
421 *
422 * @param book The book to test
423 * @return the section
424 */
425 public static SectionNames getSection(BibleBook book) {
426 // Ordered by section size for speed
427 if (LETTERS.contains(book)) {
428 return LETTERS;
429 }
430
431 if (HISTORY.contains(book)) {
432 return HISTORY;
433 }
434
435 if (MINOR_PROPHETS.contains(book)) {
436 return MINOR_PROPHETS;
437 }
438
439 if (GOSPELS_AND_ACTS.contains(book)) {
440 return GOSPELS_AND_ACTS;
441 }
442
443 if (PENTATEUCH.contains(book)) {
444 return PENTATEUCH;
445 }
446
447 if (POETRY.contains(book)) {
448 return POETRY;
449 }
450
451 if (MAJOR_PROPHETS.contains(book)) {
452 return MAJOR_PROPHETS;
453 }
454
455 // AAV11N(DMS): might not be true
456 return REVELATION;
457 }
458
459 /**
460 * Handy section finder. There is a bit of moderately bad programming here
461 * because org.crosswire.biblemapper.sw*ng.GroupVerseColor uses these
462 * numbers as an index into an array, so we shouldn't change these numbers
463 * without fixing that, however I don't imagine that this section could ever
464 * change without breaking GroupVerseColor anyway so I don't see it as a big
465 * problem.
466 public static final byte PENTATEUCH = 1;
467 public static final byte HISTORY = 2;
468 public static final byte POETRY = 3;
469 public static final byte MAJOR_PROPHETS = 4;
470 public static final byte MINOR_PROPHETS = 5;
471 public static final byte GOSPELS_AND_ACTS = 6;
472 public static final byte LETTERS = 7;
473 public static final byte REVELATION = 8;
474 */
475
476 /** Constant for the number of sections in the Bible
477 private static final int SECTIONS_IN_BIBLE = 8;
478 */
479 }
480