Class Parsha


  • public class Parsha
    extends Object
    The Parsha class calculates the weekly parsha. This open source Java code was originally ported by Avrom Finkelstien from his C++ code. It was refactored to fit the KosherJava Zmanim API with simplification of the code, enhancements and some bug fixing. Note that this is currently the only part of the KosherJava Zamanim API that is under the GPL. The rest of the library is under the LGPL. For this reason, this class will not be part of the default Zmanim API distribution. The methods used to obtain the parsha were derived from the source code of HebCal by Danny Sadinoff and JCal for the Mac by Frank Yellin. Both based their code on routines by Nachum Dershowitz and Edward M. Reingold. The class allows setting whether the parsha and holiday scheme follows the Israel scheme or outside Israel scheme. The default is the outside Israel scheme. TODO: Some do not belong in this class, but here is a partial list of what should still be implemented in some form:
    1. Add Isru Chag
    2. Add special parshiyos (shekalim, parah, zachor and hachodesh
    3. Shabbos Mevarchim
    4. Haftorah (various minhagim)
    5. Daf Yomi Yerushalmi, Mishna yomis etc)
    6. Support showing the upcoming parsha for the middle of the week
    Author:
    © Avrom Finkelstien 2002, © Eliyahu Hershfeld 2011 - 2016
    See Also:
    Date, Calendar
    • Constructor Detail

      • Parsha

        public Parsha()
        Default constructor will set a default date to the current system date.
    • Method Detail

      • getParshaIndex

        public int getParshaIndex()
        Returns a the index of today's parsha(ios) or a -1 if there is none. To get the name of the Parsha, use the ParshaFormatter.formatParsha(JewishCalendar). TODO: consider possibly return the parsha of the week for any day during the week instead of empty. To do this the simple way, create a new instance of the class in the mothod, roll it to the next shabbos. If the shabbos has no parsha, keep rolling by a week till a parsha is encountered. Possibly turn into static method that takes in a year, month, day, roll to next shabbos (not that simple with the API for date passed in) and if it is not a shabbos roll forwarde one week at a time to get the parsha. I do not think it is possible to have more than 2 shabbosim in a row without a parsha, but I may be wrong.
        Returns:
        the string of the parsha. Will currently return blank for weekdays and a shabbos on a yom tov.