-
Notifications
You must be signed in to change notification settings - Fork 48
/
Daf.java
291 lines (267 loc) · 15.3 KB
/
Daf.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
/*
* Zmanim Java API
* Copyright (C) 2011 - 2023 Eliyahu Hershfeld
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General
* Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library 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.
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA,
* or connect to: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
*/
package com.kosherjava.zmanim.hebrewcalendar;
/**
* An Object representing a <em>daf</em> (page) in the <a href="https://en.wikipedia.org/wiki/Daf_Yomi">Daf Yomi</a> cycle.
*
* @author © Eliyahu Hershfeld 2011 - 2023
*/
public class Daf {
/**
* {@link #getMasechtaNumber()} and {@link #setMasechtaNumber(int)}.
*/
private int masechtaNumber;
/**
* See {@link #getDaf()} and {@link #setDaf(int)}.
*/
private int daf;
/**
* See {@link #getMasechtaTransliterated()} and {@link #setMasechtaTransliterated(String[])}.
*/
private static String[] masechtosBavliTransliterated = { "Berachos", "Shabbos", "Eruvin", "Pesachim", "Shekalim",
"Yoma", "Sukkah", "Beitzah", "Rosh Hashana", "Taanis", "Megillah", "Moed Katan", "Chagigah", "Yevamos",
"Kesubos", "Nedarim", "Nazir", "Sotah", "Gitin", "Kiddushin", "Bava Kamma", "Bava Metzia", "Bava Basra",
"Sanhedrin", "Makkos", "Shevuos", "Avodah Zarah", "Horiyos", "Zevachim", "Menachos", "Chullin", "Bechoros",
"Arachin", "Temurah", "Kerisos", "Meilah", "Kinnim", "Tamid", "Midos", "Niddah" };
/**
* See {@link #getMasechta()}.
*/
private static final String[] masechtosBavli = { "\u05D1\u05E8\u05DB\u05D5\u05EA", "\u05E9\u05D1\u05EA",
"\u05E2\u05D9\u05E8\u05D5\u05D1\u05D9\u05DF", "\u05E4\u05E1\u05D7\u05D9\u05DD",
"\u05E9\u05E7\u05DC\u05D9\u05DD", "\u05D9\u05D5\u05DE\u05D0", "\u05E1\u05D5\u05DB\u05D4",
"\u05D1\u05D9\u05E6\u05D4", "\u05E8\u05D0\u05E9 \u05D4\u05E9\u05E0\u05D4",
"\u05EA\u05E2\u05E0\u05D9\u05EA", "\u05DE\u05D2\u05D9\u05DC\u05D4",
"\u05DE\u05D5\u05E2\u05D3 \u05E7\u05D8\u05DF", "\u05D7\u05D2\u05D9\u05D2\u05D4",
"\u05D9\u05D1\u05DE\u05D5\u05EA", "\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA", "\u05E0\u05D3\u05E8\u05D9\u05DD",
"\u05E0\u05D6\u05D9\u05E8", "\u05E1\u05D5\u05D8\u05D4", "\u05D2\u05D9\u05D8\u05D9\u05DF",
"\u05E7\u05D9\u05D3\u05D5\u05E9\u05D9\u05DF", "\u05D1\u05D1\u05D0 \u05E7\u05DE\u05D0",
"\u05D1\u05D1\u05D0 \u05DE\u05E6\u05D9\u05E2\u05D0", "\u05D1\u05D1\u05D0 \u05D1\u05EA\u05E8\u05D0",
"\u05E1\u05E0\u05D4\u05D3\u05E8\u05D9\u05DF", "\u05DE\u05DB\u05D5\u05EA",
"\u05E9\u05D1\u05D5\u05E2\u05D5\u05EA", "\u05E2\u05D1\u05D5\u05D3\u05D4 \u05D6\u05E8\u05D4",
"\u05D4\u05D5\u05E8\u05D9\u05D5\u05EA", "\u05D6\u05D1\u05D7\u05D9\u05DD", "\u05DE\u05E0\u05D7\u05D5\u05EA",
"\u05D7\u05D5\u05DC\u05D9\u05DF", "\u05D1\u05DB\u05D5\u05E8\u05D5\u05EA", "\u05E2\u05E8\u05DB\u05D9\u05DF",
"\u05EA\u05DE\u05D5\u05E8\u05D4", "\u05DB\u05E8\u05D9\u05EA\u05D5\u05EA", "\u05DE\u05E2\u05D9\u05DC\u05D4",
"\u05E7\u05D9\u05E0\u05D9\u05DD", "\u05EA\u05DE\u05D9\u05D3", "\u05DE\u05D9\u05D3\u05D5\u05EA",
"\u05E0\u05D3\u05D4" };
/**
* See {@link #getYerushalmiMasechtaTransliterated()}.
*/
private static String[] masechtosYerushalmiTransliterated = { "Berachos", "Pe'ah", "Demai", "Kilayim", "Shevi'is",
"Terumos", "Ma'asros", "Ma'aser Sheni", "Chalah", "Orlah", "Bikurim", "Shabbos", "Eruvin", "Pesachim",
"Beitzah", "Rosh Hashanah", "Yoma", "Sukah", "Ta'anis", "Shekalim", "Megilah", "Chagigah", "Moed Katan",
"Yevamos", "Kesuvos", "Sotah", "Nedarim", "Nazir", "Gitin", "Kidushin", "Bava Kama", "Bava Metzia",
"Bava Basra", "Shevuos", "Makos", "Sanhedrin", "Avodah Zarah", "Horayos", "Nidah", "No Daf Today" };
/**
* See {@link #getYerushalmiMasechta()}.
*/
private static final String[] masechtosYerushalmi = { "\u05d1\u05e8\u05db\u05d5\u05ea","\u05e4\u05d9\u05d0\u05d4",
"\u05d3\u05de\u05d0\u05d9","\u05db\u05dc\u05d0\u05d9\u05dd","\u05e9\u05d1\u05d9\u05e2\u05d9\u05ea",
"\u05ea\u05e8\u05d5\u05de\u05d5\u05ea","\u05de\u05e2\u05e9\u05e8\u05d5\u05ea","\u05de\u05e2\u05e9\u05e8 \u05e9\u05e0\u05d9",
"\u05d7\u05dc\u05d4","\u05e2\u05d5\u05e8\u05dc\u05d4","\u05d1\u05d9\u05db\u05d5\u05e8\u05d9\u05dd",
"\u05e9\u05d1\u05ea","\u05e2\u05d9\u05e8\u05d5\u05d1\u05d9\u05df","\u05e4\u05e1\u05d7\u05d9\u05dd",
"\u05d1\u05d9\u05e6\u05d4","\u05e8\u05d0\u05e9 \u05d4\u05e9\u05e0\u05d4","\u05d9\u05d5\u05de\u05d0",
"\u05e1\u05d5\u05db\u05d4","\u05ea\u05e2\u05e0\u05d9\u05ea","\u05e9\u05e7\u05dc\u05d9\u05dd","\u05de\u05d2\u05d9\u05dc\u05d4",
"\u05d7\u05d2\u05d9\u05d2\u05d4","\u05de\u05d5\u05e2\u05d3 \u05e7\u05d8\u05df","\u05d9\u05d1\u05de\u05d5\u05ea",
"\u05db\u05ea\u05d5\u05d1\u05d5\u05ea","\u05e1\u05d5\u05d8\u05d4","\u05e0\u05d3\u05e8\u05d9\u05dd","\u05e0\u05d6\u05d9\u05e8",
"\u05d2\u05d9\u05d8\u05d9\u05df","\u05e7\u05d9\u05d3\u05d5\u05e9\u05d9\u05df","\u05d1\u05d1\u05d0 \u05e7\u05de\u05d0",
"\u05d1\u05d1\u05d0 \u05de\u05e6\u05d9\u05e2\u05d0","\u05d1\u05d1\u05d0 \u05d1\u05ea\u05e8\u05d0",
"\u05e9\u05d1\u05d5\u05e2\u05d5\u05ea","\u05de\u05db\u05d5\u05ea","\u05e1\u05e0\u05d4\u05d3\u05e8\u05d9\u05df",
"\u05e2\u05d1\u05d5\u05d3\u05d4 \u05d6\u05e8\u05d4","\u05d4\u05d5\u05e8\u05d9\u05d5\u05ea","\u05e0\u05d9\u05d3\u05d4",
"\u05d0\u05d9\u05df \u05d3\u05e3 \u05d4\u05d9\u05d5\u05dd" };
/**
* Gets the <em>masechta</em> number of the currently set <em>Daf</em>. The sequence is: Berachos, Shabbos, Eruvin,
* Pesachim, Shekalim, Yoma, Sukkah, Beitzah, Rosh Hashana, Taanis, Megillah, Moed Katan, Chagigah, Yevamos, Kesubos,
* Nedarim, Nazir, Sotah, Gitin, Kiddushin, Bava Kamma, Bava Metzia, Bava Basra, Sanhedrin, Makkos, Shevuos, Avodah
* Zarah, Horiyos, Zevachim, Menachos, Chullin, Bechoros, Arachin, Temurah, Kerisos, Meilah, Kinnim, Tamid, Midos and
* Niddah.
* @return the masechtaNumber.
* @see #setMasechtaNumber(int)
*/
public int getMasechtaNumber() {
return masechtaNumber;
}
/**
* Set the <em>masechta</em> number in the order of the Daf Yomi. The sequence is: Berachos, Shabbos, Eruvin, Pesachim,
* Shekalim, Yoma, Sukkah, Beitzah, Rosh Hashana, Taanis, Megillah, Moed Katan, Chagigah, Yevamos, Kesubos, Nedarim,
* Nazir, Sotah, Gitin, Kiddushin, Bava Kamma, Bava Metzia, Bava Basra, Sanhedrin, Makkos, Shevuos, Avodah Zarah,
* Horiyos, Zevachim, Menachos, Chullin, Bechoros, Arachin, Temurah, Kerisos, Meilah, Kinnim, Tamid, Midos and
* Niddah.
*
* @param masechtaNumber
* the <em>masechta</em> number in the order of the Daf Yomi to set.
*/
public void setMasechtaNumber(int masechtaNumber) {
this.masechtaNumber = masechtaNumber;
}
/**
* Constructor that creates a Daf setting the {@link #setMasechtaNumber(int) <em>masechta</em> number} and
* {@link #setDaf(int) <em>daf</em> number}.
*
* @param masechtaNumber the <em>masechta</em> number in the order of the Daf Yomi to set as the current <em>masechta</em>.
* @param daf the <em>daf</em> (page) number to set.
*/
public Daf(int masechtaNumber, int daf) {
this.masechtaNumber = masechtaNumber;
this.daf = daf;
}
/**
* Returns the <em>daf</em> (page) number of the Daf Yomi.
* @return the <em>daf</em> (page) number of the Daf Yomi.
*/
public int getDaf() {
return daf;
}
/**
* Sets the <em>daf</em> (page) number of the Daf Yomi.
* @param daf the <em>daf</em> (page) number.
*/
public void setDaf(int daf) {
this.daf = daf;
}
/**
* Returns the transliterated name of the <em>masechta</em> (tractate) of the Daf Yomi. The list of <em>mashechtos</em>
* is: Berachos, Shabbos, Eruvin, Pesachim, Shekalim, Yoma, Sukkah, Beitzah, Rosh Hashana, Taanis, Megillah, Moed Katan,
* Chagigah, Yevamos, Kesubos, Nedarim, Nazir, Sotah, Gitin, Kiddushin, Bava Kamma, Bava Metzia, Bava Basra, Sanhedrin,
* Makkos, Shevuos, Avodah Zarah, Horiyos, Zevachim, Menachos, Chullin, Bechoros, Arachin, Temurah, Kerisos, Meilah,
* Kinnim, Tamid, Midos and Niddah.
*
* @return the transliterated name of the <em>masechta</em> (tractate) of the Daf Yomi such as Berachos.
* @see #setMasechtaTransliterated(String[])
*/
public String getMasechtaTransliterated() {
return masechtosBavliTransliterated[masechtaNumber];
}
/**
* Setter method to allow overriding of the default list of <em>masechtos</em> transliterated into into Latin chars.
* The default values use Ashkenazi American English transliteration.
*
* @param masechtosBavliTransliterated the list of transliterated Bavli <em>masechtos</em> to set.
* @see #getMasechtaTransliterated()
*/
public void setMasechtaTransliterated(String[] masechtosBavliTransliterated) {
Daf.masechtosBavliTransliterated = masechtosBavliTransliterated;
}
/**
* Returns the <em>masechta</em> (tractate) of the Daf Yomi in Hebrew. The list is in the following format<br>
* <code>["ברכות",
* "שבת", "עירובין",
* "פסחים", "שקלים", "יומא",
* "סוכה", "ביצה", "ראש השנה",
* "תענית", "מגילה", "מועד
* קטן", "חגיגה", "יבמות",
* "כתובות", "נדרים","נזיר",
* "סוטה", "גיטין", "קידושין",
* "בבא קמא", "בבא מציעא",
* "בבא בתרא", "סנהדרין",
* "מכות", "שבועות", "עבודה
* זרה", "הוריות", "זבחים",
* "מנחות", "חולין", "בכורות",
* "ערכין", "תמורה", "כריתות",
* "מעילה", "קינים", "תמיד",
* "מידות", "נדה"]</code>.
*
* @return the <em>masechta</em> (tractate) of the Daf Yomi in Hebrew. As an example, it will return
* ברכות for Berachos.
*/
public String getMasechta() {
return masechtosBavli[masechtaNumber];
}
/**
* Returns the transliterated name of the <em>masechta</em> (tractate) of the Daf Yomi in Yerushalmi. The list of
* <em>mashechtos</em> is:
* Berachos, Pe'ah, Demai, Kilayim, Shevi'is, Terumos, Ma'asros, Ma'aser Sheni, Chalah, Orlah, Bikurim,
* Shabbos, Eruvin, Pesachim, Beitzah, Rosh Hashanah, Yoma, Sukah, Ta'anis, Shekalim, Megilah, Chagigah,
* Moed Katan, Yevamos, Kesuvos, Sotah, Nedarim, Nazir, Gitin, Kidushin, Bava Kama, Bava Metzia,
* Bava Basra, Shevuos, Makos, Sanhedrin, Avodah Zarah, Horayos, Nidah and No Daf Today.
*
* @return the transliterated name of the <em>masechta</em> (tractate) of the Daf Yomi such as Berachos.
*/
public String getYerushalmiMasechtaTransliterated() {
return masechtosYerushalmiTransliterated[masechtaNumber];
}
/**
* @see #getYerushalmiMasechtaTransliterated()
* @deprecated misspelled method name to be removed in 3.0.0.
* @return the transliterated name of the <em>masechta</em> (tractate) of the Daf Yomi such as Berachos.
*/
@Deprecated // (forRemoval=true) // add back once Java 9 is the minimum supported version
public String getYerushlmiMasechtaTransliterated() {
return getYerushalmiMasechtaTransliterated();
}
/**
* Setter method to allow overriding of the default list of Yerushalmi <em>masechtos</em> transliterated into into Latin chars.
* The default uses Ashkenazi American English transliteration.
*
* @param masechtosYerushalmiTransliterated the list of transliterated Yerushalmi <em>masechtos</em> to set.
*/
public void setYerushalmiMasechtaTransliterated(String[] masechtosYerushalmiTransliterated) {
Daf.masechtosYerushalmiTransliterated = masechtosYerushalmiTransliterated;
}
/**
* @see #setYerushalmiMasechtaTransliterated(String[])
* @deprecated misspelled method name to be removed in 3.0.0.
* @param masechtosYerushalmiTransliterated the list of transliterated Yerushalmi <em>masechtos</em> to set.
*/
@Deprecated // (forRemoval=true) // add back once Java 9 is the minimum supported version
public void setYerushlmiMasechtaTransliterated(String[] masechtosYerushalmiTransliterated) {
setYerushalmiMasechtaTransliterated(masechtosYerushalmiTransliterated);
}
/**
* Getter method to allow retrieving the list of Yerushalmi <em>masechtos</em> transliterated into into Latin chars.
* The default uses Ashkenazi American English transliteration.
*
* @return the array of transliterated <em>masechta</em> (tractate) names of the Daf Yomi Yerushalmi.
*/
public static String[] getYerushalmiMasechtosTransliterated() {
return masechtosYerushalmiTransliterated;
}
/**
* @see #getYerushalmiMasechtosTransliterated()
* @deprecated misspelled method name to be removed in 3.0.0.
* @return the array of transliterated <em>masechta</em> (tractate) names of the Daf Yomi Yerushalmi.
*/
@Deprecated // (forRemoval=true) // add back once Java 9 is the minimum supported version
public static String[] getYerushlmiMasechtosTransliterated() {
return getYerushalmiMasechtosTransliterated();
}
/**
* Getter method to allow retrieving the list of Yerushalmi <em>masechtos</em>.
*
* @return the array of Hebrew <em>masechta</em> (tractate) names of the Daf Yomi Yerushalmi.
*/
public static String[] getYerushalmiMasechtos() {
return masechtosYerushalmi;
}
/**
* @see #getYerushalmiMasechtos()
* @deprecated misspelled method name to be removed in 3.0.0.
* @return the array of Hebrew <em>masechta</em> (tractate) names of the Daf Yomi Yerushalmi.
*/
@Deprecated // (forRemoval=true) // add back once Java 9 is the minimum supported version
public static String[] getYerushlmiMasechtos() {
return getYerushalmiMasechtos();
}
/**
* Returns the Yerushalmi <em>masechta</em> (tractate) of the Daf Yomi in Hebrew. As an example, it will return
* ברכות for Berachos.
*
* @return the Yerushalmi <em>masechta</em> (tractate) of the Daf Yomi in Hebrew. As an example, it will return
* ברכות for Berachos.
*/
public String getYerushalmiMasechta() {
return masechtosYerushalmi[masechtaNumber];
}
}