001/*
002 * Zmanim Java API
003 * Copyright © 2011 - 2026 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; version 2.1 of the License.
007 *
008 * This library is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied
009 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
010 * details.
011 * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to
012 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA,
013 * or connect to: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
014 */
015
016package com.kosherjava.zmanim.hebrewcalendar;
017
018/**
019 * An Object representing a <em>daf</em> (page) in the <a href="https://en.wikipedia.org/wiki/Daf_Yomi">Daf Yomi</a> cycle.
020 * 
021 * @author © Eliyahu Hershfeld 2011 - 2026
022 */
023public class Daf {
024        /**
025         * See {@link #getMasechtaNumber()} and {@link #setMasechtaNumber(int)}.
026         */
027        private int masechtaNumber;
028        
029        /**
030         * See {@link #getDaf()} and {@link #setDaf(int)}.
031         */
032        private int daf;
033
034        /**
035         * See {@link #getMasechtaTransliterated()} and {@link #setMasechtaTransliterated(String[])}.
036         */
037        private static String[] masechtosBavliTransliterated = { "Berachos", "Shabbos", "Eruvin", "Pesachim", "Shekalim",
038                        "Yoma", "Sukkah", "Beitzah", "Rosh Hashana", "Taanis", "Megillah", "Moed Katan", "Chagigah", "Yevamos",
039                        "Kesubos", "Nedarim", "Nazir", "Sotah", "Gitin", "Kiddushin", "Bava Kamma", "Bava Metzia", "Bava Basra",
040                        "Sanhedrin", "Makkos", "Shevuos", "Avodah Zarah", "Horiyos", "Zevachim", "Menachos", "Chullin", "Bechoros",
041                        "Arachin", "Temurah", "Kerisos", "Meilah", "Kinnim", "Tamid", "Midos", "Niddah" };
042
043        /**
044         * See {@link #getMasechta()}.
045         */
046        private static final String[] masechtosBavli = { "ברכות", "שבת", "עירובין", "פסחים", "שקלים", "יומא", "סוכה", "ביצה", "ראש השנה",
047                        "תענית", "מגילה", "מועד קטן", "חגיגה", "יבמות", "כתובות", "נדרים", "נזיר", "סוטה", "גיטין", "קידושין", "בבא קמא", "בבא מציעא",
048                        "בבא בתרא", "סנהדרין", "מכות", "שבועות", "עבודה זרה", "הוריות", "זבחים", "מנחות", "חולין", "בכורות", "ערכין", "תמורה", "כריתות",
049                        "מעילה", "קינים", "תמיד", "מידות", "נדה" };
050        
051        /**
052         * See {@link #getYerushalmiMasechtaTransliterated()}.
053         */
054        private static String[] masechtosYerushalmiTransliterated = { "Berachos", "Pe'ah", "Demai", "Kilayim", "Shevi'is",
055                        "Terumos", "Ma'asros", "Ma'aser Sheni", "Chalah", "Orlah", "Bikurim", "Shabbos", "Eruvin", "Pesachim",
056                        "Beitzah", "Rosh Hashanah", "Yoma", "Sukah", "Ta'anis", "Shekalim", "Megilah", "Chagigah", "Moed Katan",
057                        "Yevamos", "Kesuvos", "Sotah", "Nedarim", "Nazir", "Gitin", "Kidushin", "Bava Kama", "Bava Metzia",
058                        "Bava Basra", "Shevuos", "Makos", "Sanhedrin", "Avodah Zarah", "Horayos", "Nidah", "No Daf Today" };
059        
060        /**
061         * See {@link #getYerushalmiMasechta()}.
062         */
063        private static final String[] masechtosYerushalmi = { "ברכות", "פיאה", "דמאי", "כלאים", "שביעית", "תרומות", "מעשרות","מעשר שני",
064                        "חלה", "עורלה", "ביכורים", "שבת", "עירובין", "פסחים", "ביצה", "ראש השנה", "יומא", "סוכה", "תענית", "שקלים", "מגילה", "חגיגה",
065                        "מועד קטן", "יבמות", "כתובות", "סוטה", "נדרים", "נזיר", "גיטין", "קידושין", "בבא קמא", "בבא מציעא", "בבא בתרא", "שבועות", "מכות",
066                        "סנהדרין", "עבודה זרה", "הוריות", "נידה", "אין דף היום" };
067
068        /**
069         * Gets the <em>masechta</em> number of the currently set <em>Daf</em>. The sequence is: Berachos, Shabbos, Eruvin,
070         * Pesachim, Shekalim, Yoma, Sukkah, Beitzah, Rosh Hashana, Taanis, Megillah, Moed Katan, Chagigah, Yevamos, Kesubos,
071         * Nedarim, Nazir, Sotah, Gitin, Kiddushin, Bava Kamma, Bava Metzia, Bava Basra, Sanhedrin, Makkos, Shevuos, Avodah
072         * Zarah, Horiyos, Zevachim, Menachos, Chullin, Bechoros, Arachin, Temurah, Kerisos, Meilah, Kinnim, Tamid, Midos and
073         * Niddah.
074         * @return the masechtaNumber.
075         * @see #setMasechtaNumber(int)
076         */
077        public int getMasechtaNumber() {
078                return masechtaNumber;
079        }
080
081        /**
082         * Set the <em>masechta</em> number in the order of the Daf Yomi. The sequence is: Berachos, Shabbos, Eruvin, Pesachim,
083         * Shekalim, Yoma, Sukkah, Beitzah, Rosh Hashana, Taanis, Megillah, Moed Katan, Chagigah, Yevamos, Kesubos, Nedarim,
084         * Nazir, Sotah, Gitin, Kiddushin, Bava Kamma, Bava Metzia, Bava Basra, Sanhedrin, Makkos, Shevuos, Avodah Zarah,
085         * Horiyos, Zevachim, Menachos, Chullin, Bechoros, Arachin, Temurah, Kerisos, Meilah, Kinnim, Tamid, Midos and
086         * Niddah.
087         * 
088         * @param masechtaNumber
089         *            the <em>masechta</em> number in the order of the Daf Yomi to set.
090         */
091        public void setMasechtaNumber(int masechtaNumber) {
092                this.masechtaNumber = masechtaNumber;
093        }
094
095        /**
096         * Constructor that creates a Daf setting the {@link #setMasechtaNumber(int) <em>masechta</em> number} and
097         * {@link #setDaf(int) <em>daf</em> number}.
098         * 
099         * @param masechtaNumber the <em>masechta</em> number in the order of the Daf Yomi to set as the current <em>masechta</em>.
100         * @param daf the <em>daf</em> (page) number to set.
101         */
102        public Daf(int masechtaNumber, int daf) {
103                this.masechtaNumber = masechtaNumber;
104                this.daf = daf;
105        }
106
107        /**
108         * Returns the <em>daf</em> (page) number of the Daf Yomi.
109         * @return the <em>daf</em> (page) number of the Daf Yomi.
110         */
111        public int getDaf() {
112                return daf;
113        }
114
115        /**
116         * Sets the <em>daf</em> (page) number of the Daf Yomi.
117         * @param daf the <em>daf</em> (page) number.
118         */
119        public void setDaf(int daf) {
120                this.daf = daf;
121        }
122
123        /**
124         * Returns the transliterated name of the <em>masechta</em> (tractate) of the Daf Yomi. The list of <em>masechtos</em>
125         * is: Berachos, Shabbos, Eruvin, Pesachim, Shekalim, Yoma, Sukkah, Beitzah, Rosh Hashana, Taanis, Megillah, Moed Katan,
126         * Chagigah, Yevamos, Kesubos, Nedarim, Nazir, Sotah, Gitin, Kiddushin, Bava Kamma, Bava Metzia, Bava Basra, Sanhedrin,
127         * Makkos, Shevuos, Avodah Zarah, Horiyos, Zevachim, Menachos, Chullin, Bechoros, Arachin, Temurah, Kerisos, Meilah,
128         * Kinnim, Tamid, Midos and Niddah.
129         * 
130         * @return the transliterated name of the <em>masechta</em> (tractate) of the Daf Yomi such as Berachos.
131         * @see #setMasechtaTransliterated(String[])
132         */
133        public String getMasechtaTransliterated() {
134                return masechtosBavliTransliterated[masechtaNumber];
135        }
136        
137        /**
138         * Setter method to allow overriding of the default list of <em>masechtos</em> transliterated into Latin chars.
139         * The default values use Ashkenazi American English transliteration.
140         * 
141         * @param masechtosBavliTransliterated the list of transliterated Bavli <em>masechtos</em> to set.
142         * @see #getMasechtaTransliterated()
143         */
144        public void setMasechtaTransliterated(String[] masechtosBavliTransliterated) {
145                Daf.masechtosBavliTransliterated = masechtosBavliTransliterated;
146        }
147
148        /**
149         * Returns the <em>masechta</em> (tractate) of the Daf Yomi in Hebrew. The list is in the following format<br>
150         * <code>["ברכות", "שבת", "עירובין", "פסחים", "שקלים", "יומא", "סוכה", "ביצה", "ראש השנה", "תענית", "מגילה", "מועד קטן", "חגיגה", "יבמות", "כתובות", "נדרים","נזיר", "סוטה", "גיטין", 
151         * "קידושין", "בבא קמא", "בבא מציעא", "בבא בתרא", "סנהדרין", "מכות", "שבועות", "עבודה זרה", "הוריות", "זבחים", "מנחות", "חולין", "בכורות", "ערכין", "תמורה", "כריתות", "מעילה", 
152         * "קינים", "תמיד", "מידות", "נדה"]</code>.
153         * 
154         * @return the <em>masechta</em> (tractate) of the Daf Yomi in Hebrew. As an example, it will return ברכות for Berachos.
155         */
156        public String getMasechta() {
157                return masechtosBavli[masechtaNumber];
158        }
159
160        /**
161         * Returns the transliterated name of the <em>masechta</em> (tractate) of the Daf Yomi in Yerushalmi. The list of
162         * <em>masechtos</em> is:
163         * Berachos, Pe'ah, Demai, Kilayim, Shevi'is, Terumos, Ma'asros, Ma'aser Sheni, Chalah, Orlah, Bikurim, 
164         * Shabbos, Eruvin, Pesachim, Beitzah, Rosh Hashanah, Yoma, Sukah, Ta'anis, Shekalim, Megilah, Chagigah, 
165         * Moed Katan, Yevamos, Kesuvos, Sotah, Nedarim, Nazir, Gitin, Kidushin, Bava Kama, Bava Metzia,
166         * Bava Basra, Shevuos, Makos, Sanhedrin, Avodah Zarah, Horayos, Nidah and No Daf Today.
167         * 
168         * @return the transliterated name of the <em>masechta</em> (tractate) of the Daf Yomi such as Berachos.
169         */
170        public String getYerushalmiMasechtaTransliterated() {
171                return masechtosYerushalmiTransliterated[masechtaNumber];
172        }
173        
174        /**
175         * Setter method to allow overriding of the default list of Yerushalmi <em>masechtos</em> transliterated into Latin chars.
176         * The default uses Ashkenazi American English transliteration.
177         * 
178         * @param masechtosYerushalmiTransliterated the list of transliterated Yerushalmi <em>masechtos</em> to set.
179         */
180        public void setYerushalmiMasechtaTransliterated(String[] masechtosYerushalmiTransliterated) {
181                Daf.masechtosYerushalmiTransliterated = masechtosYerushalmiTransliterated;
182        }
183        
184        /**
185         * Getter method to allow retrieving the list of Yerushalmi <em>masechtos</em> transliterated into Latin chars.
186         * The default uses Ashkenazi American English transliteration.
187         * 
188         * @return the array of transliterated <em>masechta</em> (tractate) names of the Daf Yomi Yerushalmi.
189         */
190        public static String[] getYerushalmiMasechtosTransliterated() {
191                return masechtosYerushalmiTransliterated;
192        }
193        
194        /**
195         * Getter method to allow retrieving the list of Yerushalmi <em>masechtos</em>.
196         * 
197         * @return the array of Hebrew <em>masechta</em> (tractate) names of the Daf Yomi Yerushalmi.
198         */
199        public static String[] getYerushalmiMasechtos() {
200                return masechtosYerushalmi;
201        }
202
203        /**
204         * Returns the Yerushalmi <em>masechta</em> (tractate) of the Daf Yomi in Hebrew. As an example, it will return ברכות for Berachos.
205         * 
206         * @return the Yerushalmi <em>masechta</em> (tractate) of the Daf Yomi in Hebrew. As an example, it will return ברכות for Berachos.
207         */
208        public String getYerushalmiMasechta() {
209                return masechtosYerushalmi[masechtaNumber];
210        }
211}