Class HinduDay

All Implemented Interfaces:
Serializable, Comparable<HinduDay>, Predicate<HinduCalendar>, ChronoCondition<HinduCalendar>

public final class HinduDay extends HinduPrimitive implements Comparable<HinduDay>, ChronoCondition<HinduCalendar>, Serializable

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
  • Method Details

    • valueOf

      public static HinduDay valueOf(int dayOfMonth)

      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 class HinduPrimitive
      Returns:
      boolean
    • withLeap

      public HinduDay withLeap()

      Obtains the leap day version of this day.

      Returns:
      copy of this day but in leap state
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • compareTo

      public int compareTo(HinduDay other)

      Uses the comparing order of the lunisolar calendar.

      Leap days are sorted after days with same number.

      Specified by:
      compareTo in interface Comparable<HinduDay>
      Parameters:
      other - another month to be compared with
      Returns:
      comparing result
    • test

      public boolean test(HinduCalendar context)
      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 interface ChronoCondition<HinduCalendar>
      Specified by:
      test in interface Predicate<HinduCalendar>
      Parameters:
      context - context as base of testing this condition
      Returns:
      true if given time context matches this condition else false