Class HinduVariant

java.lang.Object
net.time4j.calendar.hindu.HinduVariant
All Implemented Interfaces:
Serializable, VariantSource

public final class HinduVariant extends Object implements VariantSource, Serializable

The Hindu calendar variants differ on various sets of calculations, month names and the choice of era.

Since:
5.6
Author:
Meno Hochschild
See Also:
Serialized Form
  • Method Details

    • from

      public static HinduVariant from(String variant)

      Parses given variant string.

      The variant string is the same as created by calling getVariant().

      Parameters:
      variant - variant string
      Returns:
      parsed variant
      Throws:
      IllegalArgumentException - if given argument cannot be parsed
      See Also:
      getVariant(), HinduRule.variant(), AryaSiddhanta.variant()
    • getDefaultEra

      public HinduEra getDefaultEra()

      Obtains the default era.

      Returns:
      HinduEra
    • getLocation

      public GeoLocation getLocation()

      Obtains the geographical reference point which is usually the holy city of Ujjain.

      Returns:
      GeoLocation
    • isSolar

      public boolean isSolar()

      Determines if this variant describes the solar Hindu calendar.

      Returns:
      boolean
    • isLunisolar

      public boolean isLunisolar()

      Determines if this variant describes the lunisolar Hindu calendar.

      Lunisolar variants follow either the amanta or the purnimanta scheme.

      Returns:
      boolean
      See Also:
      isAmanta(), isPurnimanta()
    • isAmanta

      public boolean isAmanta()

      Determines if this variant describes the amanta scheme.

      Months are synchronized with the New Moon.

      Returns:
      boolean
    • isPurnimanta

      public boolean isPurnimanta()

      Determines if this variant describes the purnimanta scheme.

      Months are synchronized with the Full Moon. The first day of a purnimanta month starts with 16 or higher.

      Returns:
      boolean
    • isOld

      public boolean isOld()

      Determines if this variant describes the old Hindu calendar based on mean astronomical values.

      Returns:
      boolean
    • isUsingElapsedYears

      public boolean isUsingElapsedYears()

      Does this variant use elapsed years?

      Elapsed years are the standard, however, in most southern parts of India current years are used, for example Madras, Malayali (Kollam) and Tamil use current years.

      Returns:
      boolean
      See Also:
      withElapsedYears(), withCurrentYears()
    • 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
    • getVariant

      public String getVariant()
      Description copied from interface: VariantSource

      Yields the variant name of a calendar system.

      Specified by:
      getVariant in interface VariantSource
      Returns:
      String which is empty if there are no variants
    • with

      public HinduVariant with(HinduEra defaultEra)

      Creates a copy of this variant with given preferred era.

      Note: The old Hindu calendar is not customizable.

      Parameters:
      defaultEra - the new deviating era
      Returns:
      modified copy or this variant if the era does not change
    • withElapsedYears

      public HinduVariant withElapsedYears()

      Creates a copy of this variant with elapsed years.

      Note: Elapsed years count one less than current years.

      Returns:
      modified copy or this variant if the elapsed year mode does not change
      See Also:
      withCurrentYears(), isUsingElapsedYears()
    • withCurrentYears

      public HinduVariant withCurrentYears()

      Creates a copy of this variant with current years.

      Note: Elapsed years count one less than current years. The old Hindu calendar is not customizable.

      Returns:
      modified copy or this variant if the elapsed year mode does not change
      See Also:
      withElapsedYears(), isUsingElapsedYears()
    • withAlternativeHinduSunrise

      @Deprecated public HinduVariant withAlternativeHinduSunrise()
      Deprecated.

      Outdated method without any effect.

      Returns:
      this variant (unchanged)
    • withModernAstronomy

      public HinduVariant withModernAstronomy(double depressionAngle)

      Creates a copy of this variant based on modern astronomy which also deploys an alternative internal calculation for the sunrise or sunset.

      Note: The old Hindu calendar is not customizable. Most calendar makers in India use geometric sunrise without refraction for the modern Hindu calendar, i.e. they use 0.0 as depression angle. Another author, Lahiri, uses the angle of 47' corresponding to (47 / 60) degrees.

      Parameters:
      depressionAngle - the depression angle of sun used in sunrise/sunset-calculations
      Returns:
      modified copy or this variant if in old style (Arya-Siddhanta)
      Throws:
      IllegalArgumentException - if the depression angle is not a rational number in range -10.0 <= x <= 10.0
    • withAlternativeLocation

      public HinduVariant withAlternativeLocation(GeoLocation location)

      Creates a copy of this variant with an alternative geographical location.

      By default, the location of the Holy City Ujjain is used.

      Note: The old Hindu calendar is not customizable.

      Parameters:
      location - alternative geographical location
      Returns:
      modified copy or this variant if the location does not change
      Throws:
      IllegalArgumentException - if the absolute latitude is beyond 60 degrees