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 &copy; Eliyahu Hershfeld 2011 - 2023
023 */
024public class Daf {
025        /**
026         * See {@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 = { "ברכות", "שבת", "עירובין", "פסחים", "שקלים", "יומא", "סוכה", "ביצה", "ראש השנה",
048                        "תענית", "מגילה", "מועד קטן", "חגיגה", "יבמות", "כתובות", "נדרים", "נזיר", "סוטה", "גיטין", "קידושין", "בבא קמא", "בבא מציעא",
049                        "בבא בתרא", "סנהדרין", "מכות", "שבועות", "עבודה זרה", "הוריות", "זבחים", "מנחות", "חולין", "בכורות", "ערכין", "תמורה", "כריתות",
050                        "מעילה", "קינים", "תמיד", "מידות", "נדה" };
051        
052        /**
053         * See {@link #getYerushalmiMasechtaTransliterated()}.
054         */
055        private static String[] masechtosYerushalmiTransliterated = { "Berachos", "Pe'ah", "Demai", "Kilayim", "Shevi'is",
056                        "Terumos", "Ma'asros", "Ma'aser Sheni", "Chalah", "Orlah", "Bikurim", "Shabbos", "Eruvin", "Pesachim",
057                        "Beitzah", "Rosh Hashanah", "Yoma", "Sukah", "Ta'anis", "Shekalim", "Megilah", "Chagigah", "Moed Katan",
058                        "Yevamos", "Kesuvos", "Sotah", "Nedarim", "Nazir", "Gitin", "Kidushin", "Bava Kama", "Bava Metzia",
059                        "Bava Basra", "Shevuos", "Makos", "Sanhedrin", "Avodah Zarah", "Horayos", "Nidah", "No Daf Today" };
060        
061        /**
062         * See {@link #getYerushalmiMasechta()}.
063         */
064        private static final String[] masechtosYerushalmi = { "ברכות", "פיאה", "דמאי", "כלאים", "שביעית", "תרומות", "מעשרות","מעשר שני",
065                        "חלה", "עורלה", "ביכורים", "שבת", "עירובין", "פסחים", "ביצה", "ראש השנה", "יומא", "סוכה", "תענית", "שקלים", "מגילה", "חגיגה",
066                        "מועד קטן", "יבמות", "כתובות", "סוטה", "נדרים", "נזיר", "גיטין", "קידושין", "בבא קמא", "בבא מציעא", "בבא בתרא", "שבועות", "מכות",
067                        "סנהדרין", "עבודה זרה", "הוריות", "נידה", "אין דף היום" };
068
069        /**
070         * Gets the <em>masechta</em> number of the currently set <em>Daf</em>. The sequence is: Berachos, Shabbos, Eruvin,
071         * Pesachim, Shekalim, Yoma, Sukkah, Beitzah, Rosh Hashana, Taanis, Megillah, Moed Katan, Chagigah, Yevamos, Kesubos,
072         * Nedarim, Nazir, Sotah, Gitin, Kiddushin, Bava Kamma, Bava Metzia, Bava Basra, Sanhedrin, Makkos, Shevuos, Avodah
073         * Zarah, Horiyos, Zevachim, Menachos, Chullin, Bechoros, Arachin, Temurah, Kerisos, Meilah, Kinnim, Tamid, Midos and
074         * Niddah.
075         * @return the masechtaNumber.
076         * @see #setMasechtaNumber(int)
077         */
078        public int getMasechtaNumber() {
079                return masechtaNumber;
080        }
081
082        /**
083         * Set the <em>masechta</em> number in the order of the Daf Yomi. The sequence is: Berachos, Shabbos, Eruvin, Pesachim,
084         * Shekalim, Yoma, Sukkah, Beitzah, Rosh Hashana, Taanis, Megillah, Moed Katan, Chagigah, Yevamos, Kesubos, Nedarim,
085         * Nazir, Sotah, Gitin, Kiddushin, Bava Kamma, Bava Metzia, Bava Basra, Sanhedrin, Makkos, Shevuos, Avodah Zarah,
086         * Horiyos, Zevachim, Menachos, Chullin, Bechoros, Arachin, Temurah, Kerisos, Meilah, Kinnim, Tamid, Midos and
087         * Niddah.
088         * 
089         * @param masechtaNumber
090         *            the <em>masechta</em> number in the order of the Daf Yomi to set.
091         */
092        public void setMasechtaNumber(int masechtaNumber) {
093                this.masechtaNumber = masechtaNumber;
094        }
095
096        /**
097         * Constructor that creates a Daf setting the {@link #setMasechtaNumber(int) <em>masechta</em> number} and
098         * {@link #setDaf(int) <em>daf</em> number}.
099         * 
100         * @param masechtaNumber the <em>masechta</em> number in the order of the Daf Yomi to set as the current <em>masechta</em>.
101         * @param daf the <em>daf</em> (page) number to set.
102         */
103        public Daf(int masechtaNumber, int daf) {
104                this.masechtaNumber = masechtaNumber;
105                this.daf = daf;
106        }
107
108        /**
109         * Returns the <em>daf</em> (page) number of the Daf Yomi.
110         * @return the <em>daf</em> (page) number of the Daf Yomi.
111         */
112        public int getDaf() {
113                return daf;
114        }
115
116        /**
117         * Sets the <em>daf</em> (page) number of the Daf Yomi.
118         * @param daf the <em>daf</em> (page) number.
119         */
120        public void setDaf(int daf) {
121                this.daf = daf;
122        }
123
124        /**
125         * Returns the transliterated name of the <em>masechta</em> (tractate) of the Daf Yomi. The list of <em>mashechtos</em>
126         * is: Berachos, Shabbos, Eruvin, Pesachim, Shekalim, Yoma, Sukkah, Beitzah, Rosh Hashana, Taanis, Megillah, Moed Katan,
127         * Chagigah, Yevamos, Kesubos, Nedarim, Nazir, Sotah, Gitin, Kiddushin, Bava Kamma, Bava Metzia, Bava Basra, Sanhedrin,
128         * Makkos, Shevuos, Avodah Zarah, Horiyos, Zevachim, Menachos, Chullin, Bechoros, Arachin, Temurah, Kerisos, Meilah,
129         * Kinnim, Tamid, Midos and Niddah.
130         * 
131         * @return the transliterated name of the <em>masechta</em> (tractate) of the Daf Yomi such as Berachos.
132         * @see #setMasechtaTransliterated(String[])
133         */
134        public String getMasechtaTransliterated() {
135                return masechtosBavliTransliterated[masechtaNumber];
136        }
137        
138        /**
139         * Setter method to allow overriding of the default list of <em>masechtos</em> transliterated into Latin chars.
140         * The default values use Ashkenazi American English transliteration.
141         * 
142         * @param masechtosBavliTransliterated the list of transliterated Bavli <em>masechtos</em> to set.
143         * @see #getMasechtaTransliterated()
144         */
145        public void setMasechtaTransliterated(String[] masechtosBavliTransliterated) {
146                Daf.masechtosBavliTransliterated = masechtosBavliTransliterated;
147        }
148
149        /**
150         * Returns the <em>masechta</em> (tractate) of the Daf Yomi in Hebrew. The list is in the following format<br>
151         * <code>["ברכות", "שבת", "עירובין", "פסחים", "שקלים", "יומא", "סוכה", "ביצה", "ראש השנה", "תענית", "מגילה", "מועד קטן", "חגיגה", "יבמות", "כתובות", "נדרים","נזיר", "סוטה", "גיטין", 
152         * "קידושין", "בבא קמא", "בבא מציעא", "בבא בתרא", "סנהדרין", "מכות", "שבועות", "עבודה זרה", "הוריות", "זבחים", "מנחות", "חולין", "בכורות", "ערכין", "תמורה", "כריתות", "מעילה", 
153         * "קינים", "תמיד", "מידות", "נדה"]</code>.
154         * 
155         * @return the <em>masechta</em> (tractate) of the Daf Yomi in Hebrew. As an example, it will return ברכות for Berachos.
156         */
157        public String getMasechta() {
158                return masechtosBavli[masechtaNumber];
159        }
160
161        /**
162         * Returns the transliterated name of the <em>masechta</em> (tractate) of the Daf Yomi in Yerushalmi. The list of
163         * <em>mashechtos</em> is:
164         * Berachos, Pe'ah, Demai, Kilayim, Shevi'is, Terumos, Ma'asros, Ma'aser Sheni, Chalah, Orlah, Bikurim, 
165         * Shabbos, Eruvin, Pesachim, Beitzah, Rosh Hashanah, Yoma, Sukah, Ta'anis, Shekalim, Megilah, Chagigah, 
166         * Moed Katan, Yevamos, Kesuvos, Sotah, Nedarim, Nazir, Gitin, Kidushin, Bava Kama, Bava Metzia,
167         * Bava Basra, Shevuos, Makos, Sanhedrin, Avodah Zarah, Horayos, Nidah and No Daf Today.
168         * 
169         * @return the transliterated name of the <em>masechta</em> (tractate) of the Daf Yomi such as Berachos.
170         */
171        public String getYerushalmiMasechtaTransliterated() {
172                return masechtosYerushalmiTransliterated[masechtaNumber];
173        }
174        
175        /**
176         * Setter method to allow overriding of the default list of Yerushalmi <em>masechtos</em> transliterated into into Latin chars.
177         * The default uses Ashkenazi American English transliteration.
178         * 
179         * @param masechtosYerushalmiTransliterated the list of transliterated Yerushalmi <em>masechtos</em> to set.
180         */
181        public void setYerushalmiMasechtaTransliterated(String[] masechtosYerushalmiTransliterated) {
182                Daf.masechtosYerushalmiTransliterated = masechtosYerushalmiTransliterated;
183        }
184        
185        /**
186         * Getter method to allow retrieving the list of Yerushalmi <em>masechtos</em> transliterated into into Latin chars.
187         * The default uses Ashkenazi American English transliteration.
188         * 
189         * @return the array of transliterated <em>masechta</em> (tractate) names of the Daf Yomi Yerushalmi.
190         */
191        public static String[] getYerushalmiMasechtosTransliterated() {
192                return masechtosYerushalmiTransliterated;
193        }
194        
195        /**
196         * Getter method to allow retrieving the list of Yerushalmi <em>masechtos</em>.
197         * 
198         * @return the array of Hebrew <em>masechta</em> (tractate) names of the Daf Yomi Yerushalmi.
199         */
200        public static String[] getYerushalmiMasechtos() {
201                return masechtosYerushalmi;
202        }
203
204        /**
205         * Returns the Yerushalmi <em>masechta</em> (tractate) of the Daf Yomi in Hebrew. As an example, it will return ברכות for Berachos.
206         * 
207         * @return the Yerushalmi <em>masechta</em> (tractate) of the Daf Yomi in Hebrew. As an example, it will return ברכות for Berachos.
208         */
209        public String getYerushalmiMasechta() {
210                return masechtosYerushalmi[masechtaNumber];
211        }
212}