Enum Class MoonPhase

java.lang.Object
java.lang.Enum<MoonPhase>
net.time4j.calendar.astro.MoonPhase
All Implemented Interfaces:
Serializable, Comparable<MoonPhase>, java.lang.constant.Constable

public enum MoonPhase extends Enum<MoonPhase>

Enumeration of the four most important moon phases.

Since:
3.36/4.31
Author:
Meno Hochschild
  • Enum Constant Details

    • NEW_MOON

      public static final MoonPhase NEW_MOON

      Phase of new moon.

    • FIRST_QUARTER

      public static final MoonPhase FIRST_QUARTER

      Marks the first quarter moon.

    • FULL_MOON

      public static final MoonPhase FULL_MOON

      Marks the full moon.

    • LAST_QUARTER

      public static final MoonPhase LAST_QUARTER

      Marks the last quarter moon.

  • Method Details

    • values

      public static MoonPhase[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static MoonPhase valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • after

      public Moment after(Moment moment)

      Obtains the first moon phase which is after given moment.

      Parameters:
      moment - the moment to be compared with
      Returns:
      first time of this phase after given moment
      Throws:
      IllegalArgumentException - if the associated year is not in the range -2000 <= year <= 3000
    • atOrAfter

      public Moment atOrAfter(Moment moment)

      Obtains the first moon phase which is at or after given moment.

      Parameters:
      moment - the moment to be compared with
      Returns:
      first time of this phase at or after given moment
      Throws:
      IllegalArgumentException - if the associated year is not in the range -2000 <= year <= 3000
      Since:
      3.39/4.34
    • before

      public Moment before(Moment moment)

      Obtains the last moon phase which is still before given moment.

      Parameters:
      moment - the moment to be compared with
      Returns:
      last time of this phase before given moment
      Throws:
      IllegalArgumentException - if the associated year is not in the range -2000 <= year <= 3000
    • minLunation

      public static int minLunation()

      Obtains the minimum supported lunation.

      Returns:
      int
      Since:
      3.38/4.33
      See Also:
      atLunation(int)
    • maxLunation

      public static int maxLunation()

      Obtains the maximum supported lunation.

      Returns:
      int
      Since:
      3.38/4.33
      See Also:
      atLunation(int)
    • atLunation

      public Moment atLunation(int n)

      Obtains the time of n-th lunation based on this type of phase.

      The parameter value n = 0 will determine the first phase after the calendar date 2000-01-01. For example, the expression NEW_MOON.atLunation(0) calculates the first new moon in year 2000 which is on the date 2000-01-06 (UTC). The lunation parameter should be chosen within the range minLunation() <= n <= maxLunation().

      Parameters:
      n - count of lunations (distance between two consecutive moon phases of same type)
      Returns:
      moment of this phase after given lunations
      Throws:
      IllegalArgumentException - if the associated year is not in the range -2000 <= year <= 3000
      See Also:
      minLunation(), maxLunation()
    • getIllumination

      public static double getIllumination(Moment moment)

      Determines the degree of illumination of the moon at given moment.

      The precision is limited to percent values (two digits after decimal point).

      Parameters:
      moment - universal time
      Returns:
      degree of illumination in range 0.00 <= i <= 1.00
    • getIllumination

      public static double getIllumination(Moment moment, int precision)

      Determines the degree of illumination of the moon at given moment.

      The accuracy is limited to percent values (two digits after decimal point) if specified as 0. For promille values, specify 1 etc. However, an increased precision does not imply more accuracy but is only suitable to show some vague tendencies. Percent precision is usually the best choice.

      Parameters:
      moment - universal time
      precision - desired count of fractional digits of percent values (in range 0-3)
      Returns:
      degree of illumination in range 0.00 <= i <= 1.00
      Throws:
      IndexOutOfBoundsException - if the precision is out of range
      Since:
      3.40/4.35