public enum PersianAlgorithm extends Enum<PersianAlgorithm>
Enumeration of different calculation methods for the Persian calendar.
| Enum Constant and Description |
|---|
ASTRONOMICAL
Based on the astronomical calculation of vernal equinox as start of Persian year
usually in the Iranian Standard time.
|
BIRASHK
A popular proposal of Ahmad Birashk which uses a complex system of cycles and grand cycles.
|
BORKOWSKI
Based on the work of the Polish astronomer
Kazimierz Borkowski.
|
KHAYYAM
Uses a 33-year-cycle to determine a simple leap year rule (discovered by Omar Khayyam).
|
| Modifier and Type | Method and Description |
|---|---|
static AttributeKey<PersianAlgorithm> |
attribute()
Format attribute which helps to resolve algorithmic differences between various Persian dates.
|
boolean |
isLeapYear(int persianYear)
Determines if given persian year is a leap year.
|
static PersianAlgorithm |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static PersianAlgorithm[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final PersianAlgorithm BORKOWSKI
Based on the work of the Polish astronomer Kazimierz Borkowski.
This is the default and uses a refinement of the Khayyam 33-year-rule based on astronomical calculations for the Teheran mean time. However, users should keep following things in mind when discussing the possible errors:
+03:25:30 which deviates from the Iranian Standard Time
+03:30. In addition, it is questionable if the historic ancestor of the Persian calendar
has used any of these offsets in ancient times. public static final PersianAlgorithm KHAYYAM
Uses a 33-year-cycle to determine a simple leap year rule (discovered by Omar Khayyam).
If the remainder of the division of persian year by 33 is one of following numbers then and only then it is a leap year: 1, 5, 9, 13, 17, 22, 26, 30. The rule is correct for the Persian years 1178-1633 (gregorian: 1799-2254).
public static final PersianAlgorithm BIRASHK
A popular proposal of Ahmad Birashk which uses a complex system of cycles and grand cycles.
It works for most years but sometimes it is not in agreement with the astronomical nature of the Persian calendar. For example, the year 2025 (gregorian) is expected to break this rule.
public static final PersianAlgorithm ASTRONOMICAL
Based on the astronomical calculation of vernal equinox as start of Persian year usually in the Iranian Standard time.
The implementation works as follows:
AstronomicalSeason.inYear(int).UTC+03:30 if not specified otherwise. public static PersianAlgorithm[] values()
for (PersianAlgorithm c : PersianAlgorithm.values()) System.out.println(c);
public static PersianAlgorithm valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic static AttributeKey<PersianAlgorithm> attribute()
Format attribute which helps to resolve algorithmic differences between various Persian dates.
Following example demonstrates the difference between the standard algorithm and the algorithm proposed by A. Birashk:
PersianCalendar pcal = PersianCalendar.of(1403, 12, 30); // = 2025-03-20 (gregorian)
ChronoFormatter<PersianCalendar> f =
ChronoFormatter
.ofPattern("dd.MM.yyyy G", PatternType.CLDR, Locale.ROOT, PersianCalendar.axis())
.with(PersianAlgorithm.attribute(), PersianAlgorithm.BIRASHK);
assertThat(f.parse("01.01.1404 AP"), is(pcal));
assertThat(f.format(pcal), is("01.01.1404 AP"));
Standard value is: BORKOWSKI. It is also possible to use the
astronomical algorithm in combination with an arbitrary timezone offset
by setting the format attribute Attributes.TIMEZONE_ID to any ZonalOffset.
public boolean isLeapYear(int persianYear)
Determines if given persian year is a leap year.
persianYear - the persian year to be queriedtrue if the year is a leap year else falseIllegalArgumentException - if the year is out of range 1-3000Copyright © 2014–2021. All rights reserved.