001/*
002 * Zmanim Java API
003 * Copyright (C) 2011 - 2020 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 Daf in the Daf Yomi cycle.
021 * 
022 * @author © Eliyahu Hershfeld 2011 - 2020
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 #getYerushlmiMasechtaTransliterated()}.
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", "Sanhedrin", "Makos", "Shevuos", "Avodah Zarah", "Horayos", "Nidah", "No Daf Today" };
073        
074        /**
075         * See {@link #getYerushalmiMasechta()}.
076         */
077        private static final String[] masechtosYerushlmi = { "\u05d1\u05e8\u05db\u05d5\u05ea","\u05e4\u05d9\u05d0\u05d4",
078                        "\u05d3\u05de\u05d0\u05d9","\u05db\u05dc\u05d0\u05d9\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 masechta number of the currently set Daf. The sequence is: Berachos, Shabbos, Eruvin, Pesachim,
094         * Shekalim, Yoma, Sukkah, Beitzah, Rosh Hashana, Taanis, Megillah, Moed Katan, Chagigah, Yevamos, Kesubos, Nedarim,
095         * Nazir, Sotah, Gitin, Kiddushin, Bava Kamma, Bava Metzia, Bava Basra, Sanhedrin, Makkos, Shevuos, Avodah Zarah,
096         * 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 masechta 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 masechtaNumber 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) masechta Number} and
121         * {@link #setDaf(int) daf Number}
122         * 
123         * @param masechtaNumber the masechtaNumber in the order of the Daf Yomi to set
124         * @param daf the daf (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 daf (page number) of the Daf Yomi
133         * @return the daf (page number) of the Daf Yomi
134         */
135        public int getDaf() {
136                return daf;
137        }
138
139        /**
140         * Sets the daf (page number) of the Daf Yomi
141         * @param daf the daf (page) number
142         */
143        public void setDaf(int daf) {
144                this.daf = daf;
145        }
146
147        /**
148         * Returns the transliterated name of the masechta (tractate) of the Daf Yomi. The list of mashechtos is: Berachos,
149         * Shabbos, Eruvin, Pesachim, Shekalim, Yoma, Sukkah, Beitzah, Rosh Hashana, Taanis, Megillah, Moed Katan, Chagigah,
150         * 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 masechta (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 masechtos transliterated into into Latin chars. The default
163         * uses Ashkenazi American English transliteration.
164         * 
165         * @param masechtosBavliTransliterated the list of transliterated Bavli masechtos to set.
166         * @see #getMasechtaTransliterated()
167         */
168        public void setMasechtaTransliterated(String[] masechtosBavliTransliterated) {
169                Daf.masechtosBavliTransliterated = masechtosBavliTransliterated;
170        }
171
172        /**
173         * Returns the masechta (tractate) of the Daf Yomi in Hebrew. The list is in the following format<br>
174         * <code>["&#x05D1;&#x05E8;&#x05DB;&#x05D5;&#x05EA;",
175         * "&#x05E9;&#x05D1;&#x05EA;", "&#x05E2;&#x05D9;&#x05E8;&#x05D5;&#x05D1;&#x05D9;&#x05DF;",
176         * "&#x05E4;&#x05E1;&#x05D7;&#x05D9;&#x05DD;", "&#x05E9;&#x05E7;&#x05DC;&#x05D9;&#x05DD;", "&#x05D9;&#x05D5;&#x05DE;&#x05D0;",
177         * "&#x05E1;&#x05D5;&#x05DB;&#x05D4;", "&#x05D1;&#x05D9;&#x05E6;&#x05D4;", "&#x05E8;&#x05D0;&#x05E9; &#x05D4;&#x05E9;&#x05E0;&#x05D4;",
178         * "&#x05EA;&#x05E2;&#x05E0;&#x05D9;&#x05EA;", "&#x05DE;&#x05D2;&#x05D9;&#x05DC;&#x05D4;", "&#x05DE;&#x05D5;&#x05E2;&#x05D3;
179         * &#x05E7;&#x05D8;&#x05DF;", "&#x05D7;&#x05D2;&#x05D9;&#x05D2;&#x05D4;", "&#x05D9;&#x05D1;&#x05DE;&#x05D5;&#x05EA;",
180         * "&#x05DB;&#x05EA;&#x05D5;&#x05D1;&#x05D5;&#x05EA;", "&#x05E0;&#x05D3;&#x05E8;&#x05D9;&#x05DD;","&#x05E0;&#x05D6;&#x05D9;&#x05E8;",
181         * "&#x05E1;&#x05D5;&#x05D8;&#x05D4;", "&#x05D2;&#x05D9;&#x05D8;&#x05D9;&#x05DF;", "&#x05E7;&#x05D9;&#x05D3;&#x05D5;&#x05E9;&#x05D9;&#x05DF;",
182         * "&#x05D1;&#x05D1;&#x05D0; &#x05E7;&#x05DE;&#x05D0;", "&#x05D1;&#x05D1;&#x05D0; &#x05DE;&#x05E6;&#x05D9;&#x05E2;&#x05D0;",
183         * "&#x05D1;&#x05D1;&#x05D0; &#x05D1;&#x05EA;&#x05E8;&#x05D0;", "&#x05E1;&#x05E0;&#x05D4;&#x05D3;&#x05E8;&#x05D9;&#x05DF;",
184         * "&#x05DE;&#x05DB;&#x05D5;&#x05EA;", "&#x05E9;&#x05D1;&#x05D5;&#x05E2;&#x05D5;&#x05EA;", "&#x05E2;&#x05D1;&#x05D5;&#x05D3;&#x05D4;
185         * &#x05D6;&#x05E8;&#x05D4;", "&#x05D4;&#x05D5;&#x05E8;&#x05D9;&#x05D5;&#x05EA;", "&#x05D6;&#x05D1;&#x05D7;&#x05D9;&#x05DD;",
186         * "&#x05DE;&#x05E0;&#x05D7;&#x05D5;&#x05EA;", "&#x05D7;&#x05D5;&#x05DC;&#x05D9;&#x05DF;", "&#x05D1;&#x05DB;&#x05D5;&#x05E8;&#x05D5;&#x05EA;",
187         * "&#x05E2;&#x05E8;&#x05DB;&#x05D9;&#x05DF;", "&#x05EA;&#x05DE;&#x05D5;&#x05E8;&#x05D4;", "&#x05DB;&#x05E8;&#x05D9;&#x05EA;&#x05D5;&#x05EA;",
188         * "&#x05DE;&#x05E2;&#x05D9;&#x05DC;&#x05D4;", "&#x05E7;&#x05D9;&#x05E0;&#x05D9;&#x05DD;", "&#x05EA;&#x05DE;&#x05D9;&#x05D3;",
189         * "&#x05DE;&#x05D9;&#x05D3;&#x05D5;&#x05EA;", "&#x05E0;&#x05D3;&#x05D4;"]</code>.
190         * 
191         * @return the masechta (tractate) of the Daf Yomi in Hebrew, It will return
192         *         &#x05D1;&#x05E8;&#x05DB;&#x05D5;&#x05EA; for Berachos.
193         */
194        public String getMasechta() {
195                return masechtosBavli[masechtaNumber];
196        }
197
198        /**
199         * Returns the transliterated name of the masechta (tractate) of the Daf Yomi in Yerushalmi. The list of mashechtos is: 
200         * Berachos, Pe'ah,  Demai,  Kilayim,  Shevi'is,  Terumos,  Ma'asros,  Ma'aser Sheni,  Chalah,  Orlah,  Bikurim, 
201         * Shabbos, Eruvin,  Pesachim,  Beitzah,  Rosh Hashanah,  Yoma,  Sukah,  Ta'anis,  Shekalim,  Megilah,  Chagigah, 
202         * Moed Katan,  Yevamos,  Kesuvos,  Sotah,  Nedarim,  Nazir,  Gitin,  Kidushin,  Bava Kama,  Bava Metzia,
203         * Bava Basra,  Sanhedrin,  Makos,  Shevuos,  Avodah Zarah,  Horayos,  Nidah and No Daf Today.
204         * 
205         * @return the transliterated name of the masechta (tractate) of the Daf Yomi such as Berachos.
206         */
207        public String getYerushlmiMasechtaTransliterated() {
208                return masechtosYerushalmiTransliterated[masechtaNumber];
209        }
210        
211        /**
212         * Setter method to allow overriding of the default list of Yerushalmi masechtos transliterated into into Latin chars.
213         * The default uses Ashkenazi American English transliteration.
214         * 
215         * @param masechtosYerushalmiTransliterated the list of transliterated Yerushalmi masechtos to set.
216         */
217        public void setYerushlmiMasechtaTransliterated(String[] masechtosYerushalmiTransliterated) {
218                Daf.masechtosYerushalmiTransliterated = masechtosYerushalmiTransliterated;
219        }
220
221        /**
222         * Returns the Yerushlmi masechta (tractate) of the Daf Yomi in Hebrew, It will return
223         * &#x05D1;&#x05E8;&#x05DB;&#x05D5;&#x05EA; for Berachos.
224         * 
225         * @return the Yerushalmi masechta (tractate) of the Daf Yomi in Hebrew, It will return
226         *         &#x05D1;&#x05E8;&#x05DB;&#x05D5;&#x05EA; for Berachos.
227         */
228        public String getYerushalmiMasechta() {
229                return masechtosYerushlmi[masechtaNumber];
230        }
231
232}