Class HinduDay
- All Implemented Interfaces:
Serializable
,Comparable<HinduDay>
,Predicate<HinduCalendar>
,ChronoCondition<HinduCalendar>
The Hindu day of month extends between 1 and at maximum 32 and might also have a leap state when used in lunisolar context.
- Since:
- 5.6
- Author:
- Meno Hochschild
- See Also:
- Serialized Form
-
Field Summary
Fields inherited from class net.time4j.calendar.hindu.HinduPrimitive
ADHIKA_INDICATOR, ADHIKA_IS_TRAILING
-
Method Summary
Modifier and TypeMethodDescriptionint
Uses the comparing order of the lunisolar calendar.boolean
int
getValue()
Obtains the numerical value.int
hashCode()
boolean
isLeap()
Determines if this day of month is in leap state (intercalated day).boolean
test(HinduCalendar context)
Decides if given context matches this condition.toString()
static HinduDay
valueOf(int dayOfMonth)
Gets the Hindu day of month which corresponds to the given numerical value.withLeap()
Obtains the leap day version of this day.
-
Method Details
-
valueOf
Gets the Hindu day of month which corresponds to the given numerical value.
Users have to invoke the method
withLeap()
in order to obtain a leap day in lunisolar context.- Parameters:
dayOfMonth
- numerical value in the range [1-32]- Returns:
- Hindu day of month as wrapper around a number
- Throws:
IllegalArgumentException
- if given argument is out of range 1-32
-
getValue
public int getValue()Obtains the numerical value.
Important note: Hindu days in lunisolar context might be expunged which simply means that there are gaps in the numbering of the days per month. And intercalated days have the same number.
- Returns:
- int
-
isLeap
public boolean isLeap()Determines if this day of month is in leap state (intercalated day).
A leap day follows after an ordinary day while a leap month is before the ordinary month.
- Specified by:
isLeap
in classHinduPrimitive
- Returns:
- boolean
-
withLeap
Obtains the leap day version of this day.
- Returns:
- copy of this day but in leap state
-
equals
-
hashCode
public int hashCode() -
toString
-
compareTo
Uses the comparing order of the lunisolar calendar.
Leap days are sorted after days with same number.
- Specified by:
compareTo
in interfaceComparable<HinduDay>
- Parameters:
other
- another month to be compared with- Returns:
- comparing result
-
test
Description copied from interface:ChronoCondition
Decides 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:
test
in interfaceChronoCondition<HinduCalendar>
- Specified by:
test
in interfacePredicate<HinduCalendar>
- Parameters:
context
- context as base of testing this condition- Returns:
true
if given time context matches this condition elsefalse
-