From a5217e2ac6658f3f7214548889740b5ad7cb5a59 Mon Sep 17 00:00:00 2001 From: Elyahu Date: Mon, 8 Jan 2024 13:18:45 -0700 Subject: [PATCH] finish HebrewDateFormatter javadoc --- .../hebrewcalendar/HebrewDateFormatter.swift | 253 +++++++++++------- 1 file changed, 162 insertions(+), 91 deletions(-) diff --git a/Sources/KosherSwift/hebrewcalendar/HebrewDateFormatter.swift b/Sources/KosherSwift/hebrewcalendar/HebrewDateFormatter.swift index 8d248d1..e2f2338 100644 --- a/Sources/KosherSwift/hebrewcalendar/HebrewDateFormatter.swift +++ b/Sources/KosherSwift/hebrewcalendar/HebrewDateFormatter.swift @@ -8,63 +8,60 @@ import Foundation /** - * The HebrewDateFormatter class formats a {@link JewishCalendar}. + * The HebrewDateFormatter class formats a ``JewishCalendar``. * * The class formats Jewish dates, numbers, Daf Yomi (Bavli and Yerushalmi), the Omer, * Parshas Hashavua (including the special parshiyos of Shekalim, Zachor, Parah * and Hachodesh), Yomim Tovim and the Molad (experimental) in Hebrew or Latin chars, and has various settings. - * Sample full date output includes (using various options): - * +# Sample full date output includes (using various options): # + * 1. 21 Shevat, 5729 + * 2. כא שבט תשכט + * 3. כ״א שבט ה׳תשכ״ט + * 4. כ״א שבט תש״פ or + * כ״א שבט תש״ף + * 5. כ׳ שבט ו׳ אלפים * * @see JewishCalendar - * @see JewishCalendar * * @author © Eliyahu Hershfeld 2011 - 2023 */ public class HebrewDateFormatter { /** - * See {@link #isHebrewFormat()} and {@link #setHebrewFormat(boolean)}. + * See ``isHebrewFormat()`` and ``setHebrewFormat(hebrewFormat:)``. */ public var hebrewFormat = false; /** - * See {@link #isUseLongHebrewYears()} and {@link #setUseLongHebrewYears(boolean)}. + * See ``isUseLongHebrewYears()`` and ``setUseLongHebrewYears(useLongHebrewYears:)``. */ public var useLonghebrewYears = false; /** - * See {@link #isUseGershGershayim()} and {@link #setUseGershGershayim(boolean)}. + * See ``isUseGershGershayim()`` and ``setUseGershGershayim(useGershGershayim:)``. */ public var useGershGershayim = true; /** - * See {@link #isLongWeekFormat()} and {@link #setLongWeekFormat(boolean)}. + * See ``isLongWeekFormat()`` and ``setLongWeekFormat(longWeekFormat:)``. */ public var longWeekFormat = true; /** - * See {@link #isUseFinalFormLetters()} and {@link #setUseFinalFormLetters(boolean)}. + * See ``isUseFinalFormLetters()`` and ``setUseFinalFormLetters(useFinalFormLetters:)``. */ public var useFinalFormLetters = false; /** - * The internal DateFormat.  See {@link #isLongWeekFormat()} and {@link #setLongWeekFormat(boolean)}. + * The internal DateFormatter. See ``isLongWeekFormat()`` and ``setLongWeekFormat(longWeekFormat:)``. */ private let weekFormat = DateFormatter(); /** - * List of transliterated parshiyos using the default Ashkenazi pronunciation.  The formatParsha method - * uses self for transliterated parsha formatting.  self list can be overridden (for Sephardi - * English transliteration for example) by setting the {@link #setTransliteratedParshiosList(EnumMap)}.  The list - * includes double and special parshiyos is set as "Bereshis, Noach, Lech Lecha, Vayera, Chayei Sara, + * List of transliterated parshiyos using the default Ashkenazi pronunciation. The formatParsha method + * uses this for transliterated parsha formatting. This list can be overridden (for Sephardi + * English transliteration for example) by setting the ``setTransliteratedParshiosList(transliteratedParshaMap:)``.  The list + * includes double and special parshiyos and is set as "Bereshis, Noach, Lech Lecha, Vayera, Chayei Sara, * Toldos, Vayetzei, Vayishlach, Vayeshev, Miketz, Vayigash, Vayechi, Shemos, Vaera, Bo, Beshalach, Yisro, Mishpatim, * Terumah, Tetzaveh, Ki Sisa, Vayakhel, Pekudei, Vayikra, Tzav, Shmini, Tazria, Metzora, Achrei Mos, Kedoshim, Emor, * Behar, Bechukosai, Bamidbar, Nasso, Beha'aloscha, Sh'lach, Korach, Chukas, Balak, Pinchas, Matos, Masei, Devarim, @@ -76,10 +73,39 @@ public class HebrewDateFormatter { */ public var transliteratedParshaMap:[JewishCalendar.Parsha: String]; + /** + * Dictionary of Hebrew parshiyos. The list includes double and special parshiyos and + * contains "בראשית, נח, לך לך, + * וירא, חיי שרה, + * תולדות, ויצא, וישלח, + * וישב, מקץ, ויגש, ויחי, + * שמות, וארא, בא, בשלח, + * יתרו, משפטים, תרומה, + * תצוה, כי תשא, ויקהל, + * פקודי, ויקרא, צו, + * שמיני, תזריע, מצרע, + * אחרי מות, קדושים, + * אמור, בהר, בחקתי, + * במדבר, נשא, בהעלתך, + * שלח לך, קרח, חוקת, בלק, + * פינחס, מטות, מסעי, + * דברים, ואתחנן, עקב, + * ראה, שופטים, כי תצא, + * כי תבוא, נצבים, וילך, + * האזינו, וזאת הברכה, + * ויקהל פקודי, תזריע + * מצרע, אחרי מות + * קדושים, בהר בחקתי, + * חוקת בלק, מטות מסעי, + * נצבים וילך, שקלים, + * זכור, פרה, החדש, + * שובה,שירה,הגדול, + * חזון,נחמו" + */ public var hebrewParshaMap:[JewishCalendar.Parsha: String]; /** - * Default constructor sets the {@link EnumMap}s of Hebrew and default transliterated parshiyos. + * Default constructor sets the Dictionaries of Hebrew and default transliterated parshiyos. */ public init() { transliteratedParshaMap = [ @@ -238,25 +264,25 @@ public class HebrewDateFormatter { } /** - * Returns if the {@link #formatDayOfWeek(JewishCalendar)} will use the long format such as - * ראשון or short such as א when formatting the day of week in - * {@link #isHebrewFormat() Hebrew}. + * Returns true if the ``formatDayOfWeek(jewishCalendar:)`` will use the long format such as + * ראשון or false if short is used such as א when formatting the day of week in + * ``isHebrewFormat()`` Hebrew. * - * @return the longWeekFormat + * @return true if longWeekFormat is used * @see #setLongWeekFormat(boolean) * @see #formatDayOfWeek(JewishCalendar) */ - public func isLongWeekFormat() -> Bool{ + public func isLongWeekFormat() -> Bool { return longWeekFormat; } /** - * Setting to control if the {@link #formatDayOfWeek(JewishCalendar)} will use the long format such as + * Setting to control if the ``formatDayOfWeek(jewishCalendar:)`` will use the long format such as * ראשון or short such as א when formatting the day of week in - * {@link #isHebrewFormat() Hebrew}. + * ``isHebrewFormat()`` Hebrew. * * @param longWeekFormat - * the longWeekFormat to set + * a bool for whether to use longWeekFormat */ public func setLongWeekFormat(longWeekFormat:Bool) { self.longWeekFormat = longWeekFormat; @@ -280,7 +306,7 @@ public class HebrewDateFormatter { private static let GERSHAYIM = "\u{05F4}"; /** - * Transliterated month names.  Defaults to ["Nissan", "Iyar", "Sivan", "Tammuz", "Av", "Elul", "Tishrei", "Cheshvan", + * Transliterated month names. Defaults to ["Nissan", "Iyar", "Sivan", "Tammuz", "Av", "Elul", "Tishrei", "Cheshvan", * "Kislev", "Teves", "Shevat", "Adar", "Adar II", "Adar I" ]. * @see #getTransliteratedMonthList() * @see #setTransliteratedMonthList(String[]) @@ -296,7 +322,7 @@ public class HebrewDateFormatter { public var hebrewOmerPrefix = "\u{05D1}"; /** - * The default value for formatting Shabbos (Saturday).  Defaults to Shabbos. + * The default value for formatting Shabbos (Saturday). Defaults to Shabbos. * @see #getTransliteratedShabbosDayOfWeek() * @see #setTransliteratedShabbosDayOfWeek(String) */ @@ -304,7 +330,7 @@ public class HebrewDateFormatter { /** * Returns the day of Shabbos transliterated into Latin chars. The default uses Ashkenazi pronunciation "Shabbos". - * self can be overwritten using the {@link #setTransliteratedShabbosDayOfWeek(String)} + * This can be overwritten using the ``setTransliteratedShabbosDayOfWeek(transliteratedShabbos:)`` * * @return the transliteratedShabbos. The default list of months uses Ashkenazi pronunciation "Shabbos". * @see #setTransliteratedShabbosDayOfWeek(String) @@ -316,7 +342,7 @@ public class HebrewDateFormatter { /** * Setter to override the default transliterated name of "Shabbos" to alternate spelling such as "Shabbat" used by - * the {@link #formatDayOfWeek(JewishCalendar)} + * the ``formatDayOfWeek(jewishCalendar:)`` * * @param transliteratedShabbos * the transliteratedShabbos to set @@ -329,7 +355,7 @@ public class HebrewDateFormatter { } /** - * See {@link #getTransliteratedHolidayList()} and {@link #setTransliteratedHolidayList(String[])}. + * See ``getTransliteratedHolidayList()`` and ``setTransliteratedHolidayList(transliteratedHolidays:)``. */ public var transliteratedHolidays = ["Erev Pesach", "Pesach", "Chol Hamoed Pesach", "Pesach Sheni", "Erev Shavuos", "Shavuos", "Seventeenth of Tammuz", "Tishah B'Av", "Tu B'Av", "Erev Rosh Hashana", @@ -340,8 +366,8 @@ public class HebrewDateFormatter { "Isru Chag"]; /** - * Returns the list of holidays transliterated into Latin chars. self is used by the - * {@link #formatYomTov(JewishCalendar)} when formatting the Yom Tov String. The default list of months uses + * Returns the list of holidays transliterated into Latin chars. This is used by the + * ``formatYomTov(jewishCalendar:)`` when formatting the Yom Tov String. The default list of months uses * Ashkenazi pronunciation in typical American English spelling. * * @return the list of transliterated holidays. The default list is currently ["Erev Pesach", "Pesach", @@ -350,7 +376,7 @@ public class HebrewDateFormatter { * "Erev Succos", "Succos", "Chol Hamoed Succos", "Hoshana Rabbah", "Shemini Atzeres", "Simchas Torah", * "Erev Chanukah", "Chanukah", "Tenth of Teves", "Tu B'Shvat", "Fast of Esther", "Purim", "Shushan Purim", * "Purim Katan", "Rosh Chodesh", "Yom HaShoah", "Yom Hazikaron", "Yom Ha'atzmaut", "Yom Yerushalayim", - * "Lag B'Omer","Shushan Purim Katan","Isru Chag"]. + * "Lag B'Omer", "Shushan Purim Katan", "Isru Chag"]. * * @see #setTransliteratedMonthList(String[]) * @see #formatYomTov(JewishCalendar) @@ -361,8 +387,8 @@ public class HebrewDateFormatter { } /** - * Sets the list of holidays transliterated into Latin chars. self is used by the - * {@link #formatYomTov(JewishCalendar)} when formatting the Yom Tov String. + * Sets the list of holidays transliterated into Latin chars. This is used by the + * ``formatYomTov(jewishCalendar:)`` when formatting the Yom Tov String. * * @param transliteratedHolidays * the transliteratedHolidays to set. Ensure that the sequence exactly matches the list returned by the @@ -372,7 +398,41 @@ public class HebrewDateFormatter { self.transliteratedHolidays = transliteratedHolidays; } - private final let hebrewHolidays = [ + /** + * Hebrew holiday array in the following format. ["ערב פסח", + * "פסח", "חול המועד + * פסח", "פסח שני", "ערב + * שבועות", "שבועות", + * "שבעה עשר בתמוז", + * "תשעה באב", + * "ט״ו באב", + * "ערב ראש השנה", + * "ראש השנה", + * "צום גדליה", + * "ערב יום כיפור", + * "יום כיפור", + * "ערב סוכות", + * "סוכות", + * "חול המועד סוכות", + * "הושענא רבה", + * "שמיני עצרת", + * "שמחת תורה", + * "ערב חנוכה", + * "חנוכה", "עשרה בטבת", + * "ט״ו בשבט", + * "תענית אסתר", + * "פורים", + * "פורים שושן", + * "פורים קטן", + * "ראש חודש", + * "יום השואה", + * "יום הזיכרון", + * "יום העצמאות", + * "יום ירושלים", + * "ל״ג בעומר", + * "פורים שושן קטן"] + */ + public final let hebrewHolidays = [ "ערב פסח", "פסח", "חול המועד פסח", "פסח שני", "ערב שבועות", "שבועות", "שבעה עשר בתמוז", "תשעה באב", "ט\"ו באב", "ערב ראש השנה", "ראש השנה", "צום גדליה", "ערב יום כיפור", "יום כיפור", "ערב סוכות", "סוכות", @@ -386,7 +446,7 @@ public class HebrewDateFormatter { /** * Formats the Yom Tov (holiday) in Hebrew or transliterated Latin characters. * - * @param jewishCalendar the JewishCalendar + * @param jewishCalendar the ``JewishCalendar`` * @return the formatted holiday or an empty String if the day is not a holiday. * @see #isHebrewFormat() */ @@ -404,7 +464,7 @@ public class HebrewDateFormatter { * Formats a day as Rosh Chodesh in the format of in the format of ראש * חודש שבט or Rosh Chodesh Shevat. If it * is not Rosh Chodesh, an empty String will be returned. - * @param jewishCalendar the JewishCalendar + * @param jewishCalendar the ``JewishCalendar`` * @return The formatted String in the format of ראש * חודש שבט or Rosh Chodesh Shevat. If it * is not Rosh Chodesh, an empty String will be returned. @@ -433,7 +493,7 @@ public class HebrewDateFormatter { /** * Returns if the formatter is set to use Hebrew formatting in the various formatting methods. * - * @return the hebrewFormat + * @return if hebrewFormat is used * @see #setHebrewFormat(boolean) * @see #format(JewishCalendar) * @see #formatDayOfWeek(JewishCalendar) @@ -464,7 +524,7 @@ public class HebrewDateFormatter { /** * Returns the Hebrew Omer prefix.  By default it is the letter ב producing * בעומר, but it can be set to ל to produce - * לעומר (or any other prefix) using the {@link #setHebrewOmerPrefix(String)}. + * לעומר (or any other prefix) using the ``setHebrewOmerPrefix(hebrewOmerPrefix:)``. * * @return the hebrewOmerPrefix * @@ -492,7 +552,7 @@ public class HebrewDateFormatter { /** * Returns the list of months transliterated into Latin chars. The default list of months uses Ashkenazi - * pronunciation in typical American English spelling. self list has a length of 14 with 3 variations for Adar - + * pronunciation in typical American English spelling. This list has a length of 14 with 3 variations for Adar - * "Adar", "Adar II", "Adar I" * * @return the list of months beginning in Nissan and ending in in "Adar", "Adar II", "Adar I". The default list is @@ -518,10 +578,22 @@ public class HebrewDateFormatter { } /** - * Unicode list of Hebrew months in the following format ["\u05E0\u05D9\u05E1\u05DF","\u05D0\u05D9\u05D9\u05E8", - * "\u05E1\u05D9\u05D5\u05DF","\u05EA\u05DE\u05D5\u05D6","\u05D0\u05D1","\u05D0\u05DC\u05D5\u05DC", - * "\u05EA\u05E9\u05E8\u05D9","\u05D7\u05E9\u05D5\u05DF","\u05DB\u05E1\u05DC\u05D5","\u05D8\u05D1\u05EA", - * "\u05E9\u05D1\u05D8","\u05D0\u05D3\u05E8","\u05D0\u05D3\u05E8 \u05D1","\u05D0\u05D3\u05E8 \u05D0"] + * Unicode list of Hebrew months in the following format [ + "תשרי", + "חשון", + "כסלו", + "טבת", + "שבט", + "אדר", + "אדר ב", + "ניסן", + "אייר", + "סיוון", + "תמוז", + "אב", + "אלול", + "אדר א" + * ] * * @see #formatMonth(JewishCalendar) */ @@ -544,7 +616,7 @@ public class HebrewDateFormatter { /** - * Unicode list of Hebrew days of week in the format of ["ראשון", + * List of Hebrew days of week in the format of ["ראשון", * "שני","שלישי","רביעי", * "חמישי","ששי","שבת"] */ @@ -553,11 +625,11 @@ public class HebrewDateFormatter { ]; /** - * Formats the day of week. If {@link #isHebrewFormat() Hebrew formatting} is set, it will display in the format + * Formats the day of week. If ``isHebrewFormat()`` Hebrew formatting is set, it will display in the format * ראשון etc. If Hebrew formatting is not in use it will return it in the format * of Sunday etc. There are various formatting options that will affect the output. * - * @param JewishCalendar the JewishCalendar Object + * @param JewishCalendar the ``JewishCalendar`` Object * @return the formatted day of week * @see #isHebrewFormat() * @see #isLongWeekFormat() @@ -589,7 +661,7 @@ public class HebrewDateFormatter { /** * Returns whether the class is set to use the Geresh ׳ and Gershayim ״ in formatting Hebrew dates and * numbers. When true and output would look like כ״א שבט תש״כ - * (or כ״א שבט תש״ך). When set to false, self output + * (or כ״א שבט תש״ך). When set to false, this output * would display as כא שבט תשכ. * * @return true if set to use the Geresh ׳ and Gershayim ״ in formatting Hebrew dates and numbers. @@ -601,7 +673,7 @@ public class HebrewDateFormatter { /** * Sets whether to use the Geresh ׳ and Gershayim ״ in formatting Hebrew dates and numbers. The default * value is true and output would look like כ״א שבט תש״כ - * (or כ״א שבט תש״ך). When set to false, self output would + * (or כ״א שבט תש״ך). When set to false, this output would * display as כא שבט תשכ (or * כא שבט תשך). Single digit days or month or years such as כ׳ * שבט ו׳ אלפים show the use of the Geresh. @@ -617,7 +689,7 @@ public class HebrewDateFormatter { * Returns whether the class is set to use the מנצפ״ך letters when * formatting years ending in 20, 40, 50, 80 and 90 to produce תש״פ if false or * or תש״ף if true. Traditionally non-final form letters are used, so the year - * 5780 would be formatted as תש״פ if the default false is used here. If self returns + * 5780 would be formatted as תש״פ if the default false is used here. If this returns * true, the format תש״ף would be used. * * @return true if set to use final form letters when formatting Hebrew years. The default value is false. @@ -628,12 +700,12 @@ public class HebrewDateFormatter { /** * When formatting a Hebrew Year, traditionally years ending in 20, 40, 50, 80 and 90 are formatted using non-final - * form letters for example תש״פ for the year 5780. Setting self to true (the default + * form letters for example תש״פ for the year 5780. Setting this to true (the default * is false) will use the final form letters for מנצפ״ך and will format * the year 5780 as תש״ף. * * @param useFinalFormLetters - * Set self to true to use final form letters when formatting Hebrew years. + * Set this to true to use final form letters when formatting Hebrew years. */ public func setUseFinalFormLetters(useFinalFormLetters:Bool) { self.useFinalFormLetters = useFinalFormLetters; @@ -653,12 +725,12 @@ public class HebrewDateFormatter { /** * When formatting a Hebrew Year, traditionally the thousands digit is omitted and output for a year such as 5729 - * (1969 Gregorian) would be calculated for 729 and format as תשכ״ט. self method - * allows setting self to true to return the long format year such as ה׳ + * (1969 Gregorian) would be calculated for 729 and format as תשכ״ט. this method + * allows setting this to true to return the long format year such as ה׳ * תשכ״ט for 5729/1969. * * @param useLongHebrewYears - * Set self to true to use the long formatting + * Set this to true to use the long formatting */ public func setUseLongHebrewYears(useLongHebrewYears:Bool) { self.useLonghebrewYears = useLongHebrewYears; @@ -669,7 +741,7 @@ public class HebrewDateFormatter { * "21 Shevat, 5729" if not. * * @param JewishCalendar - * the JewishCalendar to be formatted + * the ``JewishCalendar`` to be formatted * @return the formatted date. If the formatter is set to Hebrew, it will format in the form, "day Month year" for * example כ״א שבט תשכ״ט, and the format * "21 Shevat, 5729" if not. @@ -683,11 +755,11 @@ public class HebrewDateFormatter { } /** - * Returns a string of the current Hebrew month such as "Tishrei". Returns a string of the current Hebrew month such + * Returns a string of the current Hebrew month such as "Tishrei". Or returns a string of the current Hebrew month such * as "אדר ב׳". * * @param JewishCalendar - * the JewishCalendar to format + * the ``JewishCalendar`` to format * @return the formatted month name * @see #isHebrewFormat() * @see #setHebrewFormat(boolean) @@ -721,14 +793,14 @@ public class HebrewDateFormatter { /** * Returns a String of the Omer day in the form ל״ג בעומר if - * Hebrew Format is set, or "Omer X" or "Lag B'Omer" if not. An empty string if there is no Omer self day. + * Hebrew Format is set, or "Omer X" or "Lag B'Omer" if not. An empty string if there is no Omer this day. * * @param jewishCalendar - * the JewishCalendar to be formatted + * the ``JewishCalendar`` to be formatted * - * @return a String of the Omer day in the form or an empty string if there is no Omer self day. The default - * formatting has a ב׳ prefix that would output בעומר, but self - * can be set via the {@link #setHebrewOmerPrefix(String)} method to use a ל and output + * @return a String of the Omer day in the form or an empty string if there is no Omer this day. The default + * formatting has a ב׳ prefix that would output בעומר, but this + * can be set via the ``setHebrewOmerPrefix(hebrewOmerPrefix:)`` method to use a ל and output * ל״ג לעומר. * @see #isHebrewFormat() * @see #getHebrewOmerPrefix() @@ -777,8 +849,8 @@ public class HebrewDateFormatter { /** * Returns the kviah in the traditional 3 letter Hebrew format where the first letter represents the day of week of - * Rosh Hashana, the second letter represents the lengths of Cheshvan and Kislev ({@link JewishCalendar#SHELAIMIM - * Shelaimim} , {@link JewishCalendar#KESIDRAN Kesidran} or {@link JewishCalendar#CHASERIM Chaserim}) and the 3rd letter + * Rosh Hashana, the second letter represents the lengths of Cheshvan and Kislev (``JewishCalendar.SHELAIMIM`` + * , ``JewishCalendar.KESIDRAN`` or ``JewishCalendar.CHASERIM``) and the 3rd letter * represents the day of week of Pesach. For example 5729 (1969) would return בשה (Rosh Hashana on * Monday, Shelaimim, and Pesach on Thursday), while 5771 (2011) would return השג (Rosh Hashana on * Thursday, Shelaimim, and Pesach on Tuesday). @@ -807,7 +879,7 @@ public class HebrewDateFormatter { /** * Formats the Daf Yomi Bavli in the format of - * "עירובין נ״ב" in {@link #isHebrewFormat() Hebrew}, + * "עירובין נ״ב" in ``isHebrewFormat() Hebrew}, * or the transliterated format of "Eruvin 52". * @param daf the Daf to be formatted. * @return the formatted daf. @@ -822,7 +894,7 @@ public class HebrewDateFormatter { /** * Formats the Daf Yomi Yerushalmi in the format - * of "עירובין נ״ב" in {@link #isHebrewFormat() Hebrew}, or + * of "עירובין נ״ב" in ``isHebrewFormat()`` Hebrew, or * the transliterated format of "Eruvin 52". * * @param daf the Daf to be formatted. @@ -859,7 +931,7 @@ public class HebrewDateFormatter { * * * @param number - * the number to be formatted. It will trow an IllegalArgumentException if the number is < 0 or > 9999. + * the number to be formatted. It will return a string containing an error if the number is < 0 or > 9999. * @return the Hebrew formatted number such as תשכ״ט * @see #isUseFinalFormLetters() * @see #isUseGershGershayim() @@ -867,11 +939,11 @@ public class HebrewDateFormatter { * */ public func formatHebrewNumber(number:Int) -> String { - // if (number < 0) { - // throw Error("negative numbers can't be formatted"); - // } else if (number > 9999) { - // throw Error("numbers > 9999 can't be formatted"); - // } + if (number < 0) { + return "negative numbers can't be formatted" + } else if (number > 9999) { + return "numbers > 9999 can't be formatted" + } let ALAFIM = "אלפים"; let EFES = "אפס"; @@ -883,7 +955,7 @@ public class HebrewDateFormatter { let jOnes = ["", "א", "ב", "ג", "ד", "ה", "ו", "ז", "ח", "ט"]; var number = number - if (number == 0) { // do we really need self? Should it be applicable to a date? + if (number == 0) { // do we really need this? Should it be applicable to a date? return EFES; } let shortNumber = number % 1000; // discard thousands @@ -945,7 +1017,7 @@ public class HebrewDateFormatter { } /** - * Retruns the list of transliterated parshiyos used by self formatter. + * Returns the list of transliterated parshiyos used by this formatter. * * @return the list of transliterated Parshios */ @@ -958,7 +1030,7 @@ public class HebrewDateFormatter { * default uses Ashkenazi American English transliteration. * * @param transliteratedParshaMap - * the transliterated Parshios as an EnumMap to set + * the transliterated Parshios as a Dictionary to set * @see #getTransliteratedParshiosList() */ public func setTransliteratedParshiosList(transliteratedParshaMap:[JewishCalendar.Parsha: String]) { @@ -966,17 +1038,17 @@ public class HebrewDateFormatter { } /** - * Returns a String with the name of the current parsha(ios). self method gets the current parsha by - * calling {@link JewishCalendar#getParshah()} that does not return a parsha for any non-Shabbos + * Returns a String with the name of the current parsha(ios). This method gets the current parsha by + * calling ``JewishCalendar.getParshah()`` that does not return a parsha for any non-Shabbos * or a Shabbos that occurs on a Yom Tov, and will return an empty String in those - * cases. If the class {@link #isHebrewFormat() is set to format in Hebrew} it will return a String + * cases. If the class ``isHebrewFormat()`` is set to format in Hebrew it will return a String * of the current parsha(ios) in Hebrew for example בראשית or * נצבים וילך or an empty string if there * are none. If not set to Hebrew, it returns a string of the parsha(ios) transliterated into Latin chars. The * default uses Ashkenazi pronunciation in typical American English spelling, for example Bereshis or * Nitzavim Vayeilech or an empty string if there are none. * - * @param jewishCalendar the JewishCalendar Object + * @param jewishCalendar the ``JewishCalendar`` Object * @return today's parsha(ios) in Hebrew for example, if the formatter is set to format in Hebrew, returns a string * of the current parsha(ios) in Hebrew for example בראשית or * נצבים וילך or an empty string if @@ -993,12 +1065,11 @@ public class HebrewDateFormatter { } /** - * Returns a String with the name of the current parsha(ios). self method overloads {@link - * HebrewDateFormatter#formatParsha(JewishCalendar)} and unlike that method, it will format the parsha passed - * to self method regardless of the day of week. self is the way to format a parsha retrieved from calling - * {@link JewishCalendar#getUpcomingParshah()}. + * Returns a String with the name of the current parsha(ios). This method overloads ``formatParsha(jewishCalendar:)`` and unlike that method, it will format the parsha passed + * to this method regardless of the day of week. This is the way to format a parsha retrieved from calling + * ``JewishCalendar.getUpcomingParshah()``. * - * @param parsha a JewishCalendar.Parsha object + * @param parsha a ``JewishCalendar.Parsha`` object * @return today's parsha(ios) in Hebrew for example, if the formatter is set to format in Hebrew, returns a string * of the current parsha(ios) in Hebrew for example בראשית or * נצבים וילך or an empty string if