Class HinduMonth
- All Implemented Interfaces:
Serializable,Comparable<HinduMonth>,Predicate<HinduCalendar>,ChronoCondition<HinduCalendar>
The Hindu month varies in length and might also have a leap state when used in lunisolar context.
- Since:
- 5.6
- Author:
- Meno Hochschild
- See Also:
- Serialized Form
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic AttributeKey<Boolean>Format attribute which controls if Rasi names or traditional lunisolar names are used for Hindu months in the solar calendar.Fields inherited from class net.time4j.calendar.hindu.HinduPrimitive
ADHIKA_INDICATOR, ADHIKA_IS_TRAILING -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(HinduMonth other)Uses the comparing order of the lunisolar calendar.booleangetDisplayName(Locale locale)Equivalent to the expressiongetDisplayName(locale, TextWidth.WIDE, OutputContext.FORMAT).getDisplayName(Locale locale, TextWidth width, OutputContext context)Gets the description text dependent on the locale and style parameters.intgetRasi()Obtains the value of solar month as the sun is going through the corresponding constellation (Rasi).Obtains the localized text of solar month corresponding to the Hindu zodiac (Rasi).getValue()Obtains the corresponding Indian month.inthashCode()booleanisLeap()Determines if this month is in leap state (intercalated month).static HinduMonthof(IndianMonth month)Gets the Hindu month which corresponds to the given Indian month.static HinduMonthofLunisolar(int month)Gets the Hindu month which corresponds to the given numerical value in lunisolar context.static HinduMonthofSolar(int month)Gets the Hindu month which corresponds to the given solar numerical value.booleantest(HinduCalendar context)Decides if given context matches this condition.toString()withLeap()Obtains the leap month version of this month.
-
Field Details
-
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.
-
-
Method Details
-
of
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.- Parameters:
month- month of Indian national calendar- Returns:
- associated Hindu month
-
ofLunisolar
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.- Parameters:
month- month value in the range [1-12]- Returns:
- Hindu month as wrapper around a number
- Throws:
IllegalArgumentException- if given argument is out of range 1-12
-
ofSolar
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).
- Parameters:
month- month value in the range [1-12]- Returns:
- Hindu month as wrapper around a number
- Throws:
IllegalArgumentException- if given argument is out of range 1-12- See Also:
getRasi(),getRasi(Locale)
-
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.
- Returns:
- IndianMonth
-
getRasi
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.
- Returns:
- int
- See Also:
ofSolar(int),getRasi(Locale)
-
getRasi
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.- Parameters:
locale- localization parameter- Returns:
- String
- See Also:
getRasi(),getDisplayName(Locale)
-
getDisplayName
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.
- Parameters:
locale- language setting- Returns:
- descriptive text (long form, never
null) - See Also:
getDisplayName(Locale, TextWidth, OutputContext)
-
getDisplayName
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.
- Parameters:
locale- language settingwidth- text widthcontext- output context- Returns:
- descriptive text for given locale and style (never
null) - See Also:
getRasi(Locale)
-
isLeap
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.
- Specified by:
isLeapin classHinduPrimitive- Returns:
- boolean
-
withLeap
Obtains the leap month version of this month.
Leap months only exist in the lunisolar versions of the Hindu calendar.
- Returns:
- copy of this month but in leap state
-
equals
-
hashCode
public int hashCode() -
toString
-
compareTo
Uses the comparing order of the lunisolar calendar.
Leap months are sorted before months with same number.
- Specified by:
compareToin interfaceComparable<HinduMonth>- Parameters:
other- another month to be compared with- Returns:
- comparing result
-
test
Description copied from interface: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
- Specified by:
testin interfaceChronoCondition<HinduCalendar>- Specified by:
testin interfacePredicate<HinduCalendar>- Parameters:
context- context as base of testing this condition- Returns:
trueif given time context matches this condition elsefalse
-