public final class HinduMonth extends HinduPrimitive implements Comparable<HinduMonth>, ChronoCondition<HinduCalendar>, Serializable
The Hindu month varies in length and might also have a leap state when used in lunisolar context.
| Modifier and Type | Field and Description |
|---|---|
static AttributeKey<Boolean> |
RASI_NAMES
Format attribute which controls if Rasi names or traditional lunisolar names are used
for Hindu months in the solar calendar.
|
ADHIKA_INDICATOR, ADHIKA_IS_TRAILING| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(HinduMonth other)
Uses the comparing order of the lunisolar calendar.
|
boolean |
equals(Object obj) |
String |
getDisplayName(Locale locale)
Equivalent to the expression
getDisplayName(locale, TextWidth.WIDE, OutputContext.FORMAT). |
String |
getDisplayName(Locale locale,
TextWidth width,
OutputContext context)
Gets the description text dependent on the locale and style parameters.
|
int |
getRasi()
Obtains the value of solar month as the sun is going through the corresponding constellation (Rasi).
|
String |
getRasi(Locale locale)
Obtains the localized text of solar month corresponding to the Hindu zodiac (Rasi).
|
IndianMonth |
getValue()
Obtains the corresponding Indian month.
|
int |
hashCode() |
boolean |
isLeap()
Determines if this month is in leap state (intercalated month).
|
static HinduMonth |
of(IndianMonth month)
Gets the Hindu month which corresponds to the given Indian month.
|
static HinduMonth |
ofLunisolar(int month)
Gets the Hindu month which corresponds to the given numerical value in lunisolar context.
|
static HinduMonth |
ofSolar(int month)
Gets the Hindu month which corresponds to the given solar numerical value.
|
boolean |
test(HinduCalendar context)
Decides if given context matches this condition.
|
String |
toString() |
HinduMonth |
withLeap()
Obtains the leap month version of this month.
|
public static final AttributeKey<Boolean> RASI_NAMES
Format attribute which controls if Rasi names or traditional lunisolar names are used for Hindu months in the solar calendar.
The default is defined by the Hindu variant in question. For example, Kerala prefers Rasi names while most other parts of India use the lunisolar forms.
public static HinduMonth of(IndianMonth month)
Gets the Hindu month which corresponds to the given Indian month.
Users have to invoke the method withLeap() in order to obtain a leap month
in lunisolar context.
month - month of Indian national calendarpublic static HinduMonth ofLunisolar(int month)
Gets the Hindu month which corresponds to the given numerical value in lunisolar context.
Users have to invoke the method withLeap() in order to obtain a leap month
in lunisolar context. The first month is Chaitra.
month - month value in the range [1-12]IllegalArgumentException - if given argument is out of range 1-12public static HinduMonth ofSolar(int month)
Gets the Hindu month which corresponds to the given solar numerical value.
Note: The first month of solar calendar is Mesa (or in lunisolar naming Vaishakha).
month - month value in the range [1-12]IllegalArgumentException - if given argument is out of range 1-12getRasi(),
getRasi(Locale)public IndianMonth getValue()
Obtains the corresponding Indian month.
Important note: Hindu months in lunisolar context might be expunged which simply means that there are gaps in the numbering of the months per year. And intercalated months have the same number.
public int getRasi()
Obtains the value of solar month as the sun is going through the corresponding constellation (Rasi).
The first solar month is VAISHAKHA.
ofSolar(int),
getRasi(Locale)public String getRasi(Locale locale)
Obtains the localized text of solar month corresponding to the Hindu zodiac (Rasi).
In many cases however, the lunisolar name is still used and can be obtained by
getDisplayName(locale). If this month is in leap status then the localized word
for "adhika" will be inserted before the name.
getRasi(),
getDisplayName(Locale)public String getDisplayName(Locale locale)
Equivalent to the expression
getDisplayName(locale, TextWidth.WIDE, OutputContext.FORMAT).
If this month is in leap status then the localized word for "adhika" will be inserted before the name.
locale - language settingnull)getDisplayName(Locale, TextWidth, OutputContext)public String getDisplayName(Locale locale, TextWidth width, OutputContext context)
Gets the description text dependent on the locale and style parameters.
The second argument controls the width of description while the third argument is only relevant for languages which make a difference between stand-alone forms and embedded text forms (does not matter in English).
Note: Rasi names are not used by this method.
If this month is in leap status then the localized word for "adhika" will be inserted before the name.
locale - language settingwidth - text widthcontext - output contextnull)getRasi(Locale)public boolean isLeap()
Determines if this month is in leap state (intercalated month).
A leap month is followed by a normal month with same number.
isLeap in class HinduPrimitivepublic HinduMonth withLeap()
Obtains the leap month version of this month.
Leap months only exist in the lunisolar versions of the Hindu calendar.
public int compareTo(HinduMonth other)
Uses the comparing order of the lunisolar calendar.
Leap months are sorted before months with same number.
compareTo in interface Comparable<HinduMonth>other - another month to be compared withpublic boolean test(HinduCalendar context)
ChronoConditionDecides if given context matches this condition.
Due to better readability it is recommended to use following equivalent approach instead of this method::
import static net.time4j.Weekday.SATURDAY; import static net.time4j.Month.JANUARY; PlainDate date = PlainDate.of(2014, JANUARY, 25); System.out.println(SATURDAY.test(date)); // direct use System.out.println(date.matches(SATURDAY)); // recommended callback
test in interface Predicate<HinduCalendar>test in interface ChronoCondition<HinduCalendar>context - context as base of testing this conditiontrue if given time context matches this condition
else falseCopyright © 2014–2021. All rights reserved.