1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
package org.crosswire.jsword.versification; |
21 | |
|
22 | |
import java.util.HashMap; |
23 | |
import java.util.Locale; |
24 | |
import java.util.Map; |
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | 0 | public enum BibleBook { |
34 | |
|
35 | 0 | INTRO_BIBLE("Intro.Bible"), |
36 | |
|
37 | 0 | INTRO_OT("Intro.OT"), |
38 | |
|
39 | 0 | GEN("Gen"), |
40 | 0 | EXOD("Exod"), |
41 | 0 | LEV("Lev"), |
42 | 0 | NUM("Num"), |
43 | 0 | DEUT("Deut"), |
44 | 0 | JOSH("Josh"), |
45 | 0 | JUDG("Judg"), |
46 | 0 | RUTH("Ruth"), |
47 | 0 | SAM1("1Sam"), |
48 | 0 | SAM2("2Sam"), |
49 | 0 | KGS1("1Kgs"), |
50 | 0 | KGS2("2Kgs"), |
51 | 0 | CHR1("1Chr"), |
52 | 0 | CHR2("2Chr"), |
53 | 0 | EZRA("Ezra"), |
54 | 0 | NEH("Neh"), |
55 | 0 | ESTH("Esth"), |
56 | 0 | JOB("Job"), |
57 | 0 | PS("Ps"), |
58 | 0 | PROV("Prov"), |
59 | 0 | ECCL("Eccl"), |
60 | 0 | SONG("Song"), |
61 | 0 | ISA("Isa"), |
62 | 0 | JER("Jer"), |
63 | 0 | LAM("Lam"), |
64 | 0 | EZEK("Ezek"), |
65 | 0 | DAN("Dan"), |
66 | 0 | HOS("Hos"), |
67 | 0 | JOEL("Joel"), |
68 | 0 | AMOS("Amos"), |
69 | 0 | OBAD("Obad", true), |
70 | 0 | JONAH("Jonah"), |
71 | 0 | MIC("Mic"), |
72 | 0 | NAH("Nah"), |
73 | 0 | HAB("Hab"), |
74 | 0 | ZEPH("Zeph"), |
75 | 0 | HAG("Hag"), |
76 | 0 | ZECH("Zech"), |
77 | 0 | MAL("Mal"), |
78 | |
|
79 | 0 | INTRO_NT("Intro.NT"), |
80 | |
|
81 | 0 | MATT("Matt"), |
82 | 0 | MARK("Mark"), |
83 | 0 | LUKE("Luke"), |
84 | 0 | JOHN("John"), |
85 | 0 | ACTS("Acts"), |
86 | 0 | ROM("Rom"), |
87 | 0 | COR1("1Cor"), |
88 | 0 | COR2("2Cor"), |
89 | 0 | GAL("Gal"), |
90 | 0 | EPH("Eph"), |
91 | 0 | PHIL("Phil"), |
92 | 0 | COL("Col"), |
93 | 0 | THESS1("1Thess"), |
94 | 0 | THESS2("2Thess"), |
95 | 0 | TIM1("1Tim"), |
96 | 0 | TIM2("2Tim"), |
97 | 0 | TITUS("Titus"), |
98 | 0 | PHLM("Phlm", true), |
99 | 0 | HEB("Heb"), |
100 | 0 | JAS("Jas"), |
101 | 0 | PET1("1Pet"), |
102 | 0 | PET2("2Pet"), |
103 | 0 | JOHN1("1John"), |
104 | 0 | JOHN2("2John", true), |
105 | 0 | JOHN3("3John", true), |
106 | 0 | JUDE("Jude", true), |
107 | 0 | REV("Rev"), |
108 | |
|
109 | 0 | TOB("Tob"), |
110 | 0 | JDT("Jdt"), |
111 | 0 | ADD_ESTH("AddEsth"), |
112 | 0 | WIS("Wis"), |
113 | 0 | SIR("Sir"), |
114 | 0 | BAR("Bar"), |
115 | 0 | EP_JER("EpJer", true), |
116 | 0 | PR_AZAR("PrAzar"), |
117 | 0 | SUS("Sus"), |
118 | 0 | BEL("Bel"), |
119 | 0 | MACC1("1Macc"), |
120 | 0 | MACC2("2Macc"), |
121 | 0 | MACC3("3Macc"), |
122 | 0 | MACC4("4Macc"), |
123 | 0 | PR_MAN("PrMan", true), |
124 | 0 | ESD1("1Esd"), |
125 | 0 | ESD2("2Esd"), |
126 | 0 | PSS151("Ps151"), |
127 | |
|
128 | 0 | ODES("Odes"), |
129 | 0 | PSALM_SOL("PssSol"), |
130 | |
|
131 | 0 | EP_LAO("EpLao"), |
132 | 0 | ESD3("3Esd"), |
133 | 0 | ESD4("4Esd"), |
134 | 0 | ESD5("5Esd"), |
135 | |
|
136 | 0 | EN1("1En"), |
137 | 0 | JUBS("Jub"), |
138 | 0 | BAR4("4Bar"), |
139 | 0 | ASCEN_ISA("AscenIsa"), |
140 | 0 | PS_JOS("PsJos"), |
141 | |
|
142 | 0 | APOSTOLIC("AposCon"), |
143 | 0 | CLEM1("1Clem"), |
144 | 0 | CLEM2("2Clem"), |
145 | |
|
146 | 0 | COR3("3Cor"), |
147 | 0 | EP_COR_PAUL("EpCorPaul"), |
148 | 0 | JOS_ASEN("JosAsen"), |
149 | 0 | T12PATR("T12Patr"), |
150 | 0 | T12PATR_TASH("T12Patr.TAsh"), |
151 | 0 | T12PATR_TBENJ("T12Patr.TBenj"), |
152 | 0 | T12PATR_TDAN("T12Patr.TDan"), |
153 | 0 | T12PATR_GAD("T12Patr.TGad"), |
154 | 0 | T12PATR_TISS("T12Patr.TIss"), |
155 | 0 | T12PATR_TJOS("T12Patr.TJos"), |
156 | 0 | T12PATR_TJUD("T12Patr.TJud"), |
157 | 0 | T12PATR_TLEVI("T12Patr.TLevi"), |
158 | 0 | T12PATR_TNAPH("T12Patr.TNaph"), |
159 | 0 | T12PATR_TREU("T12Patr.TReu"), |
160 | 0 | T12PATR_TSIM("T12Patr.TSim"), |
161 | 0 | T12PATR_TZeb("T12Patr.TZeb"), |
162 | |
|
163 | 0 | BAR2("2Bar"), |
164 | 0 | EP_BAR("EpBar"), |
165 | |
|
166 | 0 | BARN("Barn"), |
167 | 0 | HERM("Herm"), |
168 | 0 | HERM_MAND("Herm.Mand"), |
169 | 0 | HERM_SIM("Herm.Sim"), |
170 | 0 | HERM_VIS("Herm.Vis"), |
171 | |
|
172 | 0 | ADD_DAN("AddDan"), |
173 | 0 | ADD_PS("AddPs"), |
174 | 0 | ESTH_GR("EsthGr"); |
175 | |
|
176 | |
BibleBook(String osis, boolean shortBook) { |
177 | 0 | this(osis); |
178 | 0 | this.isShortBook = shortBook; |
179 | 0 | } |
180 | |
|
181 | 0 | BibleBook(String osis) { |
182 | 0 | this.osis = osis; |
183 | 0 | } |
184 | |
|
185 | |
|
186 | |
|
187 | |
|
188 | |
|
189 | |
|
190 | |
public String getOSIS() { |
191 | 0 | return osis; |
192 | |
} |
193 | |
|
194 | |
|
195 | |
|
196 | |
|
197 | |
|
198 | |
|
199 | |
@Override |
200 | |
public String toString() { |
201 | 0 | return osis; |
202 | |
} |
203 | |
|
204 | |
|
205 | |
|
206 | |
|
207 | |
|
208 | |
|
209 | |
|
210 | |
public static BibleBook fromOSIS(String osis) { |
211 | 0 | String match = BookName.normalize(osis, Locale.ENGLISH); |
212 | 0 | return osisMap.get(match); |
213 | |
} |
214 | |
|
215 | |
|
216 | |
|
217 | |
|
218 | |
|
219 | |
public static BibleBook fromExactOSIS(String osis) { |
220 | 0 | return exactMatches.get(osis); |
221 | |
} |
222 | |
|
223 | |
|
224 | |
|
225 | |
|
226 | |
public boolean isShortBook() { |
227 | 0 | return isShortBook; |
228 | |
} |
229 | |
|
230 | |
|
231 | |
|
232 | |
|
233 | |
private String osis; |
234 | |
|
235 | |
|
236 | |
|
237 | |
|
238 | |
private boolean isShortBook; |
239 | |
|
240 | |
|
241 | 0 | private static Map<String, BibleBook> osisMap = new HashMap<String, BibleBook>(128); |
242 | 0 | private static Map<String, BibleBook> exactMatches = new HashMap<String, BibleBook>(128); |
243 | |
|
244 | |
static { |
245 | 0 | for (BibleBook book : BibleBook.values()) { |
246 | 0 | osisMap.put(BookName.normalize(book.getOSIS(), Locale.ENGLISH), book); |
247 | 0 | exactMatches.put(book.getOSIS(), book); |
248 | |
} |
249 | 0 | } |
250 | |
|
251 | |
} |