@CalendarType(value="bahai") public final class BadiCalendar extends Calendrical<BadiCalendar.Unit,BadiCalendar>
Represents the calendar used by the Baha'i community.
The calendar composes 19 days to a month, 19 months to a year (plus an intercalary period called Ayyam-i-Ha between the 18th and the 19th month), 19 years to a vahid cycle and finally 19 vahids to a major cycle. Days start at sunset. And a week starts on Friday at sunset. The first year of the calendar begins on 1844-03-21. Years before 2015 start in this implementation always on 21st of March, but then on the day (from sunset to sunset in Teheran) which contains the vernal equinox. The latter change follows a decision made by the Universal House of Justice.
Following elements which are declared as constants are registered by this class:
DAY_OF_DIVISIONDAY_OF_WEEKDAY_OF_YEARAYYAM_I_HAMONTH_OF_YEARYEAR_OF_VAHIDVAHIDKULL_I_SHAIYEAR_OF_ERAERAFurthermore, all elements defined in EpochDays are supported.
Formatting and parsing: When using format patterns the
dynamic pattern type
is strongly recommended instead of CLDR-like pattern types because this calendar
is structurally different from month-based calendars. Following symbol-element
table holds:
| element | symbol | type |
|---|---|---|
| ERA | G | text |
| YEAR_OF_ERA | y/Y | number |
| KULL_I_SHAI | k/K | number |
| VAHID | v/V | number |
| YEAR_OF_VAHID | x/X | number/text |
| MONTH_OF_YEAR | m/M | number/text |
| AYYAM_I_HA | A | text |
| DAY_OF_DIVISION | d/D | number |
| DAY_OF_WEEK | E | text |
It is strongly recommended to use the or-operator "|" in format patterns because not every date of this calendar has a month. Example:
ChronoFormatter<BadiCalendar> f =
ChronoFormatter.ofPattern(
"k.v.x.m.d|k.v.x.A.d",
PatternType.DYNAMIC,
Locale.GERMAN,
BadiCalendar.axis());
assertThat(
f.print(BadiCalendar.of(5, 11, BadiMonth.JALAL, 13)),
is("1.5.11.2.13"));
assertThat(
f.print(BadiCalendar.ofIntercalary(5, 11, 2)),
is("1.5.11.Aiyam-e Ha'.2"));
| Modifier and Type | Class and Description |
|---|---|
static class |
BadiCalendar.Unit
Defines come calendar units for the Badi calendar.
|
| Modifier and Type | Field and Description |
|---|---|
static ChronoElement<BadiIntercalaryDays> |
AYYAM_I_HA
Represents the period of intercalary days if available.
|
static StdCalendarElement<Integer,BadiCalendar> |
DAY_OF_DIVISION
Represents the day of month or an intercalary day.
|
static StdCalendarElement<Weekday,BadiCalendar> |
DAY_OF_WEEK
Represents the day of week.
|
static StdCalendarElement<Integer,BadiCalendar> |
DAY_OF_YEAR
Represents the day of year.
|
static ChronoElement<BadiEra> |
ERA
Represents the Bahai era.
|
static ChronoElement<Integer> |
KULL_I_SHAI
Represents the major cycle (kull-i-shai).
|
static StdCalendarElement<BadiMonth,BadiCalendar> |
MONTH_OF_YEAR
Represents the month if available.
|
static AttributeKey<FormattedContent> |
TEXT_CONTENT_ATTRIBUTE
Format attribute which controls the content of some text elements like months or weekdays.
|
static StdCalendarElement<Integer,BadiCalendar> |
VAHID
Represents the vahid cycle which consists of 19 years.
|
static StdCalendarElement<Integer,BadiCalendar> |
YEAR_OF_ERA
Represents the proleptic year of era (relative to gregorian year 1844).
|
static TextElement<Integer> |
YEAR_OF_VAHID
Represents the year of vahid cycle.
|
| Modifier and Type | Method and Description |
|---|---|
GeneralTimestamp<BadiCalendar> |
at(PlainTime time)
Creates a new local timestamp with this date and given wall time.
|
GeneralTimestamp<BadiCalendar> |
atTime(int hour,
int minute)
Is equivalent to
at(PlainTime.of(hour, minute)). |
static TimeAxis<BadiCalendar.Unit,BadiCalendar> |
axis()
Returns the associated time axis.
|
boolean |
contains(ChronoElement<?> element)
Queries if the value for given chronological element can be
accessed via
get(element). |
boolean |
equals(Object obj)
Based on the epoch day number and the calendar system.
|
int |
getDayOfDivision()
Yields the day of either Badi month or Ayyam-i-Ha.
|
Weekday |
getDayOfWeek()
Determines the day of standard-week (with seven days).
|
int |
getDayOfYear()
Yields the day of year.
|
BadiDivision |
getDivision()
Obtains either the month or the Ayyam-i-Ha-period.
|
int |
getKullishai()
Yields the major cycle (kull-i-shai) which is 361 years long.
|
BadiMonth |
getMonth()
Yields the Badi month if available.
|
int |
getVahid()
Yields the 19-year-cycle (vahid = unity).
|
int |
getYearOfEra()
Yields the proleptic Badi year related to the Bahai era.
|
int |
getYearOfVahid()
Yields the Badi year related to the vahid cycle.
|
int |
hashCode()
Based on the epoch day number.
|
boolean |
hasMonth()
Does this date contain a month?
|
boolean |
isIntercalaryDay()
Is this date an intercalary day?
|
boolean |
isLeapYear()
Is the year of this date a leap year?
|
static boolean |
isLeapYear(int kullishay,
int vahid,
int yearOfVahid)
Is given Badi year a leap year?
|
<V> boolean |
isValid(ChronoElement<V> element,
V value)
Tests if the value for given chronological value is invalid.
|
static boolean |
isValid(int kullishay,
int vahid,
int yearOfVahid,
BadiDivision division,
int day)
Queries if given parameter values form a well defined calendar date.
|
static BadiCalendar |
nowInSystemTime()
Obtains the current calendar date in system time.
|
static BadiCalendar |
of(int vahid,
int yearOfVahid,
BadiMonth month,
int day)
Creates a new instance of a Badi calendar date in first major cycle (gregorian years 1844-2204).
|
static BadiCalendar |
of(int vahid,
int yearOfVahid,
int month,
int day)
Creates a new instance of a Badi calendar date in first major cycle (gregorian years 1844-2204).
|
static BadiCalendar |
ofComplete(BadiEra era,
int yearOfEra,
BadiDivision division,
int day)
Creates a new instance of a Badi calendar date.
|
static BadiCalendar |
ofComplete(int kullishay,
int vahid,
int yearOfVahid,
BadiDivision division,
int day)
Creates a new instance of a Badi calendar date.
|
static BadiCalendar |
ofIntercalary(int vahid,
int yearOfVahid,
int day)
Creates a new instance of a Badi calendar date in first major cycle (gregorian years 1844-2204).
|
String |
toString()
Provides a complete textual representation of the state of
this time point.
|
compareTo, getDaysSinceEpochUTC, isAfter, isBefore, isSimultaneous, minus, plusmax, min, minus, minus, plus, plus, until, untilget, get, getInt, getMaximum, getMinimum, getRegisteredElements, getTimezone, hasTimezone, isValid, isValid, matches, with, with, with, withfrom, from, from, transform, transform, transform, transform, transform, transformisAfterAll, isAfterOrEqual, isBeforeAll, isBeforeOrEqualpublic static final AttributeKey<FormattedContent> TEXT_CONTENT_ATTRIBUTE
Standard value is: FormattedContent.TRANSCRIPTION. Example:
ChronoFormatter<BadiCalendar> f =
ChronoFormatter
.ofPattern(
"k-v-x-MMMM-d|k-v-x-A-d",
PatternType.DYNAMIC,
Locale.ENGLISH,
BadiCalendar.axis())
.with(BadiCalendar.TEXT_CONTENT_ATTRIBUTE, FormattedContent.HTML);
System.out.println(f.print(BadiCalendar.of(5, 11, BadiMonth.MASHIYYAT, 15)));
Output with underlined sh: "1-5-11-Mashíyyat-15"
YEAR_OF_VAHID,
MONTH_OF_YEAR,
DAY_OF_WEEK@FormattableElement(format="G", dynamic=true) public static final ChronoElement<BadiEra> ERA
Represents the Bahai era.
@FormattableElement(format="Y", alt="y", dynamic=true) public static final StdCalendarElement<Integer,BadiCalendar> YEAR_OF_ERA
Represents the proleptic year of era (relative to gregorian year 1844).
Note that this kind of year definition which counts years since the Bahai era deviates from the.
19-cycle. For the standard way to count years see the elements KULL_I_SHAI, VAHID
and YEAR_OF_VAHID.
@FormattableElement(format="K", alt="k", dynamic=true) public static final ChronoElement<Integer> KULL_I_SHAI
Represents the major cycle (kull-i-shai).
This calendar supports the values 1-3. However, only the first major cycle can be interpreted as safe while the higher values are an astronomic approximation.
@FormattableElement(format="V", alt="v", dynamic=true) public static final StdCalendarElement<Integer,BadiCalendar> VAHID
Represents the vahid cycle which consists of 19 years.
@FormattableElement(format="X", alt="x", dynamic=true) public static final TextElement<Integer> YEAR_OF_VAHID
Represents the year of vahid cycle.
The dynamic pattern symbol X or x will print the year of vahid either as text (big symbol letter) or as number (small symbol letter).
@FormattableElement(format="M", alt="m", dynamic=true) public static final StdCalendarElement<BadiMonth,BadiCalendar> MONTH_OF_YEAR
Represents the month if available.
Warning: A Badi date does not always have a month. If the
date is an intercalary day (Ayyam-i-Ha) then any access via get(MONTH_OF_YEAR)
to this element will be rejected by raising an exception. Users have first to make sure
that the date is not such an intercalary day.
However, it is always possible to query the date for the minimum or maximum month or to set the date to a month-related day even if the actual date is an intercalary day.
isIntercalaryDay(),
hasMonth()@FormattableElement(format="A", dynamic=true) public static final ChronoElement<BadiIntercalaryDays> AYYAM_I_HA
Represents the period of intercalary days if available.
Warning: A Badi date often does not have such a period. If the
date is not an intercalary day (Ayyam-i-Ha) then any access via get(AYYAM_I_HA)
to this element will be rejected by raising an exception. Users have first to make sure
that the date is such an intercalary day.
This element cannot be formatted in a numeric way but only as text. Therefore the dynamic format symbol A is only permitted as big letter.
isIntercalaryDay(),
hasMonth()@FormattableElement(format="D", alt="d", dynamic=true) public static final StdCalendarElement<Integer,BadiCalendar> DAY_OF_DIVISION
Represents the day of month or an intercalary day.
public static final StdCalendarElement<Integer,BadiCalendar> DAY_OF_YEAR
Represents the day of year.
@FormattableElement(format="E", dynamic=true) public static final StdCalendarElement<Weekday,BadiCalendar> DAY_OF_WEEK
Represents the day of week.
If the day-of-week is set to a new value then Time4J handles the calendar week as starting on Saturday.
public static BadiCalendar ofComplete(int kullishay, int vahid, int yearOfVahid, BadiDivision division, int day)
Creates a new instance of a Badi calendar date.
kullishay - major cycle of 361 years (only values 1, 2 or 3 are permitted)vahid - 19-year-cycle (in range 1-19)yearOfVahid - year in range 1-19division - either BadiMonth or BadiIntercalaryDaysday - day in range 1-19 (1-4/5 in case of Ayyam-i-Ha)BadiCalendarIllegalArgumentException - in case of any inconsistenciespublic static BadiCalendar ofComplete(BadiEra era, int yearOfEra, BadiDivision division, int day)
Creates a new instance of a Badi calendar date.
era - Bahai erayearOfEra - year of era in range 1-1083division - either BadiMonth or BadiIntercalaryDaysday - day in range 1-19 (1-4/5 in case of Ayyam-i-Ha)BadiCalendarIllegalArgumentException - in case of any inconsistenciespublic static BadiCalendar of(int vahid, int yearOfVahid, BadiMonth month, int day)
Creates a new instance of a Badi calendar date in first major cycle (gregorian years 1844-2204).
vahid - 19-year-cycle (in range 1-19)yearOfVahid - year in range 1-19month - Badi monthday - day in range 1-19BadiCalendarIllegalArgumentException - in case of any inconsistenciespublic static BadiCalendar of(int vahid, int yearOfVahid, int month, int day)
Creates a new instance of a Badi calendar date in first major cycle (gregorian years 1844-2204).
vahid - 19-year-cycle (in range 1-19)yearOfVahid - year in range 1-19month - month in range 1-19day - day in range 1-19BadiCalendarIllegalArgumentException - in case of any inconsistenciespublic static BadiCalendar ofIntercalary(int vahid, int yearOfVahid, int day)
Creates a new instance of a Badi calendar date in first major cycle (gregorian years 1844-2204).
vahid - 19-year-cycle (in range 1-19)yearOfVahid - year in range 1-19day - day in range 1-4/5BadiCalendar in the Ayyam-i-Ha-periodIllegalArgumentException - in case of any inconsistenciespublic static BadiCalendar nowInSystemTime()
Obtains the current calendar date in system time.
Convenient short-cut for: SystemClock.inLocalView().now(BadiCalendar.axis()).
SystemClock.inLocalView(),
ZonalClock.now(Chronology)public int getKullishai()
Yields the major cycle (kull-i-shai) which is 361 years long.
KULL_I_SHAIpublic int getVahid()
Yields the 19-year-cycle (vahid = unity).
VAHIDpublic int getYearOfVahid()
Yields the Badi year related to the vahid cycle.
YEAR_OF_VAHIDpublic int getYearOfEra()
Yields the proleptic Badi year related to the Bahai era.
YEAR_OF_ERApublic BadiMonth getMonth()
Yields the Badi month if available.
ChronoException - if this date is an intercalary day (Ayyam-i-Ha)MONTH_OF_YEAR,
isIntercalaryDay(),
hasMonth()public BadiDivision getDivision()
public int getDayOfDivision()
Yields the day of either Badi month or Ayyam-i-Ha.
DAY_OF_DIVISIONpublic Weekday getDayOfWeek()
Determines the day of standard-week (with seven days).
DAY_OF_WEEKpublic int getDayOfYear()
Yields the day of year.
DAY_OF_YEARpublic boolean isIntercalaryDay()
Is this date an intercalary day?
A date in the Badi calendar has either a month or is an intercalary day.
hasMonth(),
BadiIntercalaryDays.AYYAM_I_HApublic boolean hasMonth()
Does this date contain a month?
A date in the Badi calendar has either a month or is an intercalary day.
isIntercalaryDay()public boolean isLeapYear()
Is the year of this date a leap year?
public static boolean isLeapYear(int kullishay,
int vahid,
int yearOfVahid)
Is given Badi year a leap year?
kullishay - major cycle of 361 years (only values 1, 2 or 3 are permitted)vahid - 19-year-cycle (in range 1-19)yearOfVahid - year in range 1-19IllegalArgumentException - in case of any inconsistenciespublic static boolean isValid(int kullishay,
int vahid,
int yearOfVahid,
BadiDivision division,
int day)
Queries if given parameter values form a well defined calendar date.
kullishay - major cycle of 361 years (only values 1, 2 or 3 are permitted)vahid - 19-year-cycle (in range 1-19)yearOfVahid - year in range 1-19division - either BadiMonth or BadiIntercalaryDaysday - day in range 1-19 (1-4/5 in case of Ayyam-i-Ha)true if valid else falseofComplete(int, int, int, BadiDivision, int)public GeneralTimestamp<BadiCalendar> at(PlainTime time)
Creates a new local timestamp with this date and given wall time.
If the time T24:00 is used
then the resulting timestamp will automatically be normalized such
that the timestamp will contain the following day instead.
time - wall timepublic GeneralTimestamp<BadiCalendar> atTime(int hour, int minute)
Is equivalent to at(PlainTime.of(hour, minute)).
hour - hour of day in range (0-24)minute - minute of hour in range (0-59)IllegalArgumentException - if any argument is out of rangepublic boolean equals(Object obj)
CalendricalBased on the epoch day number and the calendar system.
In other words: Two date object are equal if they have the same temporal position on the local timeline and have the same calendrical type. Subclasses which define further state attributes must override this method.
If an only temporal comparison is required then the method
Calendrical.isSimultaneous(CalendarDate) is to be used.
equals in class Calendrical<BadiCalendar.Unit,BadiCalendar>Chronology.getChronoType()public int hashCode()
CalendricalBased on the epoch day number.
hashCode in class Calendrical<BadiCalendar.Unit,BadiCalendar>public String toString()
TimePointProvides a complete textual representation of the state of this time point.
The textual description often follows the conventions of ISO-8601. Usually the description starts with the chronological informations which are coarse-grained and ends with those ones which are fine-grained (for example the ISO-notation YYYY-MM-DD).
toString in class TimePoint<BadiCalendar.Unit,BadiCalendar>public boolean contains(ChronoElement<?> element)
ChronoDisplayQueries if the value for given chronological element can be
accessed via get(element).
If the argument is missing then this method will yield false.
Note: Elements which are not registered but define a suitable rule
are also accessible.
contains in interface ChronoDisplaycontains in class ChronoEntity<BadiCalendar>element - chronological element to be asked (optional)true if the element is registered or there is an element rule for evaluating the value
else falseChronoDisplay.get(ChronoElement)public <V> boolean isValid(ChronoElement<V> element, V value)
ChronoEntityTests if the value for given chronological value is invalid.
Notes: This method tests if given value to be in question can
be set via the expression with(element, value). A numerical
overflow situation (causing an ArithmeticException) will
usually not be checked.
isValid in class ChronoEntity<BadiCalendar>V - generic type of element valueelement - element the given value shall be assigned tovalue - candidate value to be validated (optional)true if the method with() can be called
without exception else falsewith(ChronoElement, V)public static TimeAxis<BadiCalendar.Unit,BadiCalendar> axis()
Returns the associated time axis.
Copyright © 2014–2021. All rights reserved.