001/* 002 * Zmanim Java API 003 * Copyright (C) 2011 - 2023 Eliyahu Hershfeld 004 * 005 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General 006 * Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) 007 * any later version. 008 * 009 * This library is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied 010 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 011 * details. 012 * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to 013 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA, 014 * or connect to: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html 015 */ 016 017package com.kosherjava.zmanim.hebrewcalendar; 018 019/** 020 * An Object representing a <em>daf</em> (page) in the <a href="https://en.wikipedia.org/wiki/Daf_Yomi">Daf Yomi</a> cycle. 021 * 022 * @author © Eliyahu Hershfeld 2011 - 2023 023 */ 024public class Daf { 025 /** 026 * {@link #getMasechtaNumber()} and {@link #setMasechtaNumber(int)}. 027 */ 028 private int masechtaNumber; 029 030 /** 031 * See {@link #getDaf()} and {@link #setDaf(int)}. 032 */ 033 private int daf; 034 035 /** 036 * See {@link #getMasechtaTransliterated()} and {@link #setMasechtaTransliterated(String[])}. 037 */ 038 private static String[] masechtosBavliTransliterated = { "Berachos", "Shabbos", "Eruvin", "Pesachim", "Shekalim", 039 "Yoma", "Sukkah", "Beitzah", "Rosh Hashana", "Taanis", "Megillah", "Moed Katan", "Chagigah", "Yevamos", 040 "Kesubos", "Nedarim", "Nazir", "Sotah", "Gitin", "Kiddushin", "Bava Kamma", "Bava Metzia", "Bava Basra", 041 "Sanhedrin", "Makkos", "Shevuos", "Avodah Zarah", "Horiyos", "Zevachim", "Menachos", "Chullin", "Bechoros", 042 "Arachin", "Temurah", "Kerisos", "Meilah", "Kinnim", "Tamid", "Midos", "Niddah" }; 043 044 /** 045 * See {@link #getMasechta()}. 046 */ 047 private static final String[] masechtosBavli = { "\u05D1\u05E8\u05DB\u05D5\u05EA", "\u05E9\u05D1\u05EA", 048 "\u05E2\u05D9\u05E8\u05D5\u05D1\u05D9\u05DF", "\u05E4\u05E1\u05D7\u05D9\u05DD", 049 "\u05E9\u05E7\u05DC\u05D9\u05DD", "\u05D9\u05D5\u05DE\u05D0", "\u05E1\u05D5\u05DB\u05D4", 050 "\u05D1\u05D9\u05E6\u05D4", "\u05E8\u05D0\u05E9 \u05D4\u05E9\u05E0\u05D4", 051 "\u05EA\u05E2\u05E0\u05D9\u05EA", "\u05DE\u05D2\u05D9\u05DC\u05D4", 052 "\u05DE\u05D5\u05E2\u05D3 \u05E7\u05D8\u05DF", "\u05D7\u05D2\u05D9\u05D2\u05D4", 053 "\u05D9\u05D1\u05DE\u05D5\u05EA", "\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA", "\u05E0\u05D3\u05E8\u05D9\u05DD", 054 "\u05E0\u05D6\u05D9\u05E8", "\u05E1\u05D5\u05D8\u05D4", "\u05D2\u05D9\u05D8\u05D9\u05DF", 055 "\u05E7\u05D9\u05D3\u05D5\u05E9\u05D9\u05DF", "\u05D1\u05D1\u05D0 \u05E7\u05DE\u05D0", 056 "\u05D1\u05D1\u05D0 \u05DE\u05E6\u05D9\u05E2\u05D0", "\u05D1\u05D1\u05D0 \u05D1\u05EA\u05E8\u05D0", 057 "\u05E1\u05E0\u05D4\u05D3\u05E8\u05D9\u05DF", "\u05DE\u05DB\u05D5\u05EA", 058 "\u05E9\u05D1\u05D5\u05E2\u05D5\u05EA", "\u05E2\u05D1\u05D5\u05D3\u05D4 \u05D6\u05E8\u05D4", 059 "\u05D4\u05D5\u05E8\u05D9\u05D5\u05EA", "\u05D6\u05D1\u05D7\u05D9\u05DD", "\u05DE\u05E0\u05D7\u05D5\u05EA", 060 "\u05D7\u05D5\u05DC\u05D9\u05DF", "\u05D1\u05DB\u05D5\u05E8\u05D5\u05EA", "\u05E2\u05E8\u05DB\u05D9\u05DF", 061 "\u05EA\u05DE\u05D5\u05E8\u05D4", "\u05DB\u05E8\u05D9\u05EA\u05D5\u05EA", "\u05DE\u05E2\u05D9\u05DC\u05D4", 062 "\u05E7\u05D9\u05E0\u05D9\u05DD", "\u05EA\u05DE\u05D9\u05D3", "\u05DE\u05D9\u05D3\u05D5\u05EA", 063 "\u05E0\u05D3\u05D4" }; 064 065 /** 066 * See {@link #getYerushalmiMasechtaTransliterated()}. 067 */ 068 private static String[] masechtosYerushalmiTransliterated = { "Berachos", "Pe'ah", "Demai", "Kilayim", "Shevi'is", 069 "Terumos", "Ma'asros", "Ma'aser Sheni", "Chalah", "Orlah", "Bikurim", "Shabbos", "Eruvin", "Pesachim", 070 "Beitzah", "Rosh Hashanah", "Yoma", "Sukah", "Ta'anis", "Shekalim", "Megilah", "Chagigah", "Moed Katan", 071 "Yevamos", "Kesuvos", "Sotah", "Nedarim", "Nazir", "Gitin", "Kidushin", "Bava Kama", "Bava Metzia", 072 "Bava Basra", "Shevuos", "Makos", "Sanhedrin", "Avodah Zarah", "Horayos", "Nidah", "No Daf Today" }; 073 074 /** 075 * See {@link #getYerushalmiMasechta()}. 076 */ 077 private static final String[] masechtosYerushalmi = { "\u05d1\u05e8\u05db\u05d5\u05ea","\u05e4\u05d9\u05d0\u05d4", 078 "\u05d3\u05de\u05d0\u05d9","\u05db\u05dc\u05d0\u05d9\u05dd","\u05e9\u05d1\u05d9\u05e2\u05d9\u05ea", 079 "\u05ea\u05e8\u05d5\u05de\u05d5\u05ea","\u05de\u05e2\u05e9\u05e8\u05d5\u05ea","\u05de\u05e2\u05e9\u05e8 \u05e9\u05e0\u05d9", 080 "\u05d7\u05dc\u05d4","\u05e2\u05d5\u05e8\u05dc\u05d4","\u05d1\u05d9\u05db\u05d5\u05e8\u05d9\u05dd", 081 "\u05e9\u05d1\u05ea","\u05e2\u05d9\u05e8\u05d5\u05d1\u05d9\u05df","\u05e4\u05e1\u05d7\u05d9\u05dd", 082 "\u05d1\u05d9\u05e6\u05d4","\u05e8\u05d0\u05e9 \u05d4\u05e9\u05e0\u05d4","\u05d9\u05d5\u05de\u05d0", 083 "\u05e1\u05d5\u05db\u05d4","\u05ea\u05e2\u05e0\u05d9\u05ea","\u05e9\u05e7\u05dc\u05d9\u05dd","\u05de\u05d2\u05d9\u05dc\u05d4", 084 "\u05d7\u05d2\u05d9\u05d2\u05d4","\u05de\u05d5\u05e2\u05d3 \u05e7\u05d8\u05df","\u05d9\u05d1\u05de\u05d5\u05ea", 085 "\u05db\u05ea\u05d5\u05d1\u05d5\u05ea","\u05e1\u05d5\u05d8\u05d4","\u05e0\u05d3\u05e8\u05d9\u05dd","\u05e0\u05d6\u05d9\u05e8", 086 "\u05d2\u05d9\u05d8\u05d9\u05df","\u05e7\u05d9\u05d3\u05d5\u05e9\u05d9\u05df","\u05d1\u05d1\u05d0 \u05e7\u05de\u05d0", 087 "\u05d1\u05d1\u05d0 \u05de\u05e6\u05d9\u05e2\u05d0","\u05d1\u05d1\u05d0 \u05d1\u05ea\u05e8\u05d0", 088 "\u05e9\u05d1\u05d5\u05e2\u05d5\u05ea","\u05de\u05db\u05d5\u05ea","\u05e1\u05e0\u05d4\u05d3\u05e8\u05d9\u05df", 089 "\u05e2\u05d1\u05d5\u05d3\u05d4 \u05d6\u05e8\u05d4","\u05d4\u05d5\u05e8\u05d9\u05d5\u05ea","\u05e0\u05d9\u05d3\u05d4", 090 "\u05d0\u05d9\u05df \u05d3\u05e3 \u05d4\u05d9\u05d5\u05dd" }; 091 092 /** 093 * Gets the <em>masechta</em> number of the currently set <em>Daf</em>. The sequence is: Berachos, Shabbos, Eruvin, 094 * Pesachim, Shekalim, Yoma, Sukkah, Beitzah, Rosh Hashana, Taanis, Megillah, Moed Katan, Chagigah, Yevamos, Kesubos, 095 * Nedarim, Nazir, Sotah, Gitin, Kiddushin, Bava Kamma, Bava Metzia, Bava Basra, Sanhedrin, Makkos, Shevuos, Avodah 096 * Zarah, Horiyos, Zevachim, Menachos, Chullin, Bechoros, Arachin, Temurah, Kerisos, Meilah, Kinnim, Tamid, Midos and 097 * Niddah. 098 * @return the masechtaNumber. 099 * @see #setMasechtaNumber(int) 100 */ 101 public int getMasechtaNumber() { 102 return masechtaNumber; 103 } 104 105 /** 106 * Set the <em>masechta</em> number in the order of the Daf Yomi. The sequence is: Berachos, Shabbos, Eruvin, Pesachim, 107 * Shekalim, Yoma, Sukkah, Beitzah, Rosh Hashana, Taanis, Megillah, Moed Katan, Chagigah, Yevamos, Kesubos, Nedarim, 108 * Nazir, Sotah, Gitin, Kiddushin, Bava Kamma, Bava Metzia, Bava Basra, Sanhedrin, Makkos, Shevuos, Avodah Zarah, 109 * Horiyos, Zevachim, Menachos, Chullin, Bechoros, Arachin, Temurah, Kerisos, Meilah, Kinnim, Tamid, Midos and 110 * Niddah. 111 * 112 * @param masechtaNumber 113 * the <em>masechta</em> number in the order of the Daf Yomi to set. 114 */ 115 public void setMasechtaNumber(int masechtaNumber) { 116 this.masechtaNumber = masechtaNumber; 117 } 118 119 /** 120 * Constructor that creates a Daf setting the {@link #setMasechtaNumber(int) <em>masechta</em> number} and 121 * {@link #setDaf(int) <em>daf</em> number}. 122 * 123 * @param masechtaNumber the <em>masechta</em> number in the order of the Daf Yomi to set as the current <em>masechta</em>. 124 * @param daf the <em>daf</em> (page) number to set. 125 */ 126 public Daf(int masechtaNumber, int daf) { 127 this.masechtaNumber = masechtaNumber; 128 this.daf = daf; 129 } 130 131 /** 132 * Returns the <em>daf</em> (page) number of the Daf Yomi. 133 * @return the <em>daf</em> (page) number of the Daf Yomi. 134 */ 135 public int getDaf() { 136 return daf; 137 } 138 139 /** 140 * Sets the <em>daf</em> (page) number of the Daf Yomi. 141 * @param daf the <em>daf</em> (page) number. 142 */ 143 public void setDaf(int daf) { 144 this.daf = daf; 145 } 146 147 /** 148 * Returns the transliterated name of the <em>masechta</em> (tractate) of the Daf Yomi. The list of <em>mashechtos</em> 149 * is: Berachos, Shabbos, Eruvin, Pesachim, Shekalim, Yoma, Sukkah, Beitzah, Rosh Hashana, Taanis, Megillah, Moed Katan, 150 * Chagigah, Yevamos, Kesubos, Nedarim, Nazir, Sotah, Gitin, Kiddushin, Bava Kamma, Bava Metzia, Bava Basra, Sanhedrin, 151 * Makkos, Shevuos, Avodah Zarah, Horiyos, Zevachim, Menachos, Chullin, Bechoros, Arachin, Temurah, Kerisos, Meilah, 152 * Kinnim, Tamid, Midos and Niddah. 153 * 154 * @return the transliterated name of the <em>masechta</em> (tractate) of the Daf Yomi such as Berachos. 155 * @see #setMasechtaTransliterated(String[]) 156 */ 157 public String getMasechtaTransliterated() { 158 return masechtosBavliTransliterated[masechtaNumber]; 159 } 160 161 /** 162 * Setter method to allow overriding of the default list of <em>masechtos</em> transliterated into into Latin chars. 163 * The default values use Ashkenazi American English transliteration. 164 * 165 * @param masechtosBavliTransliterated the list of transliterated Bavli <em>masechtos</em> to set. 166 * @see #getMasechtaTransliterated() 167 */ 168 public void setMasechtaTransliterated(String[] masechtosBavliTransliterated) { 169 Daf.masechtosBavliTransliterated = masechtosBavliTransliterated; 170 } 171 172 /** 173 * Returns the <em>masechta</em> (tractate) of the Daf Yomi in Hebrew. The list is in the following format<br> 174 * <code>["ברכות", 175 * "שבת", "עירובין", 176 * "פסחים", "שקלים", "יומא", 177 * "סוכה", "ביצה", "ראש השנה", 178 * "תענית", "מגילה", "מועד 179 * קטן", "חגיגה", "יבמות", 180 * "כתובות", "נדרים","נזיר", 181 * "סוטה", "גיטין", "קידושין", 182 * "בבא קמא", "בבא מציעא", 183 * "בבא בתרא", "סנהדרין", 184 * "מכות", "שבועות", "עבודה 185 * זרה", "הוריות", "זבחים", 186 * "מנחות", "חולין", "בכורות", 187 * "ערכין", "תמורה", "כריתות", 188 * "מעילה", "קינים", "תמיד", 189 * "מידות", "נדה"]</code>. 190 * 191 * @return the <em>masechta</em> (tractate) of the Daf Yomi in Hebrew. As an example, it will return 192 * ברכות for Berachos. 193 */ 194 public String getMasechta() { 195 return masechtosBavli[masechtaNumber]; 196 } 197 198 /** 199 * Returns the transliterated name of the <em>masechta</em> (tractate) of the Daf Yomi in Yerushalmi. The list of 200 * <em>mashechtos</em> is: 201 * Berachos, Pe'ah, Demai, Kilayim, Shevi'is, Terumos, Ma'asros, Ma'aser Sheni, Chalah, Orlah, Bikurim, 202 * Shabbos, Eruvin, Pesachim, Beitzah, Rosh Hashanah, Yoma, Sukah, Ta'anis, Shekalim, Megilah, Chagigah, 203 * Moed Katan, Yevamos, Kesuvos, Sotah, Nedarim, Nazir, Gitin, Kidushin, Bava Kama, Bava Metzia, 204 * Bava Basra, Shevuos, Makos, Sanhedrin, Avodah Zarah, Horayos, Nidah and No Daf Today. 205 * 206 * @return the transliterated name of the <em>masechta</em> (tractate) of the Daf Yomi such as Berachos. 207 */ 208 public String getYerushalmiMasechtaTransliterated() { 209 return masechtosYerushalmiTransliterated[masechtaNumber]; 210 } 211 212 /** 213 * @see #getYerushalmiMasechtaTransliterated() 214 * @deprecated misspelled method name to be removed in 3.0.0. 215 * @return the transliterated name of the <em>masechta</em> (tractate) of the Daf Yomi such as Berachos. 216 */ 217 @Deprecated // (forRemoval=true) // add back once Java 9 is the minimum supported version 218 public String getYerushlmiMasechtaTransliterated() { 219 return getYerushalmiMasechtaTransliterated(); 220 } 221 222 /** 223 * Setter method to allow overriding of the default list of Yerushalmi <em>masechtos</em> transliterated into into Latin chars. 224 * The default uses Ashkenazi American English transliteration. 225 * 226 * @param masechtosYerushalmiTransliterated the list of transliterated Yerushalmi <em>masechtos</em> to set. 227 */ 228 public void setYerushalmiMasechtaTransliterated(String[] masechtosYerushalmiTransliterated) { 229 Daf.masechtosYerushalmiTransliterated = masechtosYerushalmiTransliterated; 230 } 231 232 /** 233 * @see #setYerushalmiMasechtaTransliterated(String[]) 234 * @deprecated misspelled method name to be removed in 3.0.0. 235 * @param masechtosYerushalmiTransliterated the list of transliterated Yerushalmi <em>masechtos</em> to set. 236 */ 237 @Deprecated // (forRemoval=true) // add back once Java 9 is the minimum supported version 238 public void setYerushlmiMasechtaTransliterated(String[] masechtosYerushalmiTransliterated) { 239 setYerushalmiMasechtaTransliterated(masechtosYerushalmiTransliterated); 240 } 241 242 /** 243 * Getter method to allow retrieving the list of Yerushalmi <em>masechtos</em> transliterated into into Latin chars. 244 * The default uses Ashkenazi American English transliteration. 245 * 246 * @return the array of transliterated <em>masechta</em> (tractate) names of the Daf Yomi Yerushalmi. 247 */ 248 public static String[] getYerushalmiMasechtosTransliterated() { 249 return masechtosYerushalmiTransliterated; 250 } 251 252 /** 253 * @see #getYerushalmiMasechtosTransliterated() 254 * @deprecated misspelled method name to be removed in 3.0.0. 255 * @return the array of transliterated <em>masechta</em> (tractate) names of the Daf Yomi Yerushalmi. 256 */ 257 @Deprecated // (forRemoval=true) // add back once Java 9 is the minimum supported version 258 public static String[] getYerushlmiMasechtosTransliterated() { 259 return getYerushalmiMasechtosTransliterated(); 260 } 261 262 /** 263 * Getter method to allow retrieving the list of Yerushalmi <em>masechtos</em>. 264 * 265 * @return the array of Hebrew <em>masechta</em> (tractate) names of the Daf Yomi Yerushalmi. 266 */ 267 public static String[] getYerushalmiMasechtos() { 268 return masechtosYerushalmi; 269 } 270 271 /** 272 * @see #getYerushalmiMasechtos() 273 * @deprecated misspelled method name to be removed in 3.0.0. 274 * @return the array of Hebrew <em>masechta</em> (tractate) names of the Daf Yomi Yerushalmi. 275 */ 276 @Deprecated // (forRemoval=true) // add back once Java 9 is the minimum supported version 277 public static String[] getYerushlmiMasechtos() { 278 return getYerushalmiMasechtos(); 279 } 280 281 /** 282 * Returns the Yerushalmi <em>masechta</em> (tractate) of the Daf Yomi in Hebrew. As an example, it will return 283 * ברכות for Berachos. 284 * 285 * @return the Yerushalmi <em>masechta</em> (tractate) of the Daf Yomi in Hebrew. As an example, it will return 286 * ברכות for Berachos. 287 */ 288 public String getYerushalmiMasechta() { 289 return masechtosYerushalmi[masechtaNumber]; 290 } 291}